Block energy storage now uses the new wrench api
This commit is contained in:
parent
6f6800e75a
commit
3011546462
1 changed files with 12 additions and 10 deletions
|
@ -39,10 +39,10 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import prospector.shootingstar.ShootingStar;
|
import prospector.shootingstar.ShootingStar;
|
||||||
import prospector.shootingstar.model.ModelCompound;
|
import prospector.shootingstar.model.ModelCompound;
|
||||||
|
import reborncore.api.IToolHandler;
|
||||||
import reborncore.common.BaseTileBlock;
|
import reborncore.common.BaseTileBlock;
|
||||||
import techreborn.Core;
|
import techreborn.Core;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.items.tools.ItemWrench;
|
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -70,16 +70,18 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
|
||||||
EnumFacing side, float hitX, float hitY, float hitZ) {
|
EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
ItemStack heldStack = player.getHeldItem(hand);
|
ItemStack heldStack = player.getHeldItem(hand);
|
||||||
if(heldStack.getItem() instanceof ItemWrench){
|
if(heldStack.getItem() instanceof IToolHandler){
|
||||||
if (state.getBlock() instanceof BlockEnergyStorage) {
|
if(((IToolHandler) heldStack.getItem()).handleTool(heldStack, pos, world, player, side, true)){
|
||||||
EnumFacing facing2 = state.getValue(BlockEnergyStorage.FACING);
|
if (state.getBlock() instanceof BlockEnergyStorage) {
|
||||||
if (facing2.getOpposite() == side) {
|
EnumFacing facing2 = state.getValue(BlockEnergyStorage.FACING);
|
||||||
facing2 = side;
|
if (facing2.getOpposite() == side) {
|
||||||
} else {
|
facing2 = side;
|
||||||
facing2 = side.getOpposite();
|
} else {
|
||||||
|
facing2 = side.getOpposite();
|
||||||
|
}
|
||||||
|
world.setBlockState(pos, state.withProperty(BlockEnergyStorage.FACING, facing2));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
world.setBlockState(pos, state.withProperty(BlockEnergyStorage.FACING, facing2));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue