mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
add generic wrench handling to fully transparently support BC & COFH wrenches, and add a bonus IC2 wrench support.
This commit is contained in:
1 parent
d73796ad4d
commit
f6f7678f8b
15 files changed
+408
-124
No files matched your search
@@ -4,6 +4,7 @@ import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IMekWrench;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.common.Mekanism;
|
||||
@@ -17,6 +18,7 @@ import mekanism.common.block.states.BlockStateBasic.BasicBlockType;
|
||||
import mekanism.common.block.states.BlockStateFacing;
|
||||
import mekanism.common.content.boiler.SynchronizedBoilerData;
|
||||
import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.common.integration.wrenches.Wrenches;
|
||||
import mekanism.common.inventory.InventoryBin;
|
||||
import mekanism.common.item.ItemBlockBasic;
|
||||
import mekanism.common.multiblock.IMultiblock;
|
||||
@@ -434,30 +436,31 @@ public abstract class BlockBasic extends Block
|
||||
{
|
||||
TileEntityBin bin = (TileEntityBin)tile;
|
||||
|
||||
if(!stack.isEmpty() && MekanismUtils.hasUsableWrench(entityplayer, pos))
|
||||
IMekWrench wrenchHandler;
|
||||
|
||||
if(!stack.isEmpty() && (wrenchHandler = Wrenches.getHandler(stack)) != null)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
RayTraceResult raytrace = new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos);
|
||||
if (wrenchHandler.canUseWrench(entityplayer, hand, stack, raytrace))
|
||||
{
|
||||
Item tool = stack.getItem();
|
||||
|
||||
if(entityplayer.isSneaking())
|
||||
if(!world.isRemote)
|
||||
{
|
||||
dismantleBlock(state, world, pos, false);
|
||||
return true;
|
||||
wrenchHandler.wrenchUsed(entityplayer, hand, stack, raytrace);
|
||||
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
dismantleBlock(state, world, pos, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
int change = bin.facing.rotateY().ordinal();
|
||||
|
||||
bin.setFacing((short)change);
|
||||
world.notifyNeighborsOfStateChange(pos, this, true);
|
||||
}
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, hand, stack, new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos));
|
||||
}
|
||||
|
||||
int change = bin.facing.rotateY().ordinal();
|
||||
|
||||
bin.setFacing((short)change);
|
||||
world.notifyNeighborsOfStateChange(pos, this, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!world.isRemote)
|
||||
|
||||
Reference in new issue
Block a user