1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-13 03:43:08 +00:00

code cleanup

This commit is contained in:
svitoos
2019-09-14 13:36:48 +03:00
committed by parly
parent 238be8955b
commit ac020859f3
2 changed files with 8 additions and 29 deletions

View File

@@ -58,7 +58,6 @@ public class TurtlePlaceCommand implements ITurtleCommand
// Remember old block // Remember old block
Direction direction = m_direction.toWorldDir( turtle ); Direction direction = m_direction.toWorldDir( turtle );
World world = turtle.getWorld();
BlockPos coordinates = turtle.getPosition().offset( direction ); BlockPos coordinates = turtle.getPosition().offset( direction );
// Create a fake player, and orient it appropriately // Create a fake player, and orient it appropriately
@@ -322,20 +321,8 @@ public class TurtlePlaceCommand implements ITurtleCommand
boolean placed = false; boolean placed = false;
BlockEntity existingTile = turtle.getWorld().getBlockEntity( position ); BlockEntity existingTile = turtle.getWorld().getBlockEntity( position );
if (placementContext.canPlace()) if( placementContext.canPlace() ) {
// See PlayerInteractionManager.processRightClickBlock if( stackCopy.useOnBlock( context ) == ActionResult.SUCCESS )
/*
PlayerInteractEvent.RightClickBlock event = ForgeHooks.onRightClickBlock( turtlePlayer, Hand.MAIN, position, side, new Vec3d( hitX, hitY, hitZ ) );
if( !event.isCanceled() ) */
{
/* if( item.onItemUseFirst( turtlePlayer, turtle.getWorld(), position, side, hitX, hitY, hitZ, Hand.MAIN_HAND) == ActionResult.SUCCESS )
{
placed = true;
turtlePlayer.loadInventory( stackCopy );
}
else*/
if( /* event.getUseItem() != Event.Result.DENY && */
stackCopy.useOnBlock( context ) == ActionResult.SUCCESS )
{ {
placed = true; placed = true;
turtlePlayer.loadInventory( stackCopy ); turtlePlayer.loadInventory( stackCopy );
@@ -343,13 +330,6 @@ public class TurtlePlaceCommand implements ITurtleCommand
} }
if( !placed && (item instanceof BucketItem || item instanceof BoatItem || item instanceof LilyPadItem || item instanceof GlassBottleItem) ) if( !placed && (item instanceof BucketItem || item instanceof BoatItem || item instanceof LilyPadItem || item instanceof GlassBottleItem) )
{
ActionResult actionResult = null; // ForgeHooks.onItemRightClick( turtlePlayer, Hand.MAIN_HAND);
if( actionResult == ActionResult.SUCCESS )
{
placed = true;
}
else if( actionResult == null )
{ {
TypedActionResult<ItemStack> result = stackCopy.use( turtle.getWorld(), turtlePlayer, Hand.MAIN_HAND ); TypedActionResult<ItemStack> result = stackCopy.use( turtle.getWorld(), turtlePlayer, Hand.MAIN_HAND );
if( result.getResult() == ActionResult.SUCCESS && !ItemStack.areEqualIgnoreDamage( stack, result.getValue() ) ) if( result.getResult() == ActionResult.SUCCESS && !ItemStack.areEqualIgnoreDamage( stack, result.getValue() ) )
@@ -358,7 +338,6 @@ public class TurtlePlaceCommand implements ITurtleCommand
turtlePlayer.loadInventory( result.getValue() ); turtlePlayer.loadInventory( result.getValue() );
} }
} }
}
// Set text on signs // Set text on signs
if( placed && item instanceof SignItem ) if( placed && item instanceof SignItem )