1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-29 21:02:59 +00:00

Fix the use of the item on the entity

This commit is contained in:
svitoos
2019-09-14 02:29:43 +03:00
committed by parly
parent 799bb77847
commit f997b02b8f

View File

@@ -227,35 +227,21 @@ public class TurtlePlaceCommand implements ITurtleCommand
// Place on the entity // Place on the entity
boolean placed = false; boolean placed = false;
ActionResult cancelResult = null; // ForgeHooks.onInteractEntityAt( turtlePlayer, hitEntity, hitPos, Hand.MAIN_HAND); ActionResult cancelResult = hitEntity.interactAt( turtlePlayer, hitPos, Hand.MAIN_HAND );
if( cancelResult == null )
{
cancelResult = hitEntity.interactAt( turtlePlayer, hitPos, Hand.MAIN_HAND );
}
if( cancelResult == ActionResult.SUCCESS ) if( cancelResult == ActionResult.SUCCESS )
{ {
placed = true; placed = true;
} }
else else
{ {
// See PlayerEntity.interactOn if( hitEntity.interact( turtlePlayer, Hand.MAIN_HAND ) )
// cancelResult = ForgeHooks.onInteractEntity( turtlePlayer, hitEntity, Hand.MAIN_HAND);
if( cancelResult == ActionResult.SUCCESS )
{ {
placed = true; placed = true;
} }
else if( cancelResult == null ) else if( hitEntity instanceof LivingEntity )
{ {
if( hitEntity.interact( turtlePlayer, Hand.MAIN_HAND ) ) placed = stackCopy.useOnEntity( turtlePlayer, (LivingEntity) hitEntity, Hand.MAIN_HAND );
{ if( placed ) turtlePlayer.loadInventory( stackCopy );
placed = true;
}
else if( hitEntity instanceof LivingEntity )
{
placed = stackCopy.useOnEntity( turtlePlayer, (LivingEntity) hitEntity, Hand.MAIN_HAND );
if( placed ) turtlePlayer.loadInventory( stackCopy );
}
} }
} }