feat: hit to shear

This commit is contained in:
str1k3r committed 2026-09-26 21:09:52 -04:00
1 parent 7a19924d1d
commit 533640cafd
5 files changed
+18 -34

No files matched your search

-5
View File
@@ -870,11 +870,6 @@ byteArray GenericStats::param_craftedEntity(eINSTANCEOF entityId)
return instance->getParam_craftedEntity(entityId);
}
byteArray GenericStats::param_shearedEntity(eINSTANCEOF entityId)
{
return instance->getParam_shearedEntity(entityId);
}
byteArray GenericStats::param_time(int timediff)
{
return instance->getParam_time(timediff);
-2
View File
@@ -59,7 +59,6 @@ public:
static Stat* tamedEntity(eINSTANCEOF entityId) { return instance->get_tamedEntity(entityId); }
static Stat* curedEntity(eINSTANCEOF entityId) { return instance->get_curedEntity(entityId); }
static Stat* craftedEntity(eINSTANCEOF entityId) { return instance->get_craftedEntity(entityId); }
static Stat* shearedEntity(eINSTANCEOF entityId) { return instance->get_shearedEntity(entityId); }
static Stat* totalBlocksMined() { return instance->get_totalBlocksMined(); }
static Stat* timePlayed() { return instance->get_timePlayed(); }
@@ -168,7 +167,6 @@ public:
static byteArray param_tamedEntity(eINSTANCEOF mobType);
static byteArray param_curedEntity(eINSTANCEOF mobType);
static byteArray param_craftedEntity(eINSTANCEOF mobType);
static byteArray param_shearedEntity(eINSTANCEOF mobType);
static byteArray param_time(int timediff);
+17
View File
@@ -1646,6 +1646,23 @@ void Player::attack(shared_ptr<Entity> entity)
entity->clearFire();
}
}
if(entity->GetType()==eTYPE_SHEEP)
{
shared_ptr<Sheep> sheep = dynamic_pointer_cast<Sheep>(entity);
if (!level->isClientSide && !sheep->isSheared() && !isBaby())
{
sheep->setSheared(true);
int count = 1 + random->nextInt(3);
for (int i = 0; i < count; i++)
{
shared_ptr<ItemEntity> ie = spawnAtLocation(shared_ptr<ItemInstance>( new ItemInstance(Tile::cloth_Id, 1, sheep->getColor()) ), 1.0f);
ie->yd += random->nextFloat() * 0.05f;
ie->xd += (random->nextFloat() - random->nextFloat()) * 0.1f;
ie->zd += (random->nextFloat() - random->nextFloat()) * 0.1f;
}
}
}
causeFoodExhaustion(FoodConstants::EXHAUSTION_ATTACK);
}
-26
View File
@@ -162,32 +162,6 @@ float Sheep::getHeadEatAngleScale(float a)
bool Sheep::interact(shared_ptr<Player> player)
{
shared_ptr<ItemInstance> item = player->inventory->getSelected();
// 4J-JEV: Fix for #88212,
// Untrusted players shouldn't be able to sheer sheep.
if (!player->isAllowedToInteract( shared_from_this() ))
return false; //Animal::interact(player);
if (item != NULL && item->id == Item::shears->id && !isSheared() && !isBaby())
{
if (!level->isClientSide)
{
setSheared(true);
int count = 1 + random->nextInt(3);
for (int i = 0; i < count; i++)
{
shared_ptr<ItemEntity> ie = spawnAtLocation(shared_ptr<ItemInstance>( new ItemInstance(Tile::cloth_Id, 1, getColor()) ), 1.0f);
ie->yd += random->nextFloat() * 0.05f;
ie->xd += (random->nextFloat() - random->nextFloat()) * 0.1f;
ie->zd += (random->nextFloat() - random->nextFloat()) * 0.1f;
}
player->awardStat( GenericStats::shearedEntity(eTYPE_SHEEP), GenericStats::param_shearedEntity(eTYPE_SHEEP) );
}
item->hurt(1, player);
}
return Animal::interact(player);
}
+1 -1
View File
@@ -23,7 +23,7 @@ Bringing the October 10th 2014 Source Leak back down to TU0
## Added Features
- [ ] Eat to Instantly Heal
- [ ] Punching Sheep for wool
- [x] Punching Sheep for wool
## Removed Structures
- [ ] Abandoned Mineshafts