Fix energy storage blocks not rotating
This commit is contained in:
parent
67acfaaab9
commit
81aee77869
3 changed files with 16 additions and 45 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue