Java Code Examples for cpw.mods.fml.common.Optional#Method
The following examples show how to use
cpw.mods.fml.common.Optional#Method .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TileEntityDroneInterface.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override @Optional.Method(modid = ModIds.COMPUTERCRAFT) public boolean equals(IPeripheral other){ if(other == null) { return false; } if(this == other) { return true; } if(other instanceof TileEntity) { TileEntity tother = (TileEntity)other; return tother.getWorldObj().equals(worldObj) && tother.xCoord == xCoord && tother.yCoord == yCoord && tother.zCoord == zCoord; } return false; }
Example 2
Source File: TileEntity_GTDataServer.java From bartworks with MIT License | 5 votes |
@Optional.Method(modid = "OpenComputers") @Callback public Object[] listData(Context context, Arguments args) { Set<String> ret = new HashSet<>(); for (Map.Entry<Long,GT_NBT_DataBase> entry : OrbDataBase.entrySet()){ ret.add((entry.getValue().getId()+Long.MAX_VALUE)+". "+entry.getValue().getmDataTitle()); } return ret.toArray(new String[0]); }
Example 3
Source File: TileEntityTurbineComputerPort.java From BigReactors with MIT License | 5 votes |
@Override @Optional.Method(modid = "ComputerCraft") public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) { try { return callMethod(method, arguments); } catch(Exception e) { BRLog.info("Exception encountered when invoking computercraft method: %s", e.getMessage()); e.printStackTrace(); } return null; }
Example 4
Source File: TileEntityBase.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override @Optional.Method(modid = ModIds.COMPUTERCRAFT) public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException{ try { return luaMethods.get(method).call(arguments); } catch(Exception e) { throw new LuaException(e.getMessage()); } }
Example 5
Source File: BlockReactorPart.java From BigReactors with MIT License | 5 votes |
@Optional.Method(modid ="ComputerCraft") @Override public IPeripheral getPeripheral(World world, int x, int y, int z, int side) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityReactorComputerPort) return (IPeripheral)te; return null; }
Example 6
Source File: SemiBlockRequester.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override @Optional.Method(modid = ModIds.AE2) public void invalidate(){ super.invalidate(); if(gridNode != null) { disconnectFromInterface(); } }
Example 7
Source File: BlockReactorPart.java From BigReactors with MIT License | 5 votes |
@Optional.Method(modid = "MineFactoryReloaded") @Override public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityReactorRedNetPort) { return ((TileEntityReactorRedNetPort)te).getValueForChannel(subnet); } return 0; }
Example 8
Source File: NEIbartworksConfig.java From bartworks with MIT License | 5 votes |
@Optional.Method(modid = "NotEnoughItems") @Override public void loadConfig() { API.hideItem(new ItemStack(ItemRegistry.TAB)); API.hideItem(new ItemStack(FluidLoader.bioFluidBlock)); API.hideItem(new ItemStack(ItemRegistry.bw_fake_glasses)); ItemStack[] prefixesToHide = { WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.dustTiny, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.dustSmall, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.crushed, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.crushedPurified, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.crushedCentrifuged, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.nugget, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.gemChipped, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.gemFlawed, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.gemFlawless, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.gemExquisite, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.dustImpure, WerkstoffLoader.Bismutite).copy(), WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.dustPure, WerkstoffLoader.Bismutite).copy(), }; for (ItemStack stack : prefixesToHide) { stack.setItemDamage(Short.MAX_VALUE); API.hideItem(stack); } // for (int i = 0; i < Short.MAX_VALUE; i++) { // API.addItemListEntry(new ItemStack(WerkstoffLoader.BWOres,1,i)); // } }
Example 9
Source File: SemiBlockRequester.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override @Optional.Method(modid = ModIds.AE2) public void updateWatcher(ICraftingWatcher watcher){ craftingWatcher = watcher; updateProvidingItems(); }
Example 10
Source File: GT_TileEntity_MegaVacuumFreezer.java From bartworks with MIT License | 4 votes |
@Override @SuppressWarnings({"rawtypes", "unchecked"}) @Optional.Method(modid = "tectech") public List getTecTechEnergyTunnels() { return TTTunnels; }
Example 11
Source File: TileEntityUniversalSensor.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override @Optional.Method(modid = ModIds.COMPUTERCRAFT) public void attach(IComputerAccess computer){ attachedComputers.add(computer); }
Example 12
Source File: SemiBlockRequesterAE.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override @Optional.Method(modid = ModIds.AE2) public boolean canAccept(IAEItemStack arg0){ return false; }
Example 13
Source File: TileEntity_GTDataServer.java From bartworks with MIT License | 4 votes |
@Optional.Method(modid = "OpenComputers") @Callback public Object[] imprintOrb(Context context, Arguments args) { return new Object[]{false}; }
Example 14
Source File: SemiBlockRequester.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Optional.Method(modid = ModIds.AE2) private void disconnectFromInterface(){ ((IGridNode)gridNode).destroy(); gridNode = null; }
Example 15
Source File: TileEntityInterfaceFluid.java From ExtraCells1 with MIT License | 4 votes |
@Optional.Method(modid = "ComputerCraft") @Override public boolean canAttachToSide(int side) { return true; }
Example 16
Source File: BlockReactorRedstonePort.java From BigReactors with MIT License | 4 votes |
@Optional.Method(modid = "MineFactoryReloaded") @Override public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet) { return isProvidingWeakPower(world, x, y, z, side.ordinal()); }
Example 17
Source File: TubeModule.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Optional.Method(modid = ModIds.FMP) public void writeDesc(MCDataOutput data){ data.writeInt(dir.ordinal()); }
Example 18
Source File: BlockReactorRedstonePort.java From BigReactors with MIT License | 4 votes |
@Optional.Method(modid = "MineFactoryReloaded") @Override public int[] getOutputValues(World world, int x, int y, int z, ForgeDirection side) { return null; }
Example 19
Source File: TileEntityReactorComputerPort.java From BigReactors with MIT License | 4 votes |
@Override @Optional.Method(modid = "ComputerCraft") public void detach(IComputerAccess computer) { }
Example 20
Source File: PneumaticCraftUtils.java From PneumaticCraft with GNU General Public License v3.0 | 2 votes |
/** * This will return true if the given item ID is the same as the item id that can be retrieved from IC2's item key. * @param id * @param ic2ItemKey * @return */ @Optional.Method(modid = ModIds.INDUSTRIALCRAFT) public static boolean isIC2Item(Item id, String ic2ItemKey){ ItemStack ic2Item = IC2Items.getItem(ic2ItemKey); return ic2Item != null && ic2Item.getItem() == id; }