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

Replace reflection with access transformers

This makes the code slightly neater and allows us to catch places where
the variable/function has been renamed between versions.
This commit is contained in:
SquidDev
2017-05-14 17:00:14 +01:00
parent 2fd01b2adf
commit 63cdc7a72e
7 changed files with 22 additions and 59 deletions

View File

@@ -17,10 +17,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import javax.annotation.Nonnull;
import java.lang.reflect.Method;
public class TurtleCompareCommand implements ITurtleCommand
{
@@ -58,22 +56,7 @@ public class TurtleCompareCommand implements ITurtleCommand
// Try createStackedBlock first
if( !lookAtBlock.hasTileEntity( lookAtState ) )
{
try
{
Method method = ReflectionHelper.findMethod(
Block.class, lookAtBlock,
new String[]{ "func_149644_j", "j", "createStackedBlock" },
IBlockState.class
);
if( method != null )
{
lookAtStack = (ItemStack)method.invoke( lookAtBlock, lookAtState );
}
}
catch( Exception e )
{
// ???
}
lookAtStack = lookAtBlock.createStackedBlock( lookAtState );
}
// See if the block drops anything with the same ID as itself