1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-09-07 12:57:55 +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
boolean placed = false;
ActionResult cancelResult = null; // ForgeHooks.onInteractEntityAt( turtlePlayer, hitEntity, hitPos, Hand.MAIN_HAND);
if( cancelResult == null )
{
cancelResult = hitEntity.interactAt( turtlePlayer, hitPos, Hand.MAIN_HAND );
}
ActionResult cancelResult = hitEntity.interactAt( turtlePlayer, hitPos, Hand.MAIN_HAND );
if( cancelResult == ActionResult.SUCCESS )
{
placed = true;
}
else
{
// See PlayerEntity.interactOn
// cancelResult = ForgeHooks.onInteractEntity( turtlePlayer, hitEntity, Hand.MAIN_HAND);
if( cancelResult == ActionResult.SUCCESS )
if( hitEntity.interact( turtlePlayer, Hand.MAIN_HAND ) )
{
placed = true;
}
else if( cancelResult == null )
else if( hitEntity instanceof LivingEntity )
{
if( hitEntity.interact( turtlePlayer, Hand.MAIN_HAND ) )
{
placed = true;
}
else if( hitEntity instanceof LivingEntity )
{
placed = stackCopy.useOnEntity( turtlePlayer, (LivingEntity) hitEntity, Hand.MAIN_HAND );
if( placed ) turtlePlayer.loadInventory( stackCopy );
}
placed = stackCopy.useOnEntity( turtlePlayer, (LivingEntity) hitEntity, Hand.MAIN_HAND );
if( placed ) turtlePlayer.loadInventory( stackCopy );
}
}