Skip to content

Commit

Permalink
correct order
Browse files Browse the repository at this point in the history
  • Loading branch information
Raycoms committed Sep 9, 2024
1 parent d5b3bae commit c44094e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,6 @@ protected void attemptToEat()
{
final IDeliverable edible = new StackList(getEdiblesList(), "Edible Food", 1);
final int slot = InventoryUtils.findFirstSlotInProviderNotEmptyWith(worker, edible::matches);
final ICitizenData citizenData = worker.getCitizenData();
if (slot > -1)
{
final ItemStack stack = worker.getInventoryCitizen().getStackInSlot(slot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,18 +592,12 @@ private void childFoodInteraction(final ItemStack usedStack, final Player player

if (!level.isClientSide())
{
ItemStackUtils.consumeFood(usedStack, this, player.getInventory());
addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 300));

playSound(SoundEvents.GENERIC_EAT, 1.5f, (float) SoundUtils.getRandomPitch(getRandom()));
Network.getNetwork()
.sendToTrackingEntity(new ItemParticleEffectMessage(usedStack,
getX(),
getY(),
getZ(),
getXRot(),
getYRot(),
getEyeHeight()), this);
Network.getNetwork().sendToTrackingEntity(new ItemParticleEffectMessage(usedStack, getX(), getY(), getZ(), getXRot(), getYRot(), getEyeHeight()), this);
ItemStackUtils.consumeFood(usedStack, this, player.getInventory());

}
}
else
Expand Down Expand Up @@ -631,18 +625,10 @@ private void eatFoodInteraction(final ItemStack usedStack, final Player player,
{
if (!level.isClientSide())
{
ItemStackUtils.consumeFood(usedStack, this, player.getInventory());

playSound(SoundEvents.GENERIC_EAT, 1.5f, (float) SoundUtils.getRandomPitch(getRandom()));
// Position needs to be centered on citizen, Eat AI wrong too?
Network.getNetwork()
.sendToTrackingEntity(new ItemParticleEffectMessage(usedStack,
getX(),
getY(),
getZ(),
getXRot(),
getYRot(),
getEyeHeight()), this);
Network.getNetwork().sendToTrackingEntity(new ItemParticleEffectMessage(usedStack, getX(), getY(), getZ(), getXRot(), getYRot(), getEyeHeight()), this);
ItemStackUtils.consumeFood(usedStack, this, player.getInventory());
}

interactionCooldown = 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,17 +516,9 @@ private InteractionResult directPlayerInteraction(final Player player, final Int
{
if (!level.isClientSide())
{
ItemStackUtils.consumeFood(usedStack, this, player.getInventory());
playSound(SoundEvents.GENERIC_EAT, 1.5f, (float) SoundUtils.getRandomPitch(getRandom()));
Network.getNetwork()
.sendToTrackingEntity(new ItemParticleEffectMessage(usedStack,
getX(),
getY(),
getZ(),
getXRot(),
getYRot(),
getEyeHeight()), this);

Network.getNetwork().sendToTrackingEntity(new ItemParticleEffectMessage(usedStack, getX(), getY(), getZ(), getXRot(), getYRot(), getEyeHeight()), this);
ItemStackUtils.consumeFood(usedStack, this, player.getInventory());
MessageUtils.forCitizen(this, MESSAGE_INTERACTION_VISITOR_FOOD).sendTo(player);
}
return InteractionResult.CONSUME;
Expand Down

0 comments on commit c44094e

Please sign in to comment.