コード例 #1
0
 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();
 }
コード例 #2
0
 @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;
       }
     }
   }
 }