public static void create() { boolean register = false; if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { register = hasOptifine = FMLClientHandler.instance().hasOptifine(); } for (ModContainer modContainer : ModAPIManager.INSTANCE.getAPIList()) { if ("appliedenergistics2|API".equals(modContainer.getModId())) { if ("rv1".equals(modContainer.getVersion())) { hasOldAE2 = modContainer.getVersion() + " from " + modContainer.getSource().getName(); register = true; } else if (!"rv2".equals(modContainer.getVersion())) { hasUnknownAE2 = modContainer.getVersion() + " from " + modContainer.getSource().getName(); register = true; } } else if ("CoFHAPI|energy".equals(modContainer.getModId())) { if ("1.7.10R1.0.0".equals(modContainer.getVersion()) || "1.7.10R1.0.1".equals(modContainer.getVersion())) { hasOldRF = modContainer.getVersion() + " from " + modContainer.getSource().getName(); register = true; } } } if (register) { FMLCommonHandler.instance().registerCrashCallable(new EnderIOCrashCallable()); } }
public static final boolean isWrench( final Item equipped, final EntityPlayer ep, final int x, final int y, final int z) { if (ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools") && equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(ep, x, y, z)) { ((IToolWrench) equipped).wrenchUsed(ep, x, y, z); return true; } return false; }
@Override public void updateEntity() { if (interval > 0) { int next = this.chargeAmount + 2; next = Math.min(next, MAX_CHARGE); this.setChargeAmount(next); int r = this.round + 4; if (r > 360) r -= 360; this.round = r; this.interval--; } // 真下のTileのチェック TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); if (tile != null) { int ext = Math.min(this.chargeAmount, 2); boolean b = false; if (tile instanceof IChargeableMachine) { b = true; } if (!b && Loader.isModLoaded("SextiarySector")) { int ext2 = ext * PropertyHandler.rateGF(); ext2 = SS2DeviceHandler.inputEnergy(tile, ForgeDirection.UP, ext2, true); if (SS2DeviceHandler.isGFDevice(tile) && ext2 > 0) { SS2DeviceHandler.inputEnergy(tile, ForgeDirection.UP, ext2, false); this.chargeAmount -= ext; b = true; } } if (!b && ModAPIManager.INSTANCE.hasAPI("CoFHAPI|energy")) { int ext2 = ext * PropertyHandler.rateRF(); ext2 = RFDeviceHandler.inputEnergy(ForgeDirection.UP, tile, ext2, true); if (RFDeviceHandler.isRFDevice(tile) && ext2 > 0) { RFDeviceHandler.inputEnergy(ForgeDirection.UP, tile, ext2, false); this.chargeAmount -= ext; b = true; } } } if (!worldObj.isRemote) { this.updateServer(); } }
public ModSorter(List<ModContainer> modList, Map<String, ModContainer> nameLookup) { HashMap<String, ModContainer> sortingNameLookup = Maps.newHashMap(nameLookup); ModAPIManager.INSTANCE.injectAPIModContainers(modList, sortingNameLookup); buildGraph(modList, sortingNameLookup); }
// 右クリック効果 @Override public boolean onItemUse( ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { Block block = par3World.getBlock(par4, par5, par6); TileEntity tile = par3World.getTileEntity(par4, par5, par6); int meta = par3World.getBlockMetadata(par4, par5, par6); if (par2EntityPlayer == null) return false; boolean se = false; // charge if (tile instanceof MachineBase) { MachineBase machine = (MachineBase) tile; if (!machine.isFullCharged()) { int max = machine.getMaxChargeAmount(); int ret = machine.getChargeAmount() + 800; ret = MathHelper.clamp_int(ret, 0, max); machine.setChargeAmount(ret); se = true; } } else if (tile instanceof TileChargerDevice) { TileChargerDevice device = (TileChargerDevice) tile; if (!device.isFullCharged()) { int max = device.getMaxChargeAmount(); int ret = device.getChargeAmount() + 800; ret = MathHelper.clamp_int(ret, 0, max); device.setChargeAmount(ret); se = true; } } // RF else if (ModAPIManager.INSTANCE.hasAPI("CoFHAPI|energy") && RFDeviceHandler.isRFDevice(tile)) { se = RFDeviceHandler.inputEnergy(ForgeDirection.UP, tile, 1000, false) > 0; } // Barrel if (tile instanceof TileBrewingBarrel) { TileBrewingBarrel barrel = (TileBrewingBarrel) tile; if (!barrel.getAged() && !barrel.productTank.isEmpty()) { barrel.setAgingStage(4); se = true; } } // 骨粉 if (ItemDye.applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer)) { if (!par3World.isRemote) { par3World.playAuxSFX(2005, par4, par5, par6, 0); se = true; } } // どれでもなかった場合 if (!se) { if (block.canPlaceTorchOnTop(par3World, par4, par5, par6) && par3World.isAirBlock(par4, par5 + 1, par6)) { if (!par3World.isRemote) par3World.setBlock(par4, par5 + 1, par6, Blocks.torch); se = true; } } if (se) { par3World.playSoundAtEntity(par2EntityPlayer, "random.pop", 0.4F, 1.8F); } return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float playerX, float playerY, float playerZ) { if (ItemAttacher.canAttach(entityplayer.getCurrentEquippedItem())) { return false; } if (world.isRemote) { return true; } TileEntityGasTank tileEntity = (TileEntityGasTank) world.getTileEntity(x, y, z); int metadata = world.getBlockMetadata(x, y, z); if (entityplayer.getCurrentEquippedItem() != null) { Item tool = entityplayer.getCurrentEquippedItem().getItem(); if (ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools") && tool instanceof IToolWrench && !tool.getUnlocalizedName().contains("omniwrench")) { if (((IToolWrench) tool).canWrench(entityplayer, x, y, z)) { if (entityplayer.isSneaking()) { dismantleBlock(world, x, y, z, false); return true; } ((IToolWrench) tool).wrenchUsed(entityplayer, x, y, z); int change = 0; switch (tileEntity.facing) { case 3: change = 5; break; case 5: change = 2; break; case 2: change = 4; break; case 4: change = 3; break; } tileEntity.setFacing((short) change); world.notifyBlocksOfNeighborChange(x, y, z, this); return true; } } } if (tileEntity != null) { if (!entityplayer.isSneaking()) { entityplayer.openGui(Mekanism.instance, 10, world, x, y, z); return true; } } return false; }