From 74a9bcc5a0b7e179a71932e7dba88794deeb4c99 Mon Sep 17 00:00:00 2001 From: kuba6000 Date: Mon, 10 Apr 2023 21:03:52 +0200 Subject: Update spotless formatting --- src/main/java/kubatech/loaders/ItemLoader.java | 2 +- .../java/kubatech/loaders/MobRecipeLoader.java | 246 ++++++++------- src/main/java/kubatech/loaders/RecipeLoader.java | 331 ++++++++++----------- src/main/java/kubatech/loaders/TCLoader.java | 84 +++--- .../java/kubatech/loaders/block/BlockProxy.java | 7 +- .../java/kubatech/loaders/block/KubaBlock.java | 59 ++-- .../java/kubatech/loaders/block/KubaItemBlock.java | 11 +- src/main/java/kubatech/loaders/item/ItemProxy.java | 36 ++- src/main/java/kubatech/loaders/item/KubaItems.java | 7 +- src/main/java/kubatech/loaders/item/items/Tea.java | 3 +- .../kubatech/loaders/item/items/TeaCollection.java | 70 +++-- .../kubatech/loaders/item/items/TeaUltimate.java | 208 ++++++------- 12 files changed, 540 insertions(+), 524 deletions(-) (limited to 'src/main/java/kubatech/loaders') diff --git a/src/main/java/kubatech/loaders/ItemLoader.java b/src/main/java/kubatech/loaders/ItemLoader.java index a0f28dc391..68c62226c7 100644 --- a/src/main/java/kubatech/loaders/ItemLoader.java +++ b/src/main/java/kubatech/loaders/ItemLoader.java @@ -67,7 +67,7 @@ public class ItemLoader { PartiallyOxidizedTeaLeaf.set(kubaitems.registerProxyItem(new TeaIngredient("partially_oxidized_tea_leaf"))); TeaAcceptorResearchNote - .set(kubaitems.registerProxyItem(new ItemProxy("tea_acceptor_research_note", "research_note"))); + .set(kubaitems.registerProxyItem(new ItemProxy("tea_acceptor_research_note", "research_note"))); Beeeeee.set(kubaitems.registerProxyItem(new ItemProxy("beeeeee", "beeeeee"))); } } diff --git a/src/main/java/kubatech/loaders/MobRecipeLoader.java b/src/main/java/kubatech/loaders/MobRecipeLoader.java index dde418aaac..8b652410d1 100644 --- a/src/main/java/kubatech/loaders/MobRecipeLoader.java +++ b/src/main/java/kubatech/loaders/MobRecipeLoader.java @@ -110,20 +110,20 @@ public class MobRecipeLoader { @SuppressWarnings("unchecked") public MobRecipe copy() { return new MobRecipe( - (ArrayList) mOutputs.clone(), - mDuration, - mMaxDamageChance, - infernalityAllowed, - alwaysinfernal, - isPeacefulAllowed, - entity, - maxEntityHealth, - isUsable); + (ArrayList) mOutputs.clone(), + mDuration, + mMaxDamageChance, + infernalityAllowed, + alwaysinfernal, + isPeacefulAllowed, + entity, + maxEntityHealth, + isUsable); } private MobRecipe(ArrayList mOutputs, int mDuration, int mMaxDamageChance, boolean infernalityAllowed, - boolean alwaysinfernal, boolean isPeacefulAllowed, EntityLiving entity, float maxEntityHealth, - boolean isUsable) { + boolean alwaysinfernal, boolean isPeacefulAllowed, EntityLiving entity, float maxEntityHealth, + boolean isUsable) { this.mOutputs = mOutputs; this.mDuration = mDuration; this.mMaxDamageChance = mMaxDamageChance; @@ -145,42 +145,47 @@ public class MobRecipeLoader { infernaldrops = new droplist(); LOG.info("Generating Infernal drops"); ArrayList> modifierLoaders = (ArrayList>) InfernalHelper - .getModifierLoaders().clone(); + .getModifierLoaders() + .clone(); int i = 0; for (ModifierLoader modifierLoader : modifierLoaders) { MobModifier nextMod = modifierLoader.make(null); - if (nextMod.getBlackListMobClasses() != null) for (Class cl : nextMod.getBlackListMobClasses()) - if (e.getClass().isAssignableFrom(cl)) break; + if (nextMod.getBlackListMobClasses() != null) + for (Class cl : nextMod.getBlackListMobClasses()) if (e.getClass() + .isAssignableFrom(cl)) break; i++; } if (i > 0) { double chance = InfernalHelper.checkEntityClassForced(e) ? 1d - : (1d / InfernalHelper.getEliteRarity()); + : (1d / InfernalHelper.getEliteRarity()); ArrayList elitelist = InfernalHelper.getDropIdListElite(); for (ItemStack stack : elitelist) { dropinstance instance = infernaldrops - .add(new dropinstance(stack.copy(), infernaldrops), chance / elitelist.size()); + .add(new dropinstance(stack.copy(), infernaldrops), chance / elitelist.size()); instance.isEnchatmentRandomized = true; // noinspection ConstantConditions - instance.enchantmentLevel = stack.getItem().getItemEnchantability(); + instance.enchantmentLevel = stack.getItem() + .getItemEnchantability(); } ArrayList ultralist = InfernalHelper.getDropIdListUltra(); chance *= 1d / InfernalHelper.getUltraRarity(); for (ItemStack stack : ultralist) { dropinstance instance = infernaldrops - .add(new dropinstance(stack.copy(), infernaldrops), chance / ultralist.size()); + .add(new dropinstance(stack.copy(), infernaldrops), chance / ultralist.size()); instance.isEnchatmentRandomized = true; // noinspection ConstantConditions - instance.enchantmentLevel = stack.getItem().getItemEnchantability(); + instance.enchantmentLevel = stack.getItem() + .getItemEnchantability(); } ArrayList infernallist = InfernalHelper.getDropIdListInfernal(); chance *= 1d / InfernalHelper.getInfernoRarity(); for (ItemStack stack : infernallist) { dropinstance instance = infernaldrops - .add(new dropinstance(stack.copy(), infernaldrops), chance / infernallist.size()); + .add(new dropinstance(stack.copy(), infernaldrops), chance / infernallist.size()); instance.isEnchatmentRandomized = true; // noinspection ConstantConditions - instance.enchantmentLevel = stack.getItem().getItemEnchantability(); + instance.enchantmentLevel = stack.getItem() + .getItemEnchantability(); } } } else if (infernaldrops == null) infernaldrops = new droplist(); @@ -206,7 +211,7 @@ public class MobRecipeLoader { } public ItemStack[] generateOutputs(Random rnd, GT_MetaTileEntity_ExtremeExterminationChamber MTE, - double attackDamage, int lootinglevel, boolean preferInfernalDrops) { + double attackDamage, int lootinglevel, boolean preferInfernalDrops) { MTE.lEUt = mEUt; MTE.mMaxProgresstime = Math.max(MOB_SPAWN_INTERVAL, (int) ((maxEntityHealth / attackDamage) * 10d)); ArrayList stacks = new ArrayList<>(mOutputs.size()); @@ -245,8 +250,10 @@ public class MobRecipeLoader { } if (infernalityAllowed && mEUt * 8 < MTE.getMaxInputVoltage() - && !InfernalHelper.getDimensionBlackList() - .contains(MTE.getBaseMetaTileEntity().getWorld().provider.dimensionId)) { + && !InfernalHelper.getDimensionBlackList() + .contains( + MTE.getBaseMetaTileEntity() + .getWorld().provider.dimensionId)) { int p = 0; int mods = 0; if (alwaysinfernal || (preferInfernalDrops && rnd.nextInt(InfernalHelper.getEliteRarity()) == 0)) { @@ -268,13 +275,18 @@ public class MobRecipeLoader { mods = InfernalHelper.getMinInfernoModifiers(); } if (infernalstacks != null) { - ItemStack infernalstack = infernalstacks.get(rnd.nextInt(infernalstacks.size())).copy(); + ItemStack infernalstack = infernalstacks.get(rnd.nextInt(infernalstacks.size())) + .copy(); // noinspection ConstantConditions - EnchantmentHelper - .addRandomEnchantment(rnd, infernalstack, infernalstack.getItem().getItemEnchantability()); + EnchantmentHelper.addRandomEnchantment( + rnd, + infernalstack, + infernalstack.getItem() + .getItemEnchantability()); stacks.add(infernalstack); MTE.lEUt *= 8L; - MTE.mMaxProgresstime *= mods * InfernalMobsCore.instance().getMobModHealthFactor(); + MTE.mMaxProgresstime *= mods * InfernalMobsCore.instance() + .getMobModHealthFactor(); } } @@ -338,7 +350,8 @@ public class MobRecipeLoader { return 0; } chance /= bound; - return nexts.get(walkCounter++).getInt(); + return nexts.get(walkCounter++) + .getInt(); } @Override @@ -354,7 +367,8 @@ public class MobRecipeLoader { return 0f; } chance /= 10; - return nexts.get(walkCounter++).getFloat(); + return nexts.get(walkCounter++) + .getFloat(); } @Override @@ -369,7 +383,8 @@ public class MobRecipeLoader { return false; } chance /= 2; - return nexts.get(walkCounter++).getBoolean(); + return nexts.get(walkCounter++) + .getBoolean(); } public void newRound() { @@ -384,7 +399,8 @@ public class MobRecipeLoader { public boolean nextRound() { walkCounter = 0; chance = 1d; - while (nexts.size() > 0 && nexts.get(nexts.size() - 1).next()) nexts.remove(nexts.size() - 1); + while (nexts.size() > 0 && nexts.get(nexts.size() - 1) + .next()) nexts.remove(nexts.size() - 1); return nexts.size() > 0; } } @@ -481,7 +497,7 @@ public class MobRecipeLoader { if (ostack == null) continue; dropinstance drop; boolean randomchomenchantdetected = ostack.hasTagCompound() - && ostack.stackTagCompound.hasKey(randomEnchantmentDetectedString); + && ostack.stackTagCompound.hasKey(randomEnchantmentDetectedString); int randomenchantmentlevel = 0; if (randomchomenchantdetected) { randomenchantmentlevel = ostack.stackTagCompound.getInteger(randomEnchantmentDetectedString); @@ -489,7 +505,7 @@ public class MobRecipeLoader { ostack.stackTagCompound.setInteger(randomEnchantmentDetectedString, 0); } if ((booksAlwaysRandomlyEnchanted || randomchomenchantdetected) - && Items.enchanted_book == ostack.getItem()) { + && Items.enchanted_book == ostack.getItem()) { NBTTagCompound tagCompound = (NBTTagCompound) ostack.stackTagCompound.copy(); tagCompound.removeTag("StoredEnchantments"); ostack = new ItemStack(Items.book, ostack.stackSize, 0); @@ -582,7 +598,7 @@ public class MobRecipeLoader { @Override public Block getBlock(int aX, int aY, int aZ) { if (LoaderReference.TwilightForest && new Throwable().getStackTrace()[1].getClassName() - .equals("twilightforest.client.renderer.entity.RenderTFSnowQueenIceShield")) + .equals("twilightforest.client.renderer.entity.RenderTFSnowQueenIceShield")) return Blocks.packed_ice; return super.getBlock(aX, aY, aZ); } @@ -601,14 +617,14 @@ public class MobRecipeLoader { else modlistversion = ModUtils.getModListVersion(); if (Config.MobHandler.regenerationTrigger != Config.MobHandler._CacheRegenerationTrigger.Always - && cache.exists()) { + && cache.exists()) { LOG.info("Parsing Cached map"); Reader reader = null; try { reader = Files.newReader(cache, StandardCharsets.UTF_8); MobRecipeLoaderCacheStructure s = gson.fromJson(reader, MobRecipeLoaderCacheStructure.class); if (Config.MobHandler.regenerationTrigger == Config.MobHandler._CacheRegenerationTrigger.Never - || s.version.equals(modlistversion)) { + || s.version.equals(modlistversion)) { ProgressBarWrapper bar = new ProgressBarWrapper("Parsing cached Mob Recipe Map", s.moblist.size()); for (Map.Entry> entry : s.moblist.entrySet()) { bar.step(entry.getKey()); @@ -616,16 +632,17 @@ public class MobRecipeLoader { EntityLiving e; String mobName = entry.getKey(); if (mobName.equals("witherSkeleton") - && !EntityList.stringToClassMapping.containsKey("witherSkeleton")) { + && !EntityList.stringToClassMapping.containsKey("witherSkeleton")) { e = new EntitySkeleton(f); ((EntitySkeleton) e).setSkeletonType(1); } else e = (EntityLiving) ((Class) EntityList.stringToClassMapping.get(mobName)) - .getConstructor(new Class[] { World.class }).newInstance(new Object[] { f }); + .getConstructor(new Class[] { World.class }) + .newInstance(new Object[] { f }); ArrayList drops = entry.getValue(); drops.forEach(MobDrop::reconstructStack); GeneralMobList.put( - mobName, - new GeneralMappedMob(e, MobRecipe.generateMobRecipe(e, mobName, drops), drops)); + mobName, + new GeneralMappedMob(e, MobRecipe.generateMobRecipe(e, mobName, drops), drops)); } catch (Exception ignored) {} } bar.end(); @@ -695,7 +712,8 @@ public class MobRecipeLoader { EntityLiving e; try { - e = (EntityLiving) v.getConstructor(new Class[] { World.class }).newInstance(new Object[] { f }); + e = (EntityLiving) v.getConstructor(new Class[] { World.class }) + .newInstance(new Object[] { f }); } catch (ClassCastException ex) { // not a EntityLiving LOG.info("Entity " + k + " is not a LivingEntity, skipping"); @@ -715,10 +733,11 @@ public class MobRecipeLoader { if (registeringWitherSkeleton && e instanceof EntitySkeleton && k.equals("witherSkeleton")) ((EntitySkeleton) e).setSkeletonType(1); - else if (StatCollector.translateToLocal("entity." + k + ".name").equals("entity." + k + ".name")) { - LOG.info("Entity " + k + " does't have localized name, skipping"); - return; - } + else if (StatCollector.translateToLocal("entity." + k + ".name") + .equals("entity." + k + ".name")) { + LOG.info("Entity " + k + " does't have localized name, skipping"); + return; + } // POWERFULL GENERATION @@ -747,7 +766,8 @@ public class MobRecipeLoader { frand.newRound(); collector.newRound(); - if (v.getName().startsWith("com.emoniph.witchery")) { + if (v.getName() + .startsWith("com.emoniph.witchery")) { try { dropFewItems.invoke(e, true, 0); } catch (Exception ex) { @@ -792,7 +812,8 @@ public class MobRecipeLoader { frand.newRound(); collector.newRound(); - if (v.getName().startsWith("com.emoniph.witchery")) { + if (v.getName() + .startsWith("com.emoniph.witchery")) { try { dropFewItems.invoke(e, true, 0); } catch (Exception ex) { @@ -911,7 +932,8 @@ public class MobRecipeLoader { } while (detectedException && !cl.equals(EntityLiving.class)); boolean usingVanillaEnchantingMethod = cl.equals(EntityLiving.class); double chanceModifierLocal = 1f; - if (v.getName().startsWith("twilightforest.entity")) { + if (v.getName() + .startsWith("twilightforest.entity")) { frand.forceFloatValue = 0f; chanceModifierLocal = 0.25f; } @@ -933,14 +955,14 @@ public class MobRecipeLoader { int randomenchant = -1; if (stack.hasTagCompound() - && stack.stackTagCompound.hasKey(randomEnchantmentDetectedString)) { + && stack.stackTagCompound.hasKey(randomEnchantmentDetectedString)) { randomenchant = stack.stackTagCompound.getInteger(randomEnchantmentDetectedString); stack.stackTagCompound.removeTag("ench"); } dropinstance i = additionaldrops.add( - new dropinstance(stack.copy(), additionaldrops), - frand.chance * chanceModifierLocal - * (usingVanillaEnchantingMethod ? (j == 0 ? 0.75d : 0.5d) : 1d)); + new dropinstance(stack.copy(), additionaldrops), + frand.chance * chanceModifierLocal + * (usingVanillaEnchantingMethod ? (j == 0 ? 0.75d : 0.5d) : 1d)); if (!i.isDamageRandomized && i.stack.isItemStackDamageable()) { i.isDamageRandomized = true; int maxdamage = i.stack.getMaxDamage(); @@ -955,8 +977,8 @@ public class MobRecipeLoader { if (!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger(randomEnchantmentDetectedString, 14); dropinstance newdrop = additionaldrops.add( - new dropinstance(stack.copy(), additionaldrops), - frand.chance * chanceModifierLocal * (j == 0 ? 0.25d : 0.5d)); + new dropinstance(stack.copy(), additionaldrops), + frand.chance * chanceModifierLocal * (j == 0 ? 0.25d : 0.5d)); newdrop.isEnchatmentRandomized = true; newdrop.enchantmentLevel = 14; newdrop.isDamageRandomized = i.isDamageRandomized; @@ -1002,14 +1024,14 @@ public class MobRecipeLoader { } dropinstance dlooting = dropslooting.get(drop); moboutputs.add( - new MobDrop( - stack, - MobDrop.DropType.Normal, - chance, - drop.isEnchatmentRandomized ? drop.enchantmentLevel : null, - drop.isDamageRandomized ? drop.damagesPossible : null, - dlooting != null && dlooting.dropcount > drop.dropcount, - false)); + new MobDrop( + stack, + MobDrop.DropType.Normal, + chance, + drop.isEnchatmentRandomized ? drop.enchantmentLevel : null, + drop.isDamageRandomized ? drop.damagesPossible : null, + dlooting != null && dlooting.dropcount > drop.dropcount, + false)); } for (dropinstance drop : raredrops.drops) { ItemStack stack = drop.stack; @@ -1025,14 +1047,14 @@ public class MobRecipeLoader { chance = 1; } moboutputs.add( - new MobDrop( - stack, - MobDrop.DropType.Rare, - chance, - drop.isEnchatmentRandomized ? drop.enchantmentLevel : null, - drop.isDamageRandomized ? drop.damagesPossible : null, - false, - false)); + new MobDrop( + stack, + MobDrop.DropType.Rare, + chance, + drop.isEnchatmentRandomized ? drop.enchantmentLevel : null, + drop.isDamageRandomized ? drop.damagesPossible : null, + false, + false)); } for (dropinstance drop : superraredrops.drops) { if (raredrops.contains(drop)) continue; @@ -1049,14 +1071,14 @@ public class MobRecipeLoader { chance = 1; } moboutputs.add( - new MobDrop( - stack, - MobDrop.DropType.Rare, - chance, - drop.isEnchatmentRandomized ? drop.enchantmentLevel : null, - drop.isDamageRandomized ? drop.damagesPossible : null, - false, - false)); + new MobDrop( + stack, + MobDrop.DropType.Rare, + chance, + drop.isEnchatmentRandomized ? drop.enchantmentLevel : null, + drop.isDamageRandomized ? drop.damagesPossible : null, + false, + false)); } for (dropinstance drop : additionaldrops.drops) { ItemStack stack = drop.stack; @@ -1072,14 +1094,14 @@ public class MobRecipeLoader { chance = 1; } moboutputs.add( - new MobDrop( - stack, - MobDrop.DropType.Additional, - chance, - drop.isEnchatmentRandomized ? drop.enchantmentLevel : null, - drop.isDamageRandomized ? drop.damagesPossible : null, - false, - false)); + new MobDrop( + stack, + MobDrop.DropType.Additional, + chance, + drop.isEnchatmentRandomized ? drop.enchantmentLevel : null, + drop.isDamageRandomized ? drop.damagesPossible : null, + false, + false)); } GeneralMobList.put(k, new GeneralMappedMob(e, MobRecipe.generateMobRecipe(e, k, moboutputs), moboutputs)); @@ -1130,7 +1152,8 @@ public class MobRecipeLoader { for (Map.Entry entry : GeneralMobList.entrySet()) { String k = entry.getKey(); GeneralMappedMob v = entry.getValue(); - if (Arrays.asList(Config.MobHandler.mobBlacklist).contains(k)) { + if (Arrays.asList(Config.MobHandler.mobBlacklist) + .contains(k)) { LOG.info("Entity " + k + " is blacklisted, skipping"); continue; } @@ -1175,7 +1198,7 @@ public class MobRecipeLoader { @SideOnly(Side.CLIENT) public static void processMobRecipeMap(HashSet mobs, - HashMap overrides) { + HashMap overrides) { if (isClientSided) Mob_Handler.clearRecipes(); MobNameToRecipeMap.clear(); mobs.forEach(k -> { @@ -1218,7 +1241,8 @@ public class MobRecipeLoader { private static void parseMTAdditions(String k, ArrayList drops, MobRecipe recipe) { IEntityDefinition ie = MineTweakerAPI.game.getEntity(k); if (ie != null) { - for (Map.Entry entry : ie.getDropsToAdd().entrySet()) { + for (Map.Entry entry : ie.getDropsToAdd() + .entrySet()) { IntRange r = entry.getValue(); // Get average chance double chance; @@ -1228,19 +1252,21 @@ public class MobRecipeLoader { double b = r.getTo(); chance = ((b * b) + b - (a * a) + a) / (2 * (b - a + 1)); } - ItemStack stack = ((ItemStack) entry.getKey().getInternal()).copy(); + ItemStack stack = ((ItemStack) entry.getKey() + .getInternal()).copy(); MobDrop drop = new MobDrop( - stack, - MobDrop.DropType.Normal, - (int) (chance * 10000), - null, - null, - false, - false); + stack, + MobDrop.DropType.Normal, + (int) (chance * 10000), + null, + null, + false, + false); drops.add(drop); recipe.mOutputs.add(drop); } - for (Map.Entry entry : ie.getDropsToAddPlayerOnly().entrySet()) { + for (Map.Entry entry : ie.getDropsToAddPlayerOnly() + .entrySet()) { IntRange r = entry.getValue(); // Get average chance double chance; @@ -1250,20 +1276,22 @@ public class MobRecipeLoader { double b = r.getTo(); chance = ((b * b) + b - (a * a) + a) / (2 * (b - a + 1)); } - ItemStack stack = ((ItemStack) entry.getKey().getInternal()).copy(); + ItemStack stack = ((ItemStack) entry.getKey() + .getInternal()).copy(); MobDrop drop = new MobDrop( - stack, - MobDrop.DropType.Normal, - (int) (chance * 10000), - null, - null, - false, - true); + stack, + MobDrop.DropType.Normal, + (int) (chance * 10000), + null, + null, + false, + true); drops.add(drop); } for (IItemStack istack : ie.getDropsToRemove()) { - List toRemove = drops.stream().filter(d -> istack.matches(new MCItemStack(d.stack))) - .collect(Collectors.toList()); + List toRemove = drops.stream() + .filter(d -> istack.matches(new MCItemStack(d.stack))) + .collect(Collectors.toList()); drops.removeAll(toRemove); recipe.mOutputs.removeAll(toRemove); } diff --git a/src/main/java/kubatech/loaders/RecipeLoader.java b/src/main/java/kubatech/loaders/RecipeLoader.java index 53ae79de1e..29f22782f0 100644 --- a/src/main/java/kubatech/loaders/RecipeLoader.java +++ b/src/main/java/kubatech/loaders/RecipeLoader.java @@ -45,79 +45,76 @@ public class RecipeLoader { private static final Logger LOG = LogManager.getLogger(Tags.MODID + "[Recipe Loader]"); protected static final long bitsd = GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED - | GT_ModHandler.RecipeBits.DISMANTLEABLE; + | GT_ModHandler.RecipeBits.BUFFERED + | GT_ModHandler.RecipeBits.DISMANTLEABLE; private static int MTEID = 14201; private static final int MTEIDMax = 14300; public static void addRecipes() { if (registerMTE( - ExtremeExterminationChamber, - GT_MetaTileEntity_ExtremeExterminationChamber.class, - "multimachine.exterminationchamber", - "Extreme Extermination Chamber", - LoaderReference.EnderIO)) { + ExtremeExterminationChamber, + GT_MetaTileEntity_ExtremeExterminationChamber.class, + "multimachine.exterminationchamber", + "Extreme Extermination Chamber", + LoaderReference.EnderIO)) { GT_ModHandler.addCraftingRecipe( - ItemList.ExtremeExterminationChamber.get(1), - bitsd, - new Object[] { "RCR", "CHC", "VVV", 'R', gregtech.api.enums.ItemList.Robot_Arm_EV, 'C', - OrePrefixes.circuit.get(Materials.Data), 'H', gregtech.api.enums.ItemList.Hull_EV, 'V', - GT_ModHandler.getModItem("OpenBlocks", "vacuumhopper", 1, new ItemStack(Blocks.hopper)) }); + ItemList.ExtremeExterminationChamber.get(1), + bitsd, + new Object[] { "RCR", "CHC", "VVV", 'R', gregtech.api.enums.ItemList.Robot_Arm_EV, 'C', + OrePrefixes.circuit.get(Materials.Data), 'H', gregtech.api.enums.ItemList.Hull_EV, 'V', + GT_ModHandler.getModItem("OpenBlocks", "vacuumhopper", 1, new ItemStack(Blocks.hopper)) }); } if (registerMTE( - ExtremeIndustrialApiary, - GT_MetaTileEntity_MegaIndustrialApiary.class, - "multimachine.extremeapiary", - "Industrial Apicultural Acclimatiser and Drone Domestication Station", - LoaderReference.Forestry)) { + ExtremeIndustrialApiary, + GT_MetaTileEntity_MegaIndustrialApiary.class, + "multimachine.extremeapiary", + "Industrial Apicultural Acclimatiser and Drone Domestication Station", + LoaderReference.Forestry)) { GT_Values.RA.addAssemblylineRecipe( - gregtech.api.enums.ItemList.Machine_IndustrialApiary.get(1), - 10000, - new Object[] { gregtech.api.enums.ItemList.Machine_IndustrialApiary.get(64L), - gregtech.api.enums.ItemList.IndustrialApiary_Upgrade_Acceleration_8_Upgraded.get(64L), - gregtech.api.enums.ItemList.IndustrialApiary_Upgrade_STABILIZER.get(64L), - gregtech.api.enums.ItemList.Robot_Arm_UV.get(16L), - new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, - new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, - new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, - new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, }, - new FluidStack[] { FluidRegistry.getFluidStack("molten.indalloy140", 28800), - FluidRegistry.getFluidStack("for.honey", 20000) }, - ExtremeIndustrialApiary.get(1), - 6000, - 2_048_000); + gregtech.api.enums.ItemList.Machine_IndustrialApiary.get(1), + 10000, + new Object[] { gregtech.api.enums.ItemList.Machine_IndustrialApiary.get(64L), + gregtech.api.enums.ItemList.IndustrialApiary_Upgrade_Acceleration_8_Upgraded.get(64L), + gregtech.api.enums.ItemList.IndustrialApiary_Upgrade_STABILIZER.get(64L), + gregtech.api.enums.ItemList.Robot_Arm_UV.get(16L), + new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, + new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, + new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, + new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, }, + new FluidStack[] { FluidRegistry.getFluidStack("molten.indalloy140", 28800), + FluidRegistry.getFluidStack("for.honey", 20000) }, + ExtremeIndustrialApiary.get(1), + 6000, + 2_048_000); } if (registerMTEUsingID( - 12_792, - ExtremeIndustrialGreenhouse, - GT_MetaTileEntity_ExtremeIndustrialGreenhouse.class, - "multimachine.extremegreenhouse", - "Extreme Industrial Greenhouse", - true /* IC2 is always loaded */)) { + 12_792, + ExtremeIndustrialGreenhouse, + GT_MetaTileEntity_ExtremeIndustrialGreenhouse.class, + "multimachine.extremegreenhouse", + "Extreme Industrial Greenhouse", + true /* IC2 is always loaded */)) { GT_ModHandler.addCraftingRecipe( - ExtremeIndustrialGreenhouse.get(1), - bitsd, - new Object[] { "AZA", "BRB", "AZA", 'B', gregtech.api.enums.ItemList.Casing_CleanStainlessSteel, - 'R', - GT_ModHandler - .getModItem("EnderIO", "blockFarmStation", 1, new ItemStack(Items.diamond_hoe)), - 'A', - LoaderReference.GTNHCoreMod ? CustomItemList.AcceleratorIV.get(1) - : gregtech.api.enums.ItemList.Robot_Arm_IV, - 'Z', OrePrefixes.circuit.get(Materials.Ultimate) }); + ExtremeIndustrialGreenhouse.get(1), + bitsd, + new Object[] { "AZA", "BRB", "AZA", 'B', gregtech.api.enums.ItemList.Casing_CleanStainlessSteel, 'R', + GT_ModHandler.getModItem("EnderIO", "blockFarmStation", 1, new ItemStack(Items.diamond_hoe)), 'A', + LoaderReference.GTNHCoreMod ? CustomItemList.AcceleratorIV.get(1) + : gregtech.api.enums.ItemList.Robot_Arm_IV, + 'Z', OrePrefixes.circuit.get(Materials.Ultimate) }); } RegisterTeaLine(); if (MTEID > MTEIDMax + 1) throw new RuntimeException("MTE ID's"); } private static boolean registerMTE(ItemList item, Class mte, String aName, - String aNameRegional) { + String aNameRegional) { return registerMTE(item, mte, aName, aNameRegional, true); } private static boolean registerMTE(ItemList item, Class mte, String aName, - String aNameRegional, boolean... deps) { + String aNameRegional, boolean... deps) { boolean dep = true; for (boolean i : deps) if (!i) { dep = false; @@ -127,7 +124,7 @@ public class RecipeLoader { } private static boolean registerMTE(ItemList item, Class mte, String aName, - String aNameRegional, boolean dep) { + String aNameRegional, boolean dep) { if (MTEID > MTEIDMax) throw new RuntimeException("MTE ID's"); registerMTEUsingID(MTEID, item, mte, aName, aNameRegional, dep); MTEID++; @@ -135,12 +132,13 @@ public class RecipeLoader { } private static boolean registerMTEUsingID(int ID, ItemList item, Class mte, String aName, - String aNameRegional, boolean dep) { + String aNameRegional, boolean dep) { if (dep) { try { item.set( - mte.getConstructor(int.class, String.class, String.class).newInstance(ID, aName, aNameRegional) - .getStackForm(1)); + mte.getConstructor(int.class, String.class, String.class) + .newInstance(ID, aName, aNameRegional) + .getStackForm(1)); } catch (InvocationTargetException ex) { Throwable original_ex = ex.getCause(); if (original_ex instanceof RuntimeException) throw (RuntimeException) original_ex; @@ -169,146 +167,145 @@ public class RecipeLoader { // TEA LINE // if (LoaderReference.GTPlusPlus && LoaderReference.HarvestCraft) { CORE.RA.addDehydratorRecipe( - new ItemStack[] { GameRegistry.findItemStack("harvestcraft", "tealeafItem", 1) }, - null, - null, - new ItemStack[] { TeaLeafDehydrated.get(1) }, - null, - 100, - 32); + new ItemStack[] { GameRegistry.findItemStack("harvestcraft", "tealeafItem", 1) }, + null, + null, + new ItemStack[] { TeaLeafDehydrated.get(1) }, + null, + 100, + 32); CORE.RA.addDehydratorRecipe( - new ItemStack[] { TeaLeafDehydrated.get(1) }, - null, - null, - new ItemStack[] { WhiteTeaLeaf.get(1) }, - null, - 100, - 32); + new ItemStack[] { TeaLeafDehydrated.get(1) }, + null, + null, + new ItemStack[] { WhiteTeaLeaf.get(1) }, + null, + 100, + 32); GT_Values.RA.addMixerRecipe( - new ItemStack[] { TeaLeafDehydrated.get(1) }, - new FluidStack[] { FluidRegistry.getFluidStack("water", 50) }, - new ItemStack[] { SteamedTeaLeaf.get(1) }, - null, - 100, - 32); + new ItemStack[] { TeaLeafDehydrated.get(1) }, + new FluidStack[] { FluidRegistry.getFluidStack("water", 50) }, + new ItemStack[] { SteamedTeaLeaf.get(1) }, + null, + 100, + 32); CORE.RA.addDehydratorRecipe( - new ItemStack[] { SteamedTeaLeaf.get(1) }, - null, - null, - new ItemStack[] { YellowTeaLeaf.get(1) }, - null, - 100, - 32); + new ItemStack[] { SteamedTeaLeaf.get(1) }, + null, + null, + new ItemStack[] { YellowTeaLeaf.get(1) }, + null, + 100, + 32); GT_Values.RA.addBenderRecipe(TeaLeafDehydrated.get(1), RolledTeaLeaf.get(1), 100, 32); CORE.RA.addDehydratorRecipe( - new ItemStack[] { RolledTeaLeaf.get(1) }, - null, - null, - new ItemStack[] { GreenTeaLeaf.get(1) }, - null, - 100, - 32); + new ItemStack[] { RolledTeaLeaf.get(1) }, + null, + null, + new ItemStack[] { GreenTeaLeaf.get(1) }, + null, + 100, + 32); GT_Values.RA.addChemicalRecipe( - RolledTeaLeaf.get(1), - GT_Utility.getIntegratedCircuit(1), - OxidizedTeaLeaf.get(1), - 100, - 32); + RolledTeaLeaf.get(1), + GT_Utility.getIntegratedCircuit(1), + OxidizedTeaLeaf.get(1), + 100, + 32); CORE.RA.addDehydratorRecipe( - new ItemStack[] { OxidizedTeaLeaf.get(1) }, - null, - null, - new ItemStack[] { BlackTeaLeaf.get(1) }, - null, - 100, - 32); + new ItemStack[] { OxidizedTeaLeaf.get(1) }, + null, + null, + new ItemStack[] { BlackTeaLeaf.get(1) }, + null, + 100, + 32); GT_Values.RA.addChemicalRecipe( - RolledTeaLeaf.get(1), - GT_Utility.getIntegratedCircuit(2), - FermentedTeaLeaf.get(1), - 200, - 32); + RolledTeaLeaf.get(1), + GT_Utility.getIntegratedCircuit(2), + FermentedTeaLeaf.get(1), + 200, + 32); CORE.RA.addDehydratorRecipe( - new ItemStack[] { FermentedTeaLeaf.get(1) }, - null, - null, - new ItemStack[] { PuerhTeaLeaf.get(1) }, - null, - 100, - 32); + new ItemStack[] { FermentedTeaLeaf.get(1) }, + null, + null, + new ItemStack[] { PuerhTeaLeaf.get(1) }, + null, + 100, + 32); GT_Values.RA.addCutterRecipe( - new ItemStack[] { TeaLeafDehydrated.get(1) }, - new ItemStack[] { BruisedTeaLeaf.get(1) }, - 100, - 32, - false); + new ItemStack[] { TeaLeafDehydrated.get(1) }, + new ItemStack[] { BruisedTeaLeaf.get(1) }, + 100, + 32, + false); GT_Values.RA.addChemicalRecipe( - BruisedTeaLeaf.get(1), - GT_Utility.getIntegratedCircuit(1), - PartiallyOxidizedTeaLeaf.get(1), - 50, - 32); + BruisedTeaLeaf.get(1), + GT_Utility.getIntegratedCircuit(1), + PartiallyOxidizedTeaLeaf.get(1), + 50, + 32); CORE.RA.addDehydratorRecipe( - new ItemStack[] { PartiallyOxidizedTeaLeaf.get(1) }, - null, - null, - new ItemStack[] { OolongTeaLeaf.get(1) }, - null, - 100, - 32); + new ItemStack[] { PartiallyOxidizedTeaLeaf.get(1) }, + null, + null, + new ItemStack[] { OolongTeaLeaf.get(1) }, + null, + 100, + 32); // Tea Assembly GameRegistry.addSmelting(BlackTeaLeaf.get(1), BlackTea.get(1), 10); GT_Values.RA.addMixerRecipe( - new ItemStack[] { BlackTea.get(1), GameRegistry.findItemStack("harvestcraft", "limejuiceItem", 1) }, - null, - new ItemStack[] { EarlGrayTea.get(1) }, - null, - 100, - 32); + new ItemStack[] { BlackTea.get(1), GameRegistry.findItemStack("harvestcraft", "limejuiceItem", 1) }, + null, + new ItemStack[] { EarlGrayTea.get(1) }, + null, + 100, + 32); GameRegistry.addSmelting(GreenTeaLeaf.get(1), GreenTea.get(1), 10); GT_Values.RA.addMixerRecipe( - new ItemStack[] { BlackTea.get(1) }, - new FluidStack[] { FluidRegistry.getFluidStack("potion.lemonjuice", 1000) }, - new ItemStack[] { LemonTea.get(1) }, - null, - 100, - 32); + new ItemStack[] { BlackTea.get(1) }, + new FluidStack[] { FluidRegistry.getFluidStack("potion.lemonjuice", 1000) }, + new ItemStack[] { LemonTea.get(1) }, + null, + 100, + 32); GT_Values.RA.addMixerRecipe( - new ItemStack[] { BlackTea.get(1) }, - new FluidStack[] { FluidRegistry.getFluidStack("milk", 1000) }, - new ItemStack[] { MilkTea.get(1) }, - null, - 100, - 32); + new ItemStack[] { BlackTea.get(1) }, + new FluidStack[] { FluidRegistry.getFluidStack("milk", 1000) }, + new ItemStack[] { MilkTea.get(1) }, + null, + 100, + 32); GameRegistry.addSmelting(OolongTeaLeaf.get(1), OolongTea.get(1), 10); GT_Values.RA.addMixerRecipe( - new ItemStack[] { GameRegistry.findItemStack("harvestcraft", "peppermintItem", 1) }, - new FluidStack[] { FluidRegistry.getFluidStack("water", 1000) }, - new ItemStack[] { PeppermintTea.get(1) }, - null, - 100, - 32); + new ItemStack[] { GameRegistry.findItemStack("harvestcraft", "peppermintItem", 1) }, + new FluidStack[] { FluidRegistry.getFluidStack("water", 1000) }, + new ItemStack[] { PeppermintTea.get(1) }, + null, + 100, + 32); GameRegistry.addSmelting(PuerhTeaLeaf.get(1), PuerhTea.get(1), 10); GameRegistry.addSmelting(WhiteTeaLeaf.get(1), WhiteTea.get(1), 10); GameRegistry.addSmelting(YellowTeaLeaf.get(1), YellowTea.get(1), 10); } if (LoaderReference.Avaritia && LoaderReference.GTNHCoreMod) { GT_Values.RA.addAssemblylineRecipe( - TeaAcceptorResearchNote.get(1), - 10000, - new Object[] { LegendaryUltimateTea.get(0), - GameRegistry.findItemStack("Avaritia", "Neutronium_Compressor", 1), - gregtech.api.enums.ItemList.Quantum_Tank_EV.get(1), - CustomItemList.FluidExtractorUHV.get(10), - new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, - new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, - new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, - new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, }, - new FluidStack[] { FluidRegistry.getFluidStack("molten.indalloy140", 28800) }, - TeaAcceptor.get(1), - 6000, - 2_048_000); + TeaAcceptorResearchNote.get(1), + 10000, + new Object[] { LegendaryUltimateTea.get(0), + GameRegistry.findItemStack("Avaritia", "Neutronium_Compressor", 1), + gregtech.api.enums.ItemList.Quantum_Tank_EV.get(1), CustomItemList.FluidExtractorUHV.get(10), + new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, + new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, + new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, + new Object[] { OrePrefixes.circuit.get(Materials.SuperconductorUHV), 4L }, }, + new FluidStack[] { FluidRegistry.getFluidStack("molten.indalloy140", 28800) }, + TeaAcceptor.get(1), + 6000, + 2_048_000); } } } diff --git a/src/main/java/kubatech/loaders/TCLoader.java b/src/main/java/kubatech/loaders/TCLoader.java index 37aed521cc..d2146fad92 100644 --- a/src/main/java/kubatech/loaders/TCLoader.java +++ b/src/main/java/kubatech/loaders/TCLoader.java @@ -42,9 +42,9 @@ public class TCLoader { public static void init() { ResearchCategories.registerCategory( - TCCategoryKey, - new ResourceLocation(Tags.MODID, "textures/gui/green_tea.png"), - new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png")); + TCCategoryKey, + new ResourceLocation(Tags.MODID, "textures/gui/green_tea.png"), + new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png")); if (!LoaderReference.GTNHCoreMod || !LoaderReference.DraconicEvolution) return; registerRecipe(); registerResearch(); @@ -55,48 +55,50 @@ public class TCLoader { private static void registerRecipe() { if (ultimateTeaRecipe != null) return; final ItemStack[] components = new ItemStack[] { - // ItemList.LegendaryBlackTea.get(1), - // ItemList.LegendaryButterflyTea.get(1), - ItemList.LegendaryEarlGrayTea.get(1), // MApiary - ItemList.LegendaryGreenTea.get(1), // EIG - // ItemList.LegendaryLemonTea.get(1), - // ItemList.LegendaryMilkTea.get(1), - // ItemList.LegendaryOolongTea.get(1), - ItemList.LegendaryPeppermintTea.get(1), // HTGR - ItemList.LegendaryPuerhTea.get(1), // EEC - // ItemList.LegendaryRedTea.get(1), - // ItemList.LegendaryWhiteTea.get(1), - ItemList.LegendaryYellowTea.get(1), // IApiary - ItemList.BlackTea.get(1), ItemList.EarlGrayTea.get(1), ItemList.GreenTea.get(1), - ItemList.LemonTea.get(1), ItemList.MilkTea.get(1), ItemList.OolongTea.get(1), - ItemList.PeppermintTea.get(1), ItemList.PuerhTea.get(1), ItemList.WhiteTea.get(1), - ItemList.YellowTea.get(1) }; + // ItemList.LegendaryBlackTea.get(1), + // ItemList.LegendaryButterflyTea.get(1), + ItemList.LegendaryEarlGrayTea.get(1), // MApiary + ItemList.LegendaryGreenTea.get(1), // EIG + // ItemList.LegendaryLemonTea.get(1), + // ItemList.LegendaryMilkTea.get(1), + // ItemList.LegendaryOolongTea.get(1), + ItemList.LegendaryPeppermintTea.get(1), // HTGR + ItemList.LegendaryPuerhTea.get(1), // EEC + // ItemList.LegendaryRedTea.get(1), + // ItemList.LegendaryWhiteTea.get(1), + ItemList.LegendaryYellowTea.get(1), // IApiary + ItemList.BlackTea.get(1), ItemList.EarlGrayTea.get(1), ItemList.GreenTea.get(1), ItemList.LemonTea.get(1), + ItemList.MilkTea.get(1), ItemList.OolongTea.get(1), ItemList.PeppermintTea.get(1), ItemList.PuerhTea.get(1), + ItemList.WhiteTea.get(1), ItemList.YellowTea.get(1) }; final HashSet componentsHashed = Arrays.stream(components) - .map(stack -> ItemID.create_NoCopy(stack, true, false, true)) - .collect(Collectors.toCollection(HashSet::new)); + .map(stack -> ItemID.create_NoCopy(stack, true, false, true)) + .collect(Collectors.toCollection(HashSet::new)); // noinspection unchecked - ThaumcraftApi.getCraftingRecipes().add( + ThaumcraftApi.getCraftingRecipes() + .add( ultimateTeaRecipe = new InfusionRecipe( - "KT_UltimateTea", - ItemList.LegendaryUltimateTea.get(1), - 10, - new AspectList().add(Aspect.MAGIC, 100).add(Aspect.HEAL, 100).add(Aspect.PLANT, 100) - .add(Aspect.EXCHANGE, 100), - GameRegistry.findItemStack("DraconicEvolution", "dezilsMarshmallow", 1), - components) { + "KT_UltimateTea", + ItemList.LegendaryUltimateTea.get(1), + 10, + new AspectList().add(Aspect.MAGIC, 100) + .add(Aspect.HEAL, 100) + .add(Aspect.PLANT, 100) + .add(Aspect.EXCHANGE, 100), + GameRegistry.findItemStack("DraconicEvolution", "dezilsMarshmallow", 1), + components) { @Override public boolean matches(ArrayList input, ItemStack central, World world, - EntityPlayer player) { + EntityPlayer player) { if (!central.isItemEqual(getRecipeInput())) return false; if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), this.research)) return false; if (componentsHashed.size() > input.size()) return false; HashSet hashedInputs = input.stream() - .map(stack -> ItemID.create_NoCopy(stack, true, false, true)) - .collect(Collectors.toCollection(HashSet::new)); + .map(stack -> ItemID.create_NoCopy(stack, true, false, true)) + .collect(Collectors.toCollection(HashSet::new)); return hashedInputs.containsAll(componentsHashed); } }); @@ -107,14 +109,16 @@ public class TCLoader { private static void registerResearch() { if (ultimateTeaResearch == null) { ultimateTeaResearch = new ResearchItem( - "KT_UltimateTea", - TCCategoryKey, - new AspectList().add(Aspect.MAGIC, 1).add(Aspect.HEAL, 1).add(Aspect.PLANT, 1) - .add(Aspect.EXCHANGE, 1), - -2, - 4, - 2, - ItemList.LegendaryUltimateTea.get(1)) { + "KT_UltimateTea", + TCCategoryKey, + new AspectList().add(Aspect.MAGIC, 1) + .add(Aspect.HEAL, 1) + .add(Aspect.PLANT, 1) + .add(Aspect.EXCHANGE, 1), + -2, + 4, + 2, + ItemList.LegendaryUltimateTea.get(1)) { @Override public String getName() { diff --git a/src/main/java/kubatech/loaders/block/BlockProxy.java b/src/main/java/kubatech/loaders/block/BlockProxy.java index a546aa80d8..af5c6fcfb2 100644 --- a/src/main/java/kubatech/loaders/block/BlockProxy.java +++ b/src/main/java/kubatech/loaders/block/BlockProxy.java @@ -54,8 +54,8 @@ public class BlockProxy { TileEntity te = world.getTileEntity(x, y, z); if (te instanceof ITileWithModularUI) { if (world.isRemote) return true; - if (te instanceof KubaBlock.IModularUIProvider) - ((KubaBlock.IModularUIProvider) te).getUI().open(player, world, x, y, z); + if (te instanceof KubaBlock.IModularUIProvider) ((KubaBlock.IModularUIProvider) te).getUI() + .open(player, world, x, y, z); else defaultTileEntityUI.open(player, world, x, y, z); return true; } @@ -81,7 +81,8 @@ public class BlockProxy { } public String getDisplayName(ItemStack stack) { - return StatCollector.translateToLocal(this.unlocalizedName + ".name").trim(); + return StatCollector.translateToLocal(this.unlocalizedName + ".name") + .trim(); } public void addInformation(ItemStack stack, EntityPlayer entity, List tooltipList, boolean showDebugInfo) {} diff --git a/src/main/java/kubatech/loaders/block/KubaBlock.java b/src/main/java/kubatech/loaders/block/KubaBlock.java index 52b378dbf5..27f479f03a 100644 --- a/src/main/java/kubatech/loaders/block/KubaBlock.java +++ b/src/main/java/kubatech/loaders/block/KubaBlock.java @@ -44,26 +44,29 @@ import com.gtnewhorizons.modularui.common.internal.wrapper.ModularUIContainer; public class KubaBlock extends Block { public static final Function> TileEntityUIFactory = containerConstructor -> UIBuilder - .of().container((player, world, x, y, z) -> { - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof ITileWithModularUI) { - final UIBuildContext buildContext = new UIBuildContext(player); - final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); - return containerConstructor - .createUIContainer(new ModularUIContext(buildContext, te::markDirty), window); - } - return null; - }).gui(((player, world, x, y, z) -> { - if (!world.isRemote) return null; - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof ITileWithModularUI) { - final UIBuildContext buildContext = new UIBuildContext(player); - final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); - return new ModularGui( - containerConstructor.createUIContainer(new ModularUIContext(buildContext, null), window)); - } - return null; - })).build(); + .of() + .container((player, world, x, y, z) -> { + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + final UIBuildContext buildContext = new UIBuildContext(player); + final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); + return containerConstructor + .createUIContainer(new ModularUIContext(buildContext, te::markDirty), window); + } + return null; + }) + .gui(((player, world, x, y, z) -> { + if (!world.isRemote) return null; + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + final UIBuildContext buildContext = new UIBuildContext(player); + final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); + return new ModularGui( + containerConstructor.createUIContainer(new ModularUIContext(buildContext, null), window)); + } + return null; + })) + .build(); public static final UIInfo defaultTileEntityUI = TileEntityUIFactory.apply(ModularUIContainer::new); @@ -113,12 +116,14 @@ public class KubaBlock extends Block { @Override public void registerBlockIcons(IIconRegister p_149651_1_) { - blocks.values().forEach(b -> b.registerIcon(p_149651_1_)); + blocks.values() + .forEach(b -> b.registerIcon(p_149651_1_)); } @Override public IIcon getIcon(int p_149691_1_, int p_149691_2_) { - return blocks.get(p_149691_2_).getIcon(p_149691_1_); + return blocks.get(p_149691_2_) + .getIcon(p_149691_1_); } @Override @@ -134,16 +139,16 @@ public class KubaBlock extends Block { @Override public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, - EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { return getBlock(p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_)) - .onActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_); + .onActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_); } @Override public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, - EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { + EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { getBlock(p_149689_6_.getItemDamage()) - .onBlockPlaced(p_149689_1_, p_149689_2_, p_149689_3_, p_149689_4_, p_149689_5_, p_149689_6_); + .onBlockPlaced(p_149689_1_, p_149689_2_, p_149689_3_, p_149689_4_, p_149689_5_, p_149689_6_); } @Override @@ -165,7 +170,7 @@ public class KubaBlock extends Block { @Override public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, - double explosionY, double explosionZ) { + double explosionY, double explosionZ) { return getBlock(world.getBlockMetadata(x, y, z)).getResistance(); } diff --git a/src/main/java/kubatech/loaders/block/KubaItemBlock.java b/src/main/java/kubatech/loaders/block/KubaItemBlock.java index bdd0c6eecd..7509eb005d 100644 --- a/src/main/java/kubatech/loaders/block/KubaItemBlock.java +++ b/src/main/java/kubatech/loaders/block/KubaItemBlock.java @@ -28,7 +28,7 @@ public class KubaItemBlock extends ItemBlock { @Override public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, - float hitX, float hitY, float hitZ, int metadata) { + float hitX, float hitY, float hitZ, int metadata) { return super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata); } @@ -39,18 +39,21 @@ public class KubaItemBlock extends ItemBlock { @Override public String getUnlocalizedName(ItemStack p_77667_1_) { - return KubaBlock.blocks.get(p_77667_1_.getItemDamage()).getUnlocalizedName(); + return KubaBlock.blocks.get(p_77667_1_.getItemDamage()) + .getUnlocalizedName(); } @Override public String getItemStackDisplayName(ItemStack p_77653_1_) { - return KubaBlock.blocks.get(p_77653_1_.getItemDamage()).getDisplayName(p_77653_1_); + return KubaBlock.blocks.get(p_77653_1_.getItemDamage()) + .getDisplayName(p_77653_1_); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p