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