public void onInteract(World world, int x, int y, int z, EntityPlayer ep) { LaserEffectTile te = (LaserEffectTile) world.getTileEntity(x, y, z); if (DragonAPICore.isReikasComputer() && ReikaObfuscationHelper.isDeObfEnvironment()) { ItemStack is = ep.getCurrentEquippedItem(); if (ChromaItems.SHARD.matchWith(is)) { int dmg = is.getItemDamage() % 16; if (dmg == CrystalElement.RED.ordinal()) { te.color.red = !te.color.red; } else if (dmg == CrystalElement.GREEN.ordinal()) { te.color.green = !te.color.green; } else if (dmg == CrystalElement.BLUE.ordinal()) { te.color.blue = !te.color.blue; } world.markBlockForUpdate(x, y, z); return; } else if (!this.isOmniDirectional() && is != null && is.getItem() == Items.diamond) { te.rotateable = !te.rotateable; world.markBlockForUpdate(x, y, z); return; } else if (te instanceof TargetTile && is != null && is.getItem() == Items.glowstone_dust) { ((TargetTile) te).trigger(!((TargetTile) te).isTriggered(), true, false); return; } else if (te instanceof PrismTile && is != null && is.getItem() == Items.emerald) { ((PrismTile) te).timer++; return; } if (this == EMITTER && !ep.isSneaking()) { te.fire(); return; } } if (!this.isOmniDirectional() && !world.isRemote) te.rotate(); }
@Override public int getLightValue(IBlockAccess iba, int x, int y, int z) { LaserEffectTile te = (LaserEffectTile) iba.getTileEntity(x, y, z); return te instanceof TargetTile && ((TargetTile) te).isTriggered() ? (ModList.COLORLIGHT.isLoaded() ? ReikaColorAPI.getPackedIntForColoredLight(te.getRenderColor(), 15) : 15) : 2; }
@Override public void onNeighborBlockChange(World world, int x, int y, int z, Block b) { if (DragonAPICore.isReikasComputer() && ReikaObfuscationHelper.isDeObfEnvironment()) { if (world.isBlockIndirectlyGettingPowered(x, y, z)) { if (world.getBlockMetadata(x, y, z) == LaserEffectType.EMITTER.ordinal()) { LaserEffectTile te = (LaserEffectTile) world.getTileEntity(x, y, z); te.fire(); return; } } } }
@Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setInteger("timer", timerLength); }
@Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); timerLength = tag.getInteger("timer"); }
@Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); tag.setBoolean("trigger", triggered); }
@Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); triggered = tag.getBoolean("trigger"); }