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:
@@ -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 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user