1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-26 07:03:22 +00:00

Fix TurtleCompareCommand throwing exceptions

Originally introduced in 173ea72001, but
the underlying cause has been happening for much longer.

 - Fix order of method name parameters. Looks like this has been broken
   since 1.11. Woops.
 - Catch RuntimeExceptions too, as Forge converts checked into unchecked
   ones.

Fixes #179
This commit is contained in:
SquidDev 2019-04-19 18:53:39 +01:00
parent f93da7ea51
commit 2e0ef6385d

View File

@ -53,19 +53,15 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
Block lookAtBlock = lookAtState.getBlock();
if( !lookAtBlock.isAir( lookAtState, world, newPosition ) )
{
// Try createStackedBlock first
// Try getSilkTouchDrop first
if( !lookAtBlock.hasTileEntity( lookAtState ) )
{
try
{
Method method = ReflectionHelper.findMethod(
Block.class,
"func_180643_i", "getSilkTouchDrop",
IBlockState.class
);
Method method = ReflectionHelper.findMethod( Block.class, "getSilkTouchDrop", "func_180643_i", IBlockState.class );
lookAtStack = (ItemStack) method.invoke( lookAtBlock, lookAtState );
}
catch( ReflectiveOperationException ignored )
catch( ReflectiveOperationException | RuntimeException ignored )
{
}
}