use of crazypants.enderio.base.BlockEio in project EnderIO by SleepyTrousers.
the class TOPCompatibility method addProbeInfo.
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData hitData) {
if (mode == ProbeMode.DEBUG) {
probeInfo.text(blockState.toString());
}
if (probeInfo != null && world != null && blockState != null && hitData != null && (blockState.getBlock() instanceof BlockEio || blockState.getBlock() instanceof IPaintable)) {
TileEntity tileEntity = BlockEnder.getAnyTileEntitySafe(world, NullHelper.notnull(hitData.getPos(), "JEI wants it so"));
if (tileEntity != null) {
EioBox eiobox = new EioBox(probeInfo);
TOPData data = new TOPData(tileEntity, hitData);
mkOwner(mode, eiobox, data);
mkPaint(mode, eiobox, data);
mkNotificationLine(mode, eiobox, data);
mkProgressLine(mode, eiobox, data);
mkRfLine(mode, eiobox, data);
mkXPLine(mode, eiobox, data);
mkRedstoneLine(mode, eiobox, data);
mkSideConfigLine(mode, eiobox, data);
mkRangeLine(mode, eiobox, data);
mkTankLines(mode, eiobox, data);
mkItemFillLevelLine(mode, eiobox, data);
eiobox.finish();
EioBox mobbox = new EioBox(probeInfo);
mkMobsBox(mode, mobbox, world, data);
mobbox.finish();
}
}
}
use of crazypants.enderio.base.BlockEio in project EnderIO by SleepyTrousers.
the class ItemYetaWrench method onItemUseFirst.
@Override
@Nonnull
public EnumActionResult onItemUseFirst(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing side, float hitX, float hitY, float hitZ, @Nonnull EnumHand hand) {
if (world.isRemote) {
// If its client side we have to return pass so this method is called on server, where we need to perform the op
return EnumActionResult.PASS;
}
final IBlockState blockState = world.getBlockState(pos);
IBlockState bs = blockState;
Block block = bs.getBlock();
boolean ret = false;
RightClickBlock e = new RightClickBlock(player, hand, pos, side, new Vec3d(hitX, hitY, hitZ));
if (MinecraftForge.EVENT_BUS.post(e) || e.getResult() == Result.DENY || e.getUseBlock() == Result.DENY || e.getUseItem() == Result.DENY) {
return EnumActionResult.PASS;
}
if (block instanceof BlockDoor) {
EnumDoorHalf half = bs.getValue(BlockDoor.HALF);
if (half == EnumDoorHalf.UPPER) {
pos = pos.down();
}
}
if (!player.isSneaking() && block.rotateBlock(world, pos, side)) {
ret = true;
} else if (block instanceof IBlockPaintableBlock && !player.isSneaking() && !YetaUtil.shouldHeldItemHideFacades(player)) {
IBlockState paintSource = ((IBlockPaintableBlock) block).getPaintSource(blockState, world, pos);
if (paintSource != null) {
final IBlockState rotatedPaintSource = PaintUtil.rotate(paintSource);
if (rotatedPaintSource != paintSource) {
((IBlockPaintableBlock) block).setPaintSource(blockState, world, pos, rotatedPaintSource);
}
ret = true;
}
}
// so 'onBlockActivated' is never called
if (!ret && player.isSneaking() && block instanceof BlockEio<?>) {
BlockEio<?> beio = (BlockEio<?>) block;
if (beio.shouldWrench(world, pos, player, side)) {
beio.onBlockActivated(world, pos, bs, player, hand, side, hitX, hitY, hitZ);
ret = true;
}
}
if (ret) {
player.swingArm(hand);
}
return ret ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
}
Aggregations