Fix energy storage blocks not rotating

This commit is contained in:
modmuss50 2017-06-29 16:03:22 +01:00
parent 67acfaaab9
commit 81aee77869
No known key found for this signature in database
GPG key ID: 203A5ED4D3E48BEA
3 changed files with 16 additions and 45 deletions

View file

@ -42,6 +42,7 @@ import prospector.shootingstar.model.ModelCompound;
import reborncore.common.BaseTileBlock;
import techreborn.Core;
import techreborn.client.TechRebornCreativeTab;
import techreborn.items.tools.ItemWrench;
import techreborn.lib.ModInfo;
import java.util.Iterator;
@ -68,6 +69,20 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack heldStack = player.getHeldItem(hand);
if(heldStack.getItem() instanceof ItemWrench){
if (state.getBlock() instanceof BlockEnergyStorage) {
EnumFacing facing2 = state.getValue(BlockEnergyStorage.FACING);
if (facing2.getOpposite() == side) {
facing2 = side;
} else {
facing2 = side.getOpposite();
}
world.setBlockState(pos, state.withProperty(BlockEnergyStorage.FACING, facing2));
return true;
}
}
if (!player.isSneaking())
player.openGui(Core.INSTANCE, guiID, world, pos.getX(), pos.getY(), pos.getZ());
return true;