1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-12 11:10:29 +00:00

Remove AT for Block.createStackedBlock

Access transformers do not propagate to sub classes, and so the access
transformer did not work here. Reverting to reflection fixes this issue.
This commit is contained in:
SquidDev 2017-05-16 21:19:36 +01:00
parent ba4b1e21fe
commit b5e75a86c8
2 changed files with 15 additions and 5 deletions

View File

@ -14,11 +14,13 @@ import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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
{
@ -56,7 +58,18 @@ public class TurtleCompareCommand implements ITurtleCommand
// Try createStackedBlock first
if( !lookAtBlock.hasTileEntity( lookAtState ) )
{
lookAtStack = lookAtBlock.createStackedBlock( lookAtState );
try
{
Method method = ReflectionHelper.findMethod(
Block.class, lookAtBlock,
new String[] { "func_180643_i", "createStackedBlock" },
IBlockState.class
);
lookAtStack = (ItemStack) method.invoke( lookAtBlock, lookAtState );
}
catch( Exception e )
{
}
}
// See if the block drops anything with the same ID as itself

View File

@ -1,6 +1,3 @@
# RecordMedia (and related methods)
public net.minecraft.item.ItemRecord field_185076_b # sound
public net.minecraft.item.ItemRecord field_185077_c # displayName
# TurtleCompareCommand
public net.minecraft.block.Block func_180643_i(Lnet/minecraft/block/state/IBlockState;)Lnet/minecraft/item/ItemStack; # createStackedBlock