public boolean canSetPreferred() { ItemStack input = lexiconInv.getStackInSlot(0); if (input == null) { return false; } return LexiconManager.validOre(input); }
public boolean doClearPreferred() { if (!hasPreferredOre()) { return false; } LexiconManager.clearPreferredStack(player, lexiconInv.getStackInSlot(0)); hasPreferredStack = false; syncClient = true; return true; }
public boolean doSetPreferred() { if (!canSetPreferred()) { return false; } LexiconManager.setPreferredStack(player, lexiconInv.getStackInSlot(0)); hasPreferredStack = true; syncClient = true; return true; }
@EventHandler public void loadComplete(FMLLoadCompleteEvent event) { LexiconManager.loadComplete(); TFPlugins.loadComplete(); cleanConfig(false); config.cleanUp(false, true); configClient.cleanUp(false, true); log.info("Load Complete."); }
public void handlePacket(PacketTFBase payload) { switch (payload.getByte()) { case ORE_PREV: prevOre(); return; case ORE_NEXT: nextOre(); return; case SET_PREFERRED: doSetPreferred(); return; case CLEAR_PREFERRED: doClearPreferred(); return; case SELECT_ORE: String oreName = payload.getString(); oreList = OreDictionaryArbiter.getOres(oreName); if (LexiconManager.hasPreferredStack(player, oreName)) { ItemStack ore = LexiconManager.getPreferredStack(player, oreName); lexiconInv.setInventorySlotContents(0, ore); for (int i = 0; i < oreList.size(); i++) { if (oreList.get(i) == ore) { oreSelection = i; break; } } hasPreferredStack = true; } else { lexiconInv.setInventorySlotContents(0, OreDictionaryArbiter.getOres(oreName).get(0)); oreSelection = 0; hasPreferredStack = false; } syncClient = true; default: } }
@EventHandler public void preInit(FMLPreInitializationEvent event) { UpdateManager.registerUpdater(new UpdateManager(this, releaseURL, CoFHProps.DOWNLOAD_URL)); config.setConfiguration( new Configuration( new File(CoFHProps.configDir, "/cofh/thermalfoundation/common.cfg"), true)); configClient.setConfiguration( new Configuration( new File(CoFHProps.configDir, "cofh/thermalfoundation/client.cfg"), true)); tabCommon = new TFCreativeTab(); cleanConfig(true); configOptions(); TFFluids.preInit(); TFItems.preInit(); TFBlocks.preInit(); TFPlugins.preInit(); LexiconManager.preInit(); }