diff options
author | kuba6000 <kuba.123123.6000@gmail.com> | 2023-04-10 21:03:52 +0200 |
---|---|---|
committer | kuba6000 <kuba.123123.6000@gmail.com> | 2023-04-10 21:03:52 +0200 |
commit | 74a9bcc5a0b7e179a71932e7dba88794deeb4c99 (patch) | |
tree | a80901824606cae422be00d026605da912054c06 /src | |
parent | 0ecb697d75b25206daf921ecec1c910d6ab77491 (diff) | |
download | GT5-Unofficial-74a9bcc5a0b7e179a71932e7dba88794deeb4c99.tar.gz GT5-Unofficial-74a9bcc5a0b7e179a71932e7dba88794deeb4c99.tar.bz2 GT5-Unofficial-74a9bcc5a0b7e179a71932e7dba88794deeb4c99.zip |
Update spotless formatting
Diffstat (limited to 'src')
49 files changed, 2040 insertions, 1751 deletions
diff --git a/src/main/java/kubatech/CommonProxy.java b/src/main/java/kubatech/CommonProxy.java index 37bd924579..5533cf0beb 100644 --- a/src/main/java/kubatech/CommonProxy.java +++ b/src/main/java/kubatech/CommonProxy.java @@ -33,7 +33,9 @@ public class CommonProxy { Config.init(event.getModConfigurationDirectory()); Config.synchronizeConfiguration(); - FMLCommonHandler.instance().bus().register(new FMLEventHandler()); + FMLCommonHandler.instance() + .bus() + .register(new FMLEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerDataManager()); registerItems(); registerBlocks(); diff --git a/src/main/java/kubatech/api/ConstructableItemStack.java b/src/main/java/kubatech/api/ConstructableItemStack.java index 0d80076760..27dc2c6133 100644 --- a/src/main/java/kubatech/api/ConstructableItemStack.java +++ b/src/main/java/kubatech/api/ConstructableItemStack.java @@ -30,7 +30,7 @@ public class ConstructableItemStack { public final NBTTagCompound tagCompound; private ConstructableItemStack(GameRegistry.UniqueIdentifier itemIdentifier, int meta, int size, - NBTTagCompound tagCompound) { + NBTTagCompound tagCompound) { this.itemIdentifier = itemIdentifier; this.meta = meta; this.size = size; @@ -104,9 +104,9 @@ public class ConstructableItemStack { } catch (Exception ignored) {} } return new ConstructableItemStack( - new GameRegistry.UniqueIdentifier(modid + ":" + name), - meta, - stacksize, - nbtTagCompound); + new GameRegistry.UniqueIdentifier(modid + ":" + name), + meta, + stacksize, + nbtTagCompound); } } diff --git a/src/main/java/kubatech/api/Variables.java b/src/main/java/kubatech/api/Variables.java index 74312d6fb7..b52a228543 100644 --- a/src/main/java/kubatech/api/Variables.java +++ b/src/main/java/kubatech/api/Variables.java @@ -20,27 +20,30 @@ import net.minecraft.util.EnumChatFormatting; public class Variables { public static final String Author = "Author: " - + StringUtils.applyRainbow("kuba6000", 0, EnumChatFormatting.BOLD.toString()); + + StringUtils.applyRainbow("kuba6000", 0, EnumChatFormatting.BOLD.toString()); public static String buildAuthorList(String... authors) { if (authors.length == 0) return "Author: Unknown"; StringBuilder b = new StringBuilder("Author: ") - .append(StringUtils.applyRainbow(authors[0], 0, EnumChatFormatting.BOLD.toString())); + .append(StringUtils.applyRainbow(authors[0], 0, EnumChatFormatting.BOLD.toString())); for (int i = 1; i < authors.length; i++) { String author = authors[i]; - b.append(EnumChatFormatting.RESET).append(" & ").append(EnumChatFormatting.GOLD).append(author); + b.append(EnumChatFormatting.RESET) + .append(" & ") + .append(EnumChatFormatting.GOLD) + .append(author); } return b.toString(); } public static final String StructureHologram = "To see the structure, use a " + EnumChatFormatting.BLUE - + "Structure" - + EnumChatFormatting.DARK_BLUE - + "Lib" - + EnumChatFormatting.RESET - + "" - + EnumChatFormatting.GRAY - + " Hologram Projector on the Controller!"; + + "Structure" + + EnumChatFormatting.DARK_BLUE + + "Lib" + + EnumChatFormatting.RESET + + "" + + EnumChatFormatting.GRAY + + " Hologram Projector on the Controller!"; public static final double ln4 = Math.log(4d); public static final double ln2 = Math.log(2d); diff --git a/src/main/java/kubatech/api/enums/ItemList.java b/src/main/java/kubatech/api/enums/ItemList.java index 9176c6b207..41a57f988f 100644 --- a/src/main/java/kubatech/api/enums/ItemList.java +++ b/src/main/java/kubatech/api/enums/ItemList.java @@ -152,8 +152,12 @@ public enum ItemList implements IItemContainer { StringBuilder tCamelCasedDisplayNameBuilder = new StringBuilder(); final String[] tDisplayNameWords = aDisplayName.split("\\W"); for (String tWord : tDisplayNameWords) { - if (tWord.length() > 0) tCamelCasedDisplayNameBuilder.append(tWord.substring(0, 1).toUpperCase(Locale.US)); - if (tWord.length() > 1) tCamelCasedDisplayNameBuilder.append(tWord.substring(1).toLowerCase(Locale.US)); + if (tWord.length() > 0) tCamelCasedDisplayNameBuilder.append( + tWord.substring(0, 1) + .toUpperCase(Locale.US)); + if (tWord.length() > 1) tCamelCasedDisplayNameBuilder.append( + tWord.substring(1) + .toLowerCase(Locale.US)); } if (tCamelCasedDisplayNameBuilder.length() == 0) { // CamelCased DisplayName is empty, so use hash of aDisplayName diff --git a/src/main/java/kubatech/api/helpers/InfernalHelper.java b/src/main/java/kubatech/api/helpers/InfernalHelper.java index a2842d66a7..a842255807 100644 --- a/src/main/java/kubatech/api/helpers/InfernalHelper.java +++ b/src/main/java/kubatech/api/helpers/InfernalHelper.java @@ -44,7 +44,7 @@ public class InfernalHelper { try { if (checkEntityClassForced == null) { checkEntityClassForced = InfernalMobsCore.class - .getDeclaredMethod("checkEntityClassForced", EntityLivingBase.class); + .getDeclaredMethod("checkEntityClassForced", EntityLivingBase.class); checkEntityClassForced.setAccessible(true); } return (boolean) checkEntityClassForced.invoke(InfernalMobsCore.instance(), e); diff --git a/src/main/java/kubatech/api/helpers/ProgressBarWrapper.java b/src/main/java/kubatech/api/helpers/ProgressBarWrapper.java index f1243c4d46..676ddba91e 100644 --- a/src/main/java/kubatech/api/helpers/ProgressBarWrapper.java +++ b/src/main/java/kubatech/api/helpers/ProgressBarWrapper.java @@ -37,14 +37,14 @@ public class ProgressBarWrapper { else { steps++; try { - ProgressDisplayer.displayProgress( - Tags.MODNAME + ": " + name + " -> " + message, - (float) steps / (float) maxSteps); + ProgressDisplayer + .displayProgress(Tags.MODNAME + ": " + name + " -> " + message, (float) steps / (float) maxSteps); } catch (IOException e) { throw new RuntimeException(e); } // Prevent game freeze - FMLCommonHandler.instance().processWindowMessages(); + FMLCommonHandler.instance() + .processWindowMessages(); } } diff --git a/src/main/java/kubatech/api/helpers/ReflectionHelper.java b/src/main/java/kubatech/api/helpers/ReflectionHelper.java index 19b8ecd026..69c54f29b6 100644 --- a/src/main/java/kubatech/api/helpers/ReflectionHelper.java +++ b/src/main/java/kubatech/api/helpers/ReflectionHelper.java @@ -100,7 +100,8 @@ public class ReflectionHelper { Class<?>[] argsTypes = new Class<?>[args.length]; for (int i = 0; i < args.length; i++) { Class<?> arg = args[i].getClass(); - builder.append(";").append(arg.getSimpleName()); + builder.append(";") + .append(arg.getSimpleName()); argsTypes[i] = arg; } String methodNameUnique = builder.toString(); diff --git a/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java b/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java index 43ce98009d..befa20f2ff 100644 --- a/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java +++ b/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java @@ -30,37 +30,40 @@ import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T>> - extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T> { + extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T> { @Deprecated public final int mEUt = 0; @SuppressWarnings("unchecked") protected static <K extends KubaTechGTMultiBlockBase<?>> UIInfo<?, ?> createKTMetaTileEntityUI( - KTContainerConstructor<K> containerConstructor) { - return UIBuilder.of().container((player, world, x, y, z) -> { - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof BaseMetaTileEntity) { - IMetaTileEntity mte = ((BaseMetaTileEntity) te).getMetaTileEntity(); - if (!(mte instanceof KubaTechGTMultiBlockBase)) return null; - final UIBuildContext buildContext = new UIBuildContext(player); - final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); - return containerConstructor.of(new ModularUIContext(buildContext, te::markDirty), window, (K) mte); - } - return null; - }).gui(((player, world, x, y, z) -> { - if (!world.isRemote) return null; - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof BaseMetaTileEntity) { - IMetaTileEntity mte = ((BaseMetaTileEntity) te).getMetaTileEntity(); - if (!(mte instanceof KubaTechGTMultiBlockBase)) return null; - final UIBuildContext buildContext = new UIBuildContext(player); - final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); - return new ModularGui( + KTContainerConstructor<K> containerConstructor) { + return UIBuilder.of() + .container((player, world, x, y, z) -> { + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof BaseMetaTileEntity) { + IMetaTileEntity mte = ((BaseMetaTileEntity) te).getMetaTileEntity(); + if (!(mte instanceof KubaTechGTMultiBlockBase)) return null; + final UIBuildContext buildContext = new UIBuildContext(player); + final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); + return containerConstructor.of(new ModularUIContext(buildContext, te::markDirty), window, (K) mte); + } + return null; + }) + .gui(((player, world, x, y, z) -> { + if (!world.isRemote) return null; + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof BaseMetaTileEntity) { + IMetaTileEntity mte = ((BaseMetaTileEntity) te).getMetaTileEntity(); + if (!(mte instanceof KubaTechGTMultiBlockBase)) return null; + final UIBuildContext buildContext = new UIBuildContext(player); + final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); + return new ModularGui( containerConstructor.of(new ModularUIContext(buildContext, null), window, (K) mte)); - } - return null; - })).build(); + } + return null; + })) + .build(); } @FunctionalInterface @@ -96,7 +99,7 @@ public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_Exten @Override protected void calculateOverclockedNessMultiInternal(long aEUt, int aDuration, int mAmperage, long maxInputVoltage, - boolean perfectOC) { + boolean perfectOC) { calculateOverclock(aEUt, aDuration, getMaxInputEu(), perfectOC); } @@ -116,7 +119,7 @@ public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_Exten return 0; } int durationTiers = (int) Math - .ceil(Math.log((double) aDuration / (double) minDuration) / (isPerfect ? ln4 : ln2)); + .ceil(Math.log((double) aDuration / (double) minDuration) / (isPerfect ? ln4 : ln2)); if (durationTiers < 0) durationTiers = 0; // We do not support downclocks (yet) if (durationTiers > tiers) durationTiers = tiers; if (!isOverclockingInfinite()) { diff --git a/src/main/java/kubatech/api/mobhandler/MobDrop.java b/src/main/java/kubatech/api/mobhandler/MobDrop.java index 554e36bd6a..3c0bd636df 100644 --- a/src/main/java/kubatech/api/mobhandler/MobDrop.java +++ b/src/main/java/kubatech/api/mobhandler/MobDrop.java @@ -50,7 +50,7 @@ public class MobDrop { private MobDrop() {} public MobDrop(ItemStack stack, DropType type, int chance, Integer enchantable, HashMap<Integer, Integer> damages, - boolean lootable, boolean playerOnly) { + boolean lootable, boolean playerOnly) { this.stack = stack; this.reconstructableStack = new ConstructableItemStack(stack); this.type = type; diff --git a/src/main/java/kubatech/api/network/LoadConfigPacket.java b/src/main/java/kubatech/api/network/LoadConfigPacket.java index 04a8f68770..ba3bb3732b 100644 --- a/src/main/java/kubatech/api/network/LoadConfigPacket.java +++ b/src/main/java/kubatech/api/network/LoadConfigPacket.java @@ -45,9 +45,8 @@ public class LoadConfigPacket implements IMessage { for (int i = 0; i < overridessize; i++) { byte[] sbytes = new byte[buf.readInt()]; buf.readBytes(sbytes); - mobsOverrides.put( - new String(sbytes, StandardCharsets.UTF_8), - OverridesConfig.MobOverride.readFromByteBuf(buf)); + mobsOverrides + .put(new String(sbytes, StandardCharsets.UTF_8), OverridesConfig.MobOverride.readFromByteBuf(buf)); } } } diff --git a/src/main/java/kubatech/api/tea/TeaNetwork.java b/src/main/java/kubatech/api/tea/TeaNetwork.java index 298982ce9d..286dde6b33 100644 --- a/src/main/java/kubatech/api/tea/TeaNetwork.java +++ b/src/main/java/kubatech/api/tea/TeaNetwork.java @@ -63,7 +63,8 @@ public class TeaNetwork { } public boolean canAdd(BigInteger toAdd) { - return teaAmount.add(toAdd).compareTo(teaLimit) <= 0; + return teaAmount.add(toAdd) + .compareTo(teaLimit) <= 0; } public void registerTeaStorageExtender(TeaStorageTile storageTile) { diff --git a/src/main/java/kubatech/api/utils/GSONUtils.java b/src/main/java/kubatech/api/utils/GSONUtils.java index 99580ad803..636dc7d6ce 100644 --- a/src/main/java/kubatech/api/utils/GSONUtils.java +++ b/src/main/java/kubatech/api/utils/GSONUtils.java @@ -57,7 +57,8 @@ public class GSONUtils { try { if (!(json instanceof JsonArray)) return null; byte[] bytes = new byte[((JsonArray) json).size()]; - for (int i = 0; i < bytes.length; i++) bytes[i] = ((JsonArray) json).get(i).getAsByte(); + for (int i = 0; i < bytes.length; i++) bytes[i] = ((JsonArray) json).get(i) + .getAsByte(); return CompressedStreamTools.func_152457_a(bytes, new NBTSizeTracker(2097152L)); } catch (IOException e) { throw new RuntimeException(e); @@ -65,11 +66,15 @@ public class GSONUtils { }; public static final GsonBuilder GSON_BUILDER = new GsonBuilder().addSerializationExclusionStrategy(GSONStrategy) - .addDeserializationExclusionStrategy(GSONStrategy) - .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundDeserializer) - .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundSerializer).serializeNulls(); + .addDeserializationExclusionStrategy(GSONStrategy) + .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundDeserializer) + .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundSerializer) + .serializeNulls(); public static final GsonBuilder GSON_BUILDER_PRETTY = new GsonBuilder() - .addSerializationExclusionStrategy(GSONStrategy).addDeserializationExclusionStrategy(GSONStrategy) - .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundDeserializer) - .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundSerializer).serializeNulls().setPrettyPrinting(); + .addSerializationExclusionStrategy(GSONStrategy) + .addDeserializationExclusionStrategy(GSONStrategy) + .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundDeserializer) + .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundSerializer) + .serializeNulls() + .setPrettyPrinting(); } diff --git a/src/main/java/kubatech/api/utils/MobUtils.java b/src/main/java/kubatech/api/utils/MobUtils.java index 0a6881edeb..4090813248 100644 --- a/src/main/java/kubatech/api/utils/MobUtils.java +++ b/src/main/java/kubatech/api/utils/MobUtils.java @@ -42,7 +42,7 @@ public class MobUtils { try { if (mainmodelfield == null) { mainmodelfield = RendererLivingEntity.class - .getDeclaredField(ModUtils.isDeobfuscatedEnvironment ? "mainModel" : "field_77045_g"); + .getDeclaredField(ModUtils.isDeobfuscatedEnvironment ? "mainModel" : "field_77045_g"); mainmodelfield.setAccessible(true); } float eheight = e.height; diff --git a/src/main/java/kubatech/api/utils/ModUtils.java b/src/main/java/kubatech/api/utils/ModUtils.java index 394a59ca10..90c0a7e81b 100644 --- a/src/main/java/kubatech/api/utils/ModUtils.java +++ b/src/main/java/kubatech/api/utils/ModUtils.java @@ -26,7 +26,7 @@ import cpw.mods.fml.common.ModContainer; public class ModUtils { public static final boolean isDeobfuscatedEnvironment = (boolean) Launch.blackboard - .get("fml.deobfuscatedEnvironment"); + .get("fml.deobfuscatedEnvironment"); public static boolean isClientSided = false; private static final HashMap<String, String> classNamesToModIDs = new HashMap<>(); private static final Map.Entry<String, String> emptyEntry = new AbstractMap.SimpleEntry<>("", ""); @@ -34,20 +34,27 @@ public class ModUtils { public static String getModNameFromClassName(String classname) { if (classNamesToModIDs.size() == 0) { classNamesToModIDs.put("net.minecraft", "Minecraft"); - Loader.instance().getActiveModList().forEach(m -> { - Object Mod = m.getMod(); - if (Mod != null) { - Package modPackage = Mod.getClass().getPackage(); - if (modPackage == null) { // HOW CAN THIS EVEN HAPPEN ?! - kubatech.warn("Mod " + m.getModId() + " package is not loaded yet!"); - return; + Loader.instance() + .getActiveModList() + .forEach(m -> { + Object Mod = m.getMod(); + if (Mod != null) { + Package modPackage = Mod.getClass() + .getPackage(); + if (modPackage == null) { // HOW CAN THIS EVEN HAPPEN ?! + kubatech.warn("Mod " + m.getModId() + " package is not loaded yet!"); + return; + } + classNamesToModIDs.put(modPackage.getName(), m.getName()); } - classNamesToModIDs.put(modPackage.getName(), m.getName()); - } - }); + }); } - return classNamesToModIDs.entrySet().stream().filter(e -> classname.startsWith(e.getKey())).findAny() - .orElse(emptyEntry).getValue(); + return classNamesToModIDs.entrySet() + .stream() + .filter(e -> classname.startsWith(e.getKey())) + .findAny() + .orElse(emptyEntry) + .getValue(); } private static String modListVersion = null; @@ -56,18 +63,21 @@ public class ModUtils { if (modListVersion != null) return modListVersion; @SuppressWarnings("unchecked") ArrayList<ModContainer> modlist = (ArrayList<ModContainer>) ((ArrayList<ModContainer>) Loader.instance() - .getActiveModList()).clone(); - String sortedList = modlist.stream().filter(m -> m.getMod() != null) - .sorted(Comparator.comparing(ModContainer::getModId)) - .collect( - StringBuilder::new, - (a, b) -> a.append(b.getModId()).append(b.getVersion()), - (a, b) -> a.append(", ").append(b)) - .toString(); + .getActiveModList()).clone(); + String sortedList = modlist.stream() + .filter(m -> m.getMod() != null) + .sorted(Comparator.comparing(ModContainer::getModId)) + .collect( + StringBuilder::new, + (a, b) -> a.append(b.getModId()) + .append(b.getVersion()), + (a, b) -> a.append(", ") + .append(b)) + .toString(); try { MessageDigest md = MessageDigest.getInstance("MD5"); modListVersion = DatatypeConverter.printHexBinary(md.digest(sortedList.getBytes(StandardCharsets.UTF_8))) - .toUpperCase(); + .toUpperCase(); return modListVersion; } catch (Exception e) { modListVersion = sortedList; @@ -81,15 +91,21 @@ public class ModUtils { if (modListVersionIgnoringModVersions != null) return modListVersionIgnoringModVersions; @SuppressWarnings("unchecked") ArrayList<ModContainer> modlist = (ArrayList<ModContainer>) ((ArrayList<ModContainer>) Loader.instance() - .getActiveModList()).clone(); - String sortedList = modlist.stream().filter(m -> m.getMod() != null) - .sorted(Comparator.comparing(ModContainer::getModId)) - .collect(StringBuilder::new, (a, b) -> a.append(b.getModId()), (a, b) -> a.append(", ").append(b)) - .toString(); + .getActiveModList()).clone(); + String sortedList = modlist.stream() + .filter(m -> m.getMod() != null) + .sorted(Comparator.comparing(ModContainer::getModId)) + .collect( + StringBuilder::new, + (a, b) -> a.append(b.getModId()), + (a, b) -> a.append(", ") + .append(b)) + .toString(); try { MessageDigest md = MessageDigest.getInstance("MD5"); modListVersionIgnoringModVersions = DatatypeConverter - .printHexBinary(md.digest(sortedList.getBytes(StandardCharsets.UTF_8))).toUpperCase(); + .printHexBinary(md.digest(sortedList.getBytes(StandardCharsets.UTF_8))) + .toUpperCase(); return modListVersionIgnoringModVersions; } catch (Exception e) { modListVersionIgnoringModVersions = sortedList; diff --git a/src/main/java/kubatech/api/utils/StringUtils.java b/src/main/java/kubatech/api/utils/StringUtils.java index 066fa69d4f..72e4540ad1 100644 --- a/src/main/java/kubatech/api/utils/StringUtils.java +++ b/src/main/java/kubatech/api/utils/StringUtils.java @@ -15,19 +15,20 @@ import net.minecraft.util.EnumChatFormatting; public class StringUtils { private static final String[] rainbow = new String[] { EnumChatFormatting.DARK_RED.toString(), - EnumChatFormatting.RED.toString(), EnumChatFormatting.GOLD.toString(), EnumChatFormatting.YELLOW.toString(), - EnumChatFormatting.DARK_GREEN.toString(), EnumChatFormatting.GREEN.toString(), - EnumChatFormatting.AQUA.toString(), EnumChatFormatting.DARK_AQUA.toString(), - EnumChatFormatting.DARK_BLUE.toString(), EnumChatFormatting.BLUE.toString(), - EnumChatFormatting.LIGHT_PURPLE.toString(), EnumChatFormatting.DARK_PURPLE.toString(), - EnumChatFormatting.WHITE.toString(), EnumChatFormatting.GRAY.toString(), - EnumChatFormatting.DARK_GRAY.toString(), EnumChatFormatting.BLACK.toString(), }; + EnumChatFormatting.RED.toString(), EnumChatFormatting.GOLD.toString(), EnumChatFormatting.YELLOW.toString(), + EnumChatFormatting.DARK_GREEN.toString(), EnumChatFormatting.GREEN.toString(), + EnumChatFormatting.AQUA.toString(), EnumChatFormatting.DARK_AQUA.toString(), + EnumChatFormatting.DARK_BLUE.toString(), EnumChatFormatting.BLUE.toString(), + EnumChatFormatting.LIGHT_PURPLE.toString(), EnumChatFormatting.DARK_PURPLE.toString(), + EnumChatFormatting.WHITE.toString(), EnumChatFormatting.GRAY.toString(), + EnumChatFormatting.DARK_GRAY.toString(), EnumChatFormatting.BLACK.toString(), }; public static String applyRainbow(String str, int offset, String additional) { StringBuilder final_string = new StringBuilder(); int i = offset; - for (char c : str.toCharArray()) - final_string.append(rainbow[i++ % rainbow.length]).append(additional).append(c); + for (char c : str.toCharArray()) final_string.append(rainbow[i++ % rainbow.length]) + .append(additional) + .append(c); return final_string.toString(); } diff --git a/src/main/java/kubatech/client/effect/CropRenderer.java b/src/main/java/kubatech/client/effect/CropRenderer.java index c57f8a8590..6434d02f5e 100644 --- a/src/main/java/kubatech/client/effect/CropRenderer.java +++ b/src/main/java/kubatech/client/effect/CropRenderer.java @@ -44,20 +44,19 @@ public class CropRenderer extends EntityFX { @Override public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, - float p_70539_5_, float p_70539_6_, float p_70539_7_) { + float p_70539_5_, float p_70539_6_, float p_70539_7_) { Tessellator tessellator = Tessellator.instance; - Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + Minecraft.getMinecraft() + .getTextureManager() + .bindTexture(TextureMap.locationBlocksTexture); tessellator.startDrawingQuads(); tessellator.disableColor(); GL11.glColor4f(1.f, 1.f, 1.f, 1.f); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDepthMask(true); tessellator.setBrightness( - Blocks.wheat.getMixedBrightnessForBlock( - this.worldObj, - (int) this.posX + 1, - (int) this.posY, - (int) this.posZ)); + Blocks.wheat + .getMixedBrightnessForBlock(this.worldObj, (int) this.posX + 1, (int) this.posY, (int) this.posZ)); tessellator.setColorRGBA(255, 255, 255, 255); double f12 = this.posY - interpPosY; int i = 0; @@ -65,7 +64,8 @@ public class CropRenderer extends EntityFX { if (x == 0 && z == 0) continue; double f11 = (this.posX + (double) x) - interpPosX; double f13 = (this.posZ + (double) z) - interpPosZ; - RenderBlocks.getInstance().renderBlockCropsImpl(Blocks.wheat, meta[i++], f11, f12, f13); + RenderBlocks.getInstance() + .renderBlockCropsImpl(Blocks.wheat, meta[i++], f11, f12, f13); } tessellator.draw(); } diff --git a/src/main/java/kubatech/client/effect/EntityRenderer.java b/src/main/java/kubatech/client/effect/EntityRenderer.java index c357d61000..85a6625816 100644 --- a/src/main/java/kubatech/client/effect/EntityRenderer.java +++ b/src/main/java/kubatech/client/effect/EntityRenderer.java @@ -85,7 +85,7 @@ public class EntityRenderer extends EntityFX { @Override public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, - float p_70539_5_, float p_70539_6_, float p_70539_7_) { + float p_70539_5_, float p_70539_6_, float p_70539_7_) { if (entityToRender == null) return; GL11.glEnable(GL11.GL_LIGHTING); @@ -128,7 +128,7 @@ public class EntityRenderer extends EntityFX { float p_147936_2_ = 0.5f; float f1 = entityToRender.prevRotationYaw - + (entityToRender.rotationYaw - entityToRender.prevRotationYaw) * p_147936_2_; + + (entityToRender.rotationYaw - entityToRender.prevRotationYaw) * p_147936_2_; int i = entityToRender.getBrightnessForRender(p_147936_2_); if (entityToRender.isBurning()) { @@ -147,9 +147,9 @@ public class EntityRenderer extends EntityFX { int stackdepth = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH); GL11.glPushMatrix(); GL11.glTranslatef( - (float) (this.posX - renderPosX), - (float) (this.posY - renderPosY), - (float) (this.posZ - renderPosZ)); + (float) (this.posX - renderPosX), + (float) (this.posY - renderPosY), + (float) (this.posZ - renderPosZ)); GL11.glEnable(GL12.GL_RESCALE_NORMAL); float desiredScale = MobUtils.getDesiredScale(entityToRender, 2f); if (desiredScale < 1f) GL11.glScalef(desiredScale, desiredScale, desiredScale); @@ -182,7 +182,7 @@ public class EntityRenderer extends EntityFX { int err; while ((err = GL11.glGetError()) != GL11.GL_NO_ERROR) if (Config.Debug.showRenderErrors) LOG.error( - EntityList.getEntityString(entityToRender) + " | GL ERROR: " + err + " / " + GLU.gluErrorString(err)); + EntityList.getEntityString(entityToRender) + " | GL ERROR: " + err + " / " + GLU.gluErrorString(err)); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_COLOR_MATERIAL); diff --git a/src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java b/src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java index 6758cf73df..7ea38af856 100644 --- a/src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java +++ b/src/main/java/kubatech/client/effect/MegaApiaryBeesRenderer.java @@ -52,7 +52,7 @@ public class MegaApiaryBeesRenderer extends EntityFX { @Override public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, - float p_70539_5_, float p_70539_6_, float p_70539_7_) { + float p_70539_5_, float p_70539_6_, float p_70539_7_) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); @@ -60,13 +60,15 @@ public class MegaApiaryBeesRenderer extends EntityFX { GL11.glPushMatrix(); GL11.glTranslatef( - (float) (this.posX - renderPosX), - (float) (this.posY - renderPosY), - (float) (this.posZ - renderPosZ)); + (float) (this.posX - renderPosX), + (float) (this.posY - renderPosY), + (float) (this.posZ - renderPosZ)); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glRotatef(180f, 1f, 0f, 0f); - Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationItemsTexture); + Minecraft.getMinecraft() + .getTextureManager() + .bindTexture(TextureMap.locationItemsTexture); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_ALPHA_TEST); @@ -74,33 +76,38 @@ public class MegaApiaryBeesRenderer extends EntityFX { GL11.glColor4f(1f, 1f, 1f, 1F); - IIcon icon = ItemList.Beeeeee.get(1).getIconIndex(); + IIcon icon = ItemList.Beeeeee.get(1) + .getIconIndex(); GL11.glPushMatrix(); GL11.glTranslatef(0f, 0f, -4f); GL11.glScalef(0.1f, 0.1f, 0.1f); - RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); + RenderItem.getInstance() + .renderIcon(0, 0, icon, 16, 16); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslatef(1f, 0f, 3f); GL11.glRotatef(180f, 0f, 1f, 0f); GL11.glScalef(0.1f, 0.1f, 0.1f); - RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); + RenderItem.getInstance() + .renderIcon(0, 0, icon, 16, 16); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslatef(4f, 0f, -1f); GL11.glRotatef(-90f, 0f, 1f, 0f); GL11.glScalef(0.1f, 0.1f, 0.1f); - RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); + RenderItem.getInstance() + .renderIcon(0, 0, icon, 16, 16); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslatef(-3f, 0f, 1f); GL11.glRotatef(90f, 0f, 1f, 0f); GL11.glScalef(0.1f, 0.1f, 0.1f); - RenderItem.getInstance().renderIcon(0, 0, icon, 16, 16); + RenderItem.getInstance() + .renderIcon(0, 0, icon, 16, 16); GL11.glPopMatrix(); GL11.glPopMatrix(); diff --git a/src/main/java/kubatech/commands/CommandBees.java b/src/main/java/kubatech/commands/CommandBees.java index 660203c0ec..3cb4962ecf 100644 --- a/src/main/java/kubatech/commands/CommandBees.java +++ b/src/main/java/kubatech/commands/CommandBees.java @@ -52,9 +52,10 @@ public class CommandBees extends CommandBase { @Override public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) { - if (!Minecraft.getMinecraft().isSingleplayer()) { - p_71515_1_.addChatMessage( - new ChatComponentText(EnumChatFormatting.RED + "This command is single-player only!")); + if (!Minecraft.getMinecraft() + .isSingleplayer()) { + p_71515_1_ + .addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This command is single-player only!")); return; } @@ -65,7 +66,7 @@ public class CommandBees extends CommandBase { String delimer = ","; writer.write( - "Bee,CHANCE,OLD_0.6S_0UP,OLD_0.6S_8UP,OLD_1.7S_0UP,OLD_1.7S_8UP,NEW_0.6S_0UP_1T,NEW_0.6S_8UP_1T,NEW_1.7S_0UP_1T,NEW_1.7S_8UP_1T,NEW_1.7S_0UP_8T,NEW_1.7S_8UP_8T\n"); + "Bee,CHANCE,OLD_0.6S_0UP,OLD_0.6S_8UP,OLD_1.7S_0UP,OLD_1.7S_8UP,NEW_0.6S_0UP_1T,NEW_0.6S_8UP_1T,NEW_1.7S_0UP_1T,NEW_1.7S_8UP_1T,NEW_1.7S_0UP_8T,NEW_1.7S_8UP_8T\n"); List<IBee> bees = beeRoot.getIndividualTemplates(); for (IBee bee : bees) { @@ -75,9 +76,12 @@ public class CommandBees extends CommandBase { IBeeGenome genome = bee.getGenome(); IAlleleBeeSpecies primary = genome.getPrimary(); IAlleleBeeSpecies secondary = genome.getSecondary(); - primary.getProductChances().forEach((k, v) -> printData("[PRIMARY]", k, v, delimer, b)); - secondary.getProductChances().forEach((k, v) -> printData("[SECONDARY]", k, v / 2f, delimer, b)); - primary.getSpecialtyChances().forEach((k, v) -> printData("[SPECIALITY]", k, v, delimer, b)); + primary.getProductChances() + .forEach((k, v) -> printData("[PRIMARY]", k, v, delimer, b)); + secondary.getProductChances() + .forEach((k, v) -> printData("[SECONDARY]", k, v / 2f, delimer, b)); + primary.getSpecialtyChances() + .forEach((k, v) -> printData("[SPECIALITY]", k, v, delimer, b)); writer.write(b.toString()); } @@ -125,8 +129,8 @@ public class CommandBees extends CommandBase { chance *= 100f; float productionModifier = (float) upgradeCount * 0.25f; return (float) (((1f + t / 6f) * Math.sqrt(chance) * 2f * (1f + beeSpeed) - + Math.pow(productionModifier, Math.cbrt(chance)) - - 3f) / 100f); + + Math.pow(productionModifier, Math.cbrt(chance)) + - 3f) / 100f); } private double productChanceOld(int upgradeCount, double beeSpeed, double chance) { diff --git a/src/main/java/kubatech/commands/CommandConfig.java b/src/main/java/kubatech/commands/CommandConfig.java index b2d9fb09e7..6a15c23379 100644 --- a/src/main/java/kubatech/commands/CommandConfig.java +++ b/src/main/java/kubatech/commands/CommandConfig.java @@ -35,7 +35,8 @@ public class CommandConfig extends CommandBase { final String key; Translations() { - key = "command.config." + this.name().toLowerCase(); + key = "command.config." + this.name() + .toLowerCase(); } public String get() { @@ -80,11 +81,12 @@ public class CommandConfig extends CommandBase { } Config.synchronizeConfiguration(); MobRecipeLoader.processMobRecipeMap(); - MinecraftServer.getServer().getConfigurationManager().playerEntityList.forEach(p -> { - if (!(p instanceof EntityPlayerMP)) return; - kubatech.info("Sending config to " + ((EntityPlayerMP) p).getDisplayName()); - kubatech.NETWORK.sendTo(LoadConfigPacket.instance, (EntityPlayerMP) p); - }); + MinecraftServer.getServer() + .getConfigurationManager().playerEntityList.forEach(p -> { + if (!(p instanceof EntityPlayerMP)) return; + kubatech.info("Sending config to " + ((EntityPlayerMP) p).getDisplayName()); + kubatech.NETWORK.sendTo(LoadConfigPacket.instance, (EntityPlayerMP) p); + }); p_71515_1_.addChatMessage(new ChatComponentText(SUCCESS.get())); } } diff --git a/src/main/java/kubatech/commands/CommandHandler.java b/src/main/java/kubatech/commands/CommandHandler.java index 4694b9ca2f..0da2969abe 100644 --- a/src/main/java/kubatech/commands/CommandHandler.java +++ b/src/main/java/kubatech/commands/CommandHandler.java @@ -34,7 +34,8 @@ public class CommandHandler extends CommandBase { final String key; Translations() { - key = "commandhandler." + this.name().toLowerCase(); + key = "commandhandler." + this.name() + .toLowerCase(); } public String get() { @@ -90,12 +91,13 @@ public class CommandHandler extends CommandBase { ICommand cmd = commands.get(p_71515_2_[0]); if (!cmd.canCommandSenderUseCommand(p_71515_1_)) { ChatComponentTranslation chatcomponenttranslation2 = new ChatComponentTranslation( - "commands.generic.permission"); - chatcomponenttranslation2.getChatStyle().setColor(EnumChatFormatting.RED); + "commands.generic.permission"); + chatcomponenttranslation2.getChatStyle() + .setColor(EnumChatFormatting.RED); p_71515_1_.addChatMessage(chatcomponenttranslation2); } else cmd.processCommand( - p_71515_1_, - p_71515_2_.length > 1 ? Arrays.copyOfRange(p_71515_2_, 1, p_71515_2_.length) : new String[0]); + p_71515_1_, + p_71515_2_.length > 1 ? Arrays.copyOfRange(p_71515_2_, 1, p_71515_2_.length) : new String[0]); } @Override diff --git a/src/main/java/kubatech/commands/CommandHelp.java b/src/main/java/kubatech/commands/CommandHelp.java index 822c56dd5a..c258c31edf 100644 --- a/src/main/java/kubatech/commands/CommandHelp.java +++ b/src/main/java/kubatech/commands/CommandHelp.java @@ -28,7 +28,8 @@ public class CommandHelp extends CommandBase { final String key; Translations() { - key = "command.help." + this.name().toLowerCase(); + key = "command.help." + this.name() + .toLowerCase(); } public String get() { @@ -67,7 +68,8 @@ public class CommandHelp extends CommandBase { @Override public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) { p_71515_1_.addChatMessage(new ChatComponentText(POSSIBLE_COMMANDS.get())); - CommandHandler.commands.values().forEach( + CommandHandler.commands.values() + .forEach( c -> p_71515_1_.addChatMessage(new ChatComponentText("/kubatech " + c.getCommandUsage(p_71515_1_)))); } } diff --git a/src/main/java/kubatech/commands/CommandTea.java b/src/main/java/kubatech/commands/CommandTea.java index 4fff7f0a40..c8541294c1 100644 --- a/src/main/java/kubatech/commands/CommandTea.java +++ b/src/main/java/kubatech/commands/CommandTea.java @@ -37,7 +37,8 @@ public class CommandTea extends CommandBase { final String key; Translations() { - key = "command.tea." + this.name().toLowerCase(); + key = "command.tea." + this.name() + .toLowerCase(); } public String get() { diff --git a/src/main/java/kubatech/config/Config.java b/src/main/java/kubatech/config/Config.java index 7b2520bccc..cbb95085dd 100644 --- a/src/main/java/kubatech/config/Config.java +++ b/src/main/java/kubatech/config/Config.java @@ -62,41 +62,45 @@ public class Config { private static void load(Configuration configuration) { Category category = Category.MOB_HANDLER; - mobHandlerEnabled = configuration.get( - category.get(), - "Enabled", - true, - "Enable \"Mob Drops\" NEI page and Extreme Extermination Chamber").getBoolean(); + mobHandlerEnabled = configuration + .get(category.get(), "Enabled", true, "Enable \"Mob Drops\" NEI page and Extreme Extermination Chamber") + .getBoolean(); StringBuilder c = new StringBuilder("When will cache regeneration trigger? "); - for (_CacheRegenerationTrigger value : _CacheRegenerationTrigger.values()) - c.append(value.ordinal()).append(" - ").append(value.name()).append(", "); + for (_CacheRegenerationTrigger value : _CacheRegenerationTrigger.values()) c.append(value.ordinal()) + .append(" - ") + .append(value.name()) + .append(", "); regenerationTrigger = _CacheRegenerationTrigger.get( - configuration.get( - category.get(), - "CacheRegenerationTrigger", - _CacheRegenerationTrigger.ModAdditionRemovalChange.ordinal(), - c.toString()).getInt()); + configuration + .get( + category.get(), + "CacheRegenerationTrigger", + _CacheRegenerationTrigger.ModAdditionRemovalChange.ordinal(), + c.toString()) + .getInt()); includeEmptyMobs = configuration - .get(category.get(), "IncludeEmptyMobs", true, "Include mobs that have no drops in NEI") - .getBoolean(); - mobBlacklist = configuration.get( + .get(category.get(), "IncludeEmptyMobs", true, "Include mobs that have no drops in NEI") + .getBoolean(); + mobBlacklist = configuration + .get( category.get(), "MobBlacklist", new String[] { "Giant", "Thaumcraft.TravelingTrunk", "chisel.snowman", "OpenBlocks.Luggage", - "OpenBlocks.MiniMe", "SpecialMobs.SpecialCreeper", "SpecialMobs.SpecialZombie", - "SpecialMobs.SpecialPigZombie", "SpecialMobs.SpecialSlime", "SpecialMobs.SpecialSkeleton", - "SpecialMobs.SpecialEnderman", "SpecialMobs.SpecialCaveSpider", "SpecialMobs.SpecialGhast", - "SpecialMobs.SpecialWitch", "SpecialMobs.SpecialSpider", "TwilightForest.HydraHead", - "TwilightForest.RovingCube", "TwilightForest.Harbinger Cube", "TwilightForest.Adherent", - "SpecialMobs.SpecialSilverfish", }, - "These mobs will be skipped when generating recipe map").getStringList(); + "OpenBlocks.MiniMe", "SpecialMobs.SpecialCreeper", "SpecialMobs.SpecialZombie", + "SpecialMobs.SpecialPigZombie", "SpecialMobs.SpecialSlime", "SpecialMobs.SpecialSkeleton", + "SpecialMobs.SpecialEnderman", "SpecialMobs.SpecialCaveSpider", "SpecialMobs.SpecialGhast", + "SpecialMobs.SpecialWitch", "SpecialMobs.SpecialSpider", "TwilightForest.HydraHead", + "TwilightForest.RovingCube", "TwilightForest.Harbinger Cube", "TwilightForest.Adherent", + "SpecialMobs.SpecialSilverfish", }, + "These mobs will be skipped when generating recipe map") + .getStringList(); playerOnlyDropsModifier = configuration - .get( - category.get(), - "PlayerOnlyDropsModifier", - .1d, - "Hard player only loot (such as core mod drops) will be multiplied by this number") - .getDouble(); + .get( + category.get(), + "PlayerOnlyDropsModifier", + .1d, + "Hard player only loot (such as core mod drops) will be multiplied by this number") + .getDouble(); } } @@ -106,7 +110,8 @@ public class Config { private static void load(Configuration configuration) { Category category = Category.DEBUG; - showRenderErrors = configuration.get(category.get(), "ShowRenderErrors", false).getBoolean(); + showRenderErrors = configuration.get(category.get(), "ShowRenderErrors", false) + .getBoolean(); } } diff --git a/src/main/java/kubatech/config/OverridesConfig.java b/src/main/java/kubatech/config/OverridesConfig.java index 3c7e93c92f..9c0a455e93 100644 --- a/src/main/java/kubatech/config/OverridesConfig.java +++ b/src/main/java/kubatech/config/OverridesConfig.java @@ -139,15 +139,16 @@ public class OverridesConfig { reader = Files.newReader(overrideFile, StandardCharsets.UTF_8); overrides = gson.fromJson(reader, new TypeToken<Map<String, MobOverride>>() {}.getType()); overrides.remove("ExampleMob"); - overrides.values().forEach(o -> o.additions.forEach(MobDrop::reconstructStack)); + overrides.values() + .forEach(o -> o.additions.forEach(MobDrop::reconstructStack)); if (LoaderReference.GTNHCoreMod) { LOG.info("Detected GTNH Core Mod, parsing custom drops from there."); CustomDrops coredrops = ReflectionHelper - .getField(MainRegistry.Module_CustomDrops, "_mCustomDrops", null); + .getField(MainRegistry.Module_CustomDrops, "_mCustomDrops", null); if (coredrops != null) { @SuppressWarnings("unchecked") ArrayList<CustomDrops.CustomDrop> customdrops = (ArrayList<CustomDrops.CustomDrop>) ((ArrayList<CustomDrops.CustomDrop>) coredrops - .getCustomDrops()).clone(); + .getCustomDrops()).clone(); for (CustomDrops.CustomDrop customdrop : customdrops) { try { Class<?> eclass = Class.forName(customdrop.getEntityName()); @@ -156,7 +157,8 @@ public class OverridesConfig { if (ename == null) continue; MobOverride override = overrides.computeIfAbsent(ename, k -> new MobOverride()); for (CustomDrops.CustomDrop.Drop drop : customdrop.getDrops()) { - String[] parts = drop.getItemName().split(":"); + String[] parts = drop.getItemName() + .split(":"); ItemStack stack = GameRegistry.findItemStack(parts[0], parts[1], 1); if (stack == null) continue; if (parts.length > 2) stack.setItemDamage(Integer.parseInt(parts[2])); @@ -181,8 +183,8 @@ public class OverridesConfig { } stack.stackSize = amount; // Drops from coremod are player only - override.additions.add( - new MobDrop(stack, MobDrop.DropType.Normal, chance, null, null, false, true)); + override.additions + .add(new MobDrop(stack, MobDrop.DropType.Normal, chance, null, null, false, true)); } } catch (Exception e) { e.printStackTrace(); @@ -213,14 +215,14 @@ public class OverridesConfig { exdamages.put(2, 5); exdamages.put(3, 10); ex1.additions.add( - new MobDrop( - new ItemStack(Items.diamond_sword), - MobDrop.DropType.Rare, - 500, - 20, - exdamages, - true, - false)); + new MobDrop( + new ItemStack(Items.diamond_sword), + MobDrop.DropType.Rare, + 500, + 20, + exdamages, + true, + false)); example.put("ExampleMob", ex1); gson.toJson(example, writer); writer.flush(); diff --git a/src/main/java/kubatech/kubatech.java b/src/main/java/kubatech/kubatech.java index 2ec2da2e7b..c375cecc5a 100644 --- a/src/main/java/kubatech/kubatech.java +++ b/src/main/java/kubatech/kubatech.java @@ -33,24 +33,24 @@ import cpw.mods.fml.relauncher.Side; @SuppressWarnings("unused") @Mod( - modid = Tags.MODID, - version = Tags.VERSION, - name = Tags.MODNAME, - acceptedMinecraftVersions = "[1.7.10]", - dependencies = "required-after: gregtech; " + "required-after: gtnhmixins@[2.0.1,); " - + "required-after: modularui; " - + "after: EnderIO; " - + "after: AWWayofTime; " - + "after: ExtraUtilities; " - + "after: InfernalMobs; " - + "after: Thaumcraft; " - + "after: MineTweaker3; " - + "after: miscutils; " - + "after: harvestcraft; " - + "after: Forestry; " - + "after: DraconicEvolution; " - + "after: Avaritia; " - + " after: dreamcraft; ") + modid = Tags.MODID, + version = Tags.VERSION, + name = Tags.MODNAME, + acceptedMinecraftVersions = "[1.7.10]", + dependencies = "required-after: gregtech; " + "required-after: gtnhmixins@[2.0.1,); " + + "required-after: modularui; " + + "after: EnderIO; " + + "after: AWWayofTime; " + + "after: ExtraUtilities; " + + "after: InfernalMobs; " + + "after: Thaumcraft; " + + "after: MineTweaker3; " + + "after: miscutils; " + + "after: harvestcraft; " + + "after: Forestry; " + + "after: DraconicEvolution; " + + "after: Avaritia; " + + " after: dreamcraft; ") public class kubatech { public static kubatech instance = null; 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<MobDrop>) mOutputs.clone(), - mDuration, - mMaxDamageChance, - infernalityAllowed, - alwaysinfernal, - isPeacefulAllowed, - entity, - maxEntityHealth, - isUsable); + (ArrayList<MobDrop>) mOutputs.clone(), + mDuration, + mMaxDamageChance, + infernalityAllowed, + alwaysinfernal, + isPeacefulAllowed, + entity, + maxEntityHealth, + isUsable); } private MobRecipe(ArrayList<MobDrop> 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<ModifierLoader<?>> modifierLoaders = (ArrayList<ModifierLoader<?>>) 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<ItemStack> 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<ItemStack> 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<ItemStack> 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<ItemStack> 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<String, ArrayList<MobDrop>> 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<MobDrop> 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<String, GeneralMappedMob> 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<String> mobs, - HashMap<String, OverridesConfig.MobOverride> overrides) { + HashMap<String, OverridesConfig.MobOverride> 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<MobDrop> drops, MobRecipe recipe) { IEntityDefinition ie = MineTweakerAPI.game.getEntity(k); if (ie != null) { - for (Map.Entry<IItemStack, IntRange> entry : ie.getDropsToAdd().entrySet()) { + for (Map.Entry<IItemStack, IntRange> 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<IItemStack, IntRange> entry : ie.getDropsToAddPlayerOnly().entrySet()) { + for (Map.Entry<IItemStack, IntRange> 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<MobDrop> toRemove = drops.stream().filter(d -> istack.matches(new MCItemStack(d.stack))) - .collect(Collectors.toList()); + List<MobDrop> 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<? extends MetaTileEntity> mte, String aName, - String aNameRegional) { + String aNameRegional) { return registerMTE(item, mte, aName, aNameRegional, true); } private static boolean registerMTE(ItemList item, Class<? extends MetaTileEntity> 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<? extends MetaTileEntity> 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<? extends MetaTileEntity> 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<ItemID> 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<ItemStack> 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<ItemID> 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<String> 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<IModularUIContainerCreator, UIInfo<?, ?>> 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_77624_4_) { - KubaBlock.blocks.get(p_77624_1_.getItemDamage()).addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); + KubaBlock.blocks.get(p_77624_1_.getItemDamage()) + .addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); } @Override diff --git a/src/main/java/kubatech/loaders/item/ItemProxy.java b/src/main/java/kubatech/loaders/item/ItemProxy.java index a0a841760c..bd4ea4ba45 100644 --- a/src/main/java/kubatech/loaders/item/ItemProxy.java +++ b/src/main/java/kubatech/loaders/item/ItemProxy.java @@ -33,23 +33,26 @@ import com.gtnewhorizons.modularui.common.internal.wrapper.ModularUIContainer; public class ItemProxy { - private static final UIInfo<?, ?> HeldItemUIInfo = UIBuilder.of().container((player, w, x, y, z) -> { - ItemStack stack = player.getHeldItem(); - ItemProxy proxy = KubaItems.getItemProxy(stack); - if (!(proxy instanceof IItemProxyGUI)) return null; - UIBuildContext context = new UIBuildContext(player); - ModularWindow window = ((IItemProxyGUI) proxy).createWindow(stack, player); - return new ModularUIContainer( + private static final UIInfo<?, ?> HeldItemUIInfo = UIBuilder.of() + .container((player, w, x, y, z) -> { + ItemStack stack = player.getHeldItem(); + ItemProxy proxy = KubaItems.getItemProxy(stack); + if (!(proxy instanceof IItemProxyGUI)) return null; + UIBuildContext context = new UIBuildContext(player); + ModularWindow window = ((IItemProxyGUI) proxy).createWindow(stack, player); + return new ModularUIContainer( new ModularUIContext(context, () -> player.inventoryContainer.detectAndSendChanges()), window); - }).gui((player, w, x, y, z) -> { - ItemStack stack = player.getHeldItem(); - ItemProxy proxy = KubaItems.getItemProxy(stack); - if (!(proxy instanceof IItemProxyGUI)) return null; - UIBuildContext context = new UIBuildContext(player); - ModularWindow window = ((IItemProxyGUI) proxy).createWindow(stack, player); - return new ModularGui(new ModularUIContainer(new ModularUIContext(context, null), window)); - }).build(); + }) + .gui((player, w, x, y, z) -> { + ItemStack stack = player.getHeldItem(); + ItemProxy proxy = KubaItems.getItemProxy(stack); + if (!(proxy instanceof IItemProxyGUI)) return null; + UIBuildContext context = new UIBuildContext(player); + ModularWindow window = ((IItemProxyGUI) proxy).createWindow(stack, player); + return new ModularGui(new ModularUIContainer(new ModularUIContext(context, null), window)); + }) + .build(); private final String unlocalizedName; private final String texturepath; private IIcon icon; @@ -69,7 +72,8 @@ public class ItemProxy { } public String getDisplayName(ItemStack stack) { - return StatCollector.translateToLocal(this.unlocalizedName + ".name").trim(); + return StatCollector.translateToLocal(this.unlocalizedName + ".name") + .trim(); } public void registerIcon(IIconRegister iconRegister) { diff --git a/src/main/java/kubatech/loaders/item/KubaItems.java b/src/main/java/kubatech/loaders/item/KubaItems.java index c01396ca96..974d5de3bb 100644 --- a/src/main/java/kubatech/loaders/item/KubaItems.java +++ b/src/main/java/kubatech/loaders/item/KubaItems.java @@ -63,7 +63,7 @@ public class KubaItems extends Item { @Override public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, - int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { return false; } @@ -111,7 +111,8 @@ public class KubaItems extends Item { @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister p_94581_1_) { - items.values().forEach(t -> t.registerIcon(p_94581_1_)); + items.values() + .forEach(t -> t.registerIcon(p_94581_1_)); } @SideOnly(Side.CLIENT) @@ -128,7 +129,7 @@ public class KubaItems extends Item { @Override public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, - boolean p_77663_5_) { + boolean p_77663_5_) { getItem(p_77663_1_).onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); } } diff --git a/src/main/java/kubatech/loaders/item/items/Tea.java b/src/main/java/kubatech/loaders/item/items/Tea.java index c127609cf9..7923c55d81 100644 --- a/src/main/java/kubatech/loaders/item/items/Tea.java +++ b/src/main/java/kubatech/loaders/item/items/Tea.java @@ -49,7 +49,8 @@ public class Tea extends ItemProxy { @Override public ItemStack onEaten(ItemStack stack, World world, EntityPlayer entity) { if (!entity.capabilities.isCreativeMode) --stack.stackSize; - entity.getFoodStats().addStats(heal, saturation); + entity.getFoodStats() + .addStats(heal, saturation); world.playSoundAtEntity(entity, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); return stack; } diff --git a/src/main/java/kubatech/loaders/item/items/TeaCollection.java b/src/main/java/kubatech/loaders/item/items/TeaCollection.java index 46c13a0032..80fac90202 100644 --- a/src/main/java/kubatech/loaders/item/items/TeaCollection.java +++ b/src/main/java/kubatech/loaders/item/items/TeaCollection.java @@ -46,28 +46,37 @@ public class TeaCollection extends ItemProxy { } private static final int[][] achievement_poses = new int[][] { { 0, 0 }, { 2, 0 }, { 3, 1 }, { 4, 2 }, { 4, 4 }, - { 3, 5 }, { 2, 6 }, { 0, 6 }, { -1, 5 }, { -2, 4 }, { -2, 2 }, { -1, 1 }, { 1, 3 } }; + { 3, 5 }, { 2, 6 }, { 0, 6 }, { -1, 5 }, { -2, 4 }, { -2, 2 }, { -1, 1 }, { 1, 3 } }; boolean checkTeaOwner(ItemStack stack, UUID player) { NBTTagCompound tag = stack.stackTagCompound; if (tag == null || !stack.stackTagCompound.hasKey("TeaOwnerUUID")) return true; - return stack.stackTagCompound.getString("TeaOwnerUUID").equals(player.toString()); + return stack.stackTagCompound.getString("TeaOwnerUUID") + .equals(player.toString()); } boolean checkTeaOwner(ItemStack stack, String player) { NBTTagCompound tag = stack.stackTagCompound; if (tag == null || !stack.stackTagCompound.hasKey("TeaOwner")) return true; - return stack.stackTagCompound.getString("TeaOwner").equals(player); + return stack.stackTagCompound.getString("TeaOwner") + .equals(player); } private boolean checkOrSetTeaOwner(ItemStack stack, EntityPlayer player) { NBTTagCompound tag = stack.stackTagCompound; if (tag == null || !stack.stackTagCompound.hasKey("TeaOwnerUUID")) { - stack.setTagInfo("TeaOwnerUUID", new NBTTagString(player.getPersistentID().toString())); + stack.setTagInfo( + "TeaOwnerUUID", + new NBTTagString( + player.getPersistentID() + .toString())); stack.setTagInfo("TeaOwner", new NBTTagString(player.getCommandSenderName())); return true; } - if (stack.stackTagCompound.getString("TeaOwnerUUID").equals(player.getPersistentID().toString())) { + if (stack.stackTagCompound.getString("TeaOwnerUUID") + .equals( + player.getPersistentID() + .toString())) { stack.setTagInfo("TeaOwner", new NBTTagString(player.getCommandSenderName())); return true; } else return false; @@ -82,35 +91,35 @@ public class TeaCollection extends ItemProxy { achievements = teapage.getAchievementsOriginal(); } achievements.add( - achievement = new Achievement( - achievementname, - achievementname, - achievement_poses[index][0], - achievement_poses[index][1], - new ItemStack(ItemLoader.kubaitems, 1, index), - null).registerStat()); + achievement = new Achievement( + achievementname, + achievementname, + achievement_poses[index][0], + achievement_poses[index][1], + new ItemStack(ItemLoader.kubaitems, 1, index), + null).registerStat()); } @Override public void addInformation(ItemStack stack, EntityPlayer entity, List<String> tooltipList, boolean showDebugInfo) { if (!checkTeaOwner(stack, entity.getCommandSenderName())) { tooltipList.add( - EnumChatFormatting.GRAY + "" - + EnumChatFormatting.BOLD - + "" - + EnumChatFormatting.ITALIC - + StatCollector.translateToLocal("kubaitem.notyours")); + EnumChatFormatting.GRAY + "" + + EnumChatFormatting.BOLD + + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("kubaitem.notyours")); return; } tooltipList.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("kubaitem.fromcollection")); tooltipList.add( - EnumChatFormatting.GRAY + "" - + EnumChatFormatting.BOLD - + "" - + EnumChatFormatting.ITALIC - + "" - + EnumChatFormatting.UNDERLINE - + StatCollector.translateToLocal("kubaitem.teacollection")); + EnumChatFormatting.GRAY + "" + + EnumChatFormatting.BOLD + + "" + + EnumChatFormatting.ITALIC + + "" + + EnumChatFormatting.UNDERLINE + + StatCollector.translateToLocal("kubaitem.teacollection")); } @Override @@ -130,8 +139,8 @@ public class TeaCollection extends ItemProxy { if (world.isRemote) return stack; if (!(entity instanceof EntityPlayerMP)) return stack; entity.addChatComponentMessage( - new ChatComponentText( - EnumChatFormatting.GREEN + StatCollector.translateToLocal("kubaitem.teacollection.mmm"))); + new ChatComponentText( + EnumChatFormatting.GREEN + StatCollector.translateToLocal("kubaitem.teacollection.mmm"))); entity.triggerAchievement(achievement); return stack; } @@ -174,13 +183,12 @@ public class TeaCollection extends ItemProxy { public List<Achievement> getAchievements() { if (!ModUtils.isClientSided) return super.getAchievements(); - if (new Throwable().getStackTrace()[1].getMethodName().equals("isAchievementInPages")) - return super.getAchievements(); // 5HEAD FIX + if (new Throwable().getStackTrace()[1].getMethodName() + .equals("isAchievementInPages")) return super.getAchievements(); // 5HEAD FIX unlockedAchievements.clear(); - for (Achievement achievement : achievements) - if (Minecraft.getMinecraft().thePlayer.getStatFileWriter().hasAchievementUnlocked(achievement)) - unlockedAchievements.add(achievement); + for (Achievement achievement : achievements) if (Minecraft.getMinecraft().thePlayer.getStatFileWriter() + .hasAchievementUnlocked(achievement)) unlockedAchievements.add(achievement); return unlockedAchievements; } diff --git a/src/main/java/kubatech/loaders/item/items/TeaUltimate.java b/src/main/java/kubatech/loaders/item/items/TeaUltimate.java index ec7da06b2d..8147e3662f 100644 --- a/src/main/java/kubatech/loaders/item/items/TeaUltimate.java +++ b/src/main/java/kubatech/loaders/item/items/TeaUltimate.java @@ -59,9 +59,9 @@ public class TeaUltimate extends TeaCollection implements IItemProxyGUI { if (current - timeCounter > 100) { timeCounter = current; name = StringUtils.applyRainbow( - "ULTIMATE", - colorCounter++, - EnumChatFormatting.BOLD.toString() + EnumChatFormatting.OBFUSCATED); + "ULTIMATE", + colorCounter++, + EnumChatFormatting.BOLD.toString() + EnumChatFormatting.OBFUSCATED); } return String.format(displayName, name + EnumChatFormatting.RESET); } @@ -86,125 +86,89 @@ public class TeaUltimate extends TeaCollection implements IItemProxyGUI { AtomicReference<BigInteger> teaAmount = new AtomicReference<>(BigInteger.ZERO); AtomicReference<BigInteger> teaLimit = new AtomicReference<>(BigInteger.ZERO); builder.widget( - new TabContainer() - .setButtonSize( - 28, - 32) - .addTabButton( - new TabButton(0) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), - tab1) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), - tab1) - .setPos(0, -28)) - .addTabButton( - new TabButton(1) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0, 1f, 0.5f), - tab2) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0.5f, 1f, 1f), - tab2) - .setPos(28, -28)) - .addTabButton( - new TabButton(2) - .setBackground( - false, - ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0, 1f, 0.5f), - tab3) - .setBackground( - true, - ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0.5f, 1f, 1f), - tab3) - .setPos(56, -28)) - .addPage( - new MultiChildWidget() - .addChild( - new TextWidget( - new Text("STATUS").format(EnumChatFormatting.BOLD) - .format(EnumChatFormatting.GOLD).shadow()) - .setPos(10, 5)) - .addChild( - new DynamicTextWidget( - () -> new Text( - "Tea: " + (NEIClientUtils.shiftKey() - ? numberFormat.format(teaAmount.get()) - : numberFormatScientific - .format(teaAmount.get()))) - .color(Color.GREEN.dark(3))) - .setSynced(false) - .setPos(20, 20) - .attachSyncer( - new FakeSyncWidget.BigIntegerSyncer( - () -> teaNetwork.teaAmount, - teaAmount::set), - builder)) - .addChild( - new DynamicTextWidget( - () -> new Text( - "Tea limit: " + (NEIClientUtils.shiftKey() - ? numberFormat.format(teaLimit.get()) - : numberFormatScientific - .format(teaLimit.get()))) - .color(Color.GREEN.dark(3))) - .setSynced(false) - .setPos(20, 30) - .attachSyncer( - new FakeSyncWidget.BigIntegerSyncer( - () -> teaNetwork.teaLimit, - teaLimit::set), - builder))) - .addPage( - new MultiChildWidget() - .addChild( - new TextWidget( - new Text("EXCHANGE").format(EnumChatFormatting.BOLD) - .format(EnumChatFormatting.GOLD).shadow()) - .setPos(10, 5)) - .addChild( - new ButtonWidget() - .setOnClick((Widget.ClickData clickData, Widget widget) -> { - if (!(player instanceof EntityPlayerMP)) return; - if (!teaNetwork.canAfford(50_000, true)) return; - if (player.inventory.addItemStackToInventory( - ItemList.TeaAcceptorResearchNote.get(1))) - return; - player.entityDropItem( - ItemList.TeaAcceptorResearchNote.get(1), - 0.5f); - }) - .setBackground( - new ItemDrawable().setItem( - ItemList.TeaAcceptorResearchNote.get(1))) - .addTooltip("Tea Acceptor Research Note") - .addTooltip( - new Text( - "Cost: " + NumberFormat.getInstance() - .format(50_000) + " Tea") - .color(Color.GRAY.normal)) - .setPos(20, 20))) - .addPage( - new MultiChildWidget().addChild( - new TextWidget( - new Text("BENEFITS").format(EnumChatFormatting.BOLD) - .format(EnumChatFormatting.GOLD).shadow()).setPos(10, 5)) - /* - * .addChild(new ButtonWidget() .setOnClick((Widget.ClickData clickData, Widget widget) -> { if - * (!(player instanceof EntityPlayerMP)) return; if (playerData == null) return; - * playerData.autoRegen = !playerData.autoRegen; playerData.markDirty(); }) .setBackground(new - * ItemDrawable().setItem(new ItemStack(Items.potionitem, 1, 8193))) - * .addTooltip("Regeneration I") .addTooltip("For 1 minute") .addTooltip(new Text("Cost: " + - * NumberFormat.getInstance().format(75_000) + " Tea") .color(Color.GRAY.normal)) // - * .addTooltip( //Find a way to run that on server, or different approach // new - * Text("Autobuy: " + (playerData == null ? "ERROR" : playerData.autoRegen)) // - * .color(Color.GREY.normal)) .setPos(20, 20)) - */ )); + new TabContainer().setButtonSize(28, 32) + .addTabButton( + new TabButton(0) + .setBackground(false, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0, 1f, 0.5f), tab1) + .setBackground(true, ModularUITextures.VANILLA_TAB_TOP_START.getSubArea(0, 0.5f, 1f, 1f), tab1) + .setPos(0, -28)) + .addTabButton( + new TabButton(1) + .setBackground(false, ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0, 1f, 0.5f), tab2) + .setBackground(true, ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0.5f, 1f, 1f), tab2) + .setPos(28, -28)) + .addTabButton( + new TabButton(2) + .setBackground(false, ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0, 1f, 0.5f), tab3) + .setBackground(true, ModularUITextures.VANILLA_TAB_TOP_MIDDLE.getSubArea(0, 0.5f, 1f, 1f), tab3) + .setPos(56, -28)) + .addPage( + new MultiChildWidget().addChild( + new TextWidget( + new Text("STATUS").format(EnumChatFormatting.BOLD) + .format(EnumChatFormatting.GOLD) + .shadow()).setPos(10, 5)) + .addChild( + new DynamicTextWidget( + () -> new Text( + "Tea: " + (NEIClientUtils.shiftKey() ? numberFormat.format(teaAmount.get()) + : numberFormatScientific.format(teaAmount.get()))).color(Color.GREEN.dark(3))) + .setSynced(false) + .setPos(20, 20) + .attachSyncer( + new FakeSyncWidget.BigIntegerSyncer( + () -> teaNetwork.teaAmount, + teaAmount::set), + builder)) + .addChild( + new DynamicTextWidget( + () -> new Text( + "Tea limit: " + (NEIClientUtils.shiftKey() ? numberFormat.format(teaLimit.get()) + : numberFormatScientific.format(teaLimit.get()))).color(Color.GREEN.dark(3))) + .setSynced(false) + .setPos(20, 30) + .attachSyncer( + new FakeSyncWidget.BigIntegerSyncer( + () -> teaNetwork.teaLimit, + teaLimit::set), + builder))) + .addPage( + new MultiChildWidget().addChild( + new TextWidget( + new Text("EXCHANGE").format(EnumChatFormatting.BOLD) + .format(EnumChatFormatting.GOLD) + .shadow()).setPos(10, 5)) + .addChild(new ButtonWidget().setOnClick((Widget.ClickData clickData, Widget widget) -> { + if (!(player instanceof EntityPlayerMP)) return; + if (!teaNetwork.canAfford(50_000, true)) return; + if (player.inventory.addItemStackToInventory(ItemList.TeaAcceptorResearchNote.get(1))) + return; + player.entityDropItem(ItemList.TeaAcceptorResearchNote.get(1), 0.5f); + }) + .setBackground(new ItemDrawable().setItem(ItemList.TeaAcceptorResearchNote.get(1))) + .addTooltip("Tea Acceptor Research Note") + .addTooltip( + new Text( + "Cost: " + NumberFormat.getInstance() + .format(50_000) + " Tea").color(Color.GRAY.normal)) + .setPos(20, 20))) + .addPage( + new MultiChildWidget().addChild( + new TextWidget( + new Text("BENEFITS").format(EnumChatFormatting.BOLD) + .format(EnumChatFormatting.GOLD) + .shadow()).setPos(10, 5)) + /* + * .addChild(new ButtonWidget() .setOnClick((Widget.ClickData clickData, Widget widget) -> { if + * (!(player instanceof EntityPlayerMP)) return; if (playerData == null) return; + * playerData.autoRegen = !playerData.autoRegen; playerData.markDirty(); }) .setBackground(new + * ItemDrawable().setItem(new ItemStack(Items.potionitem, 1, 8193))) + * .addTooltip("Regeneration I") .addTooltip("For 1 minute") .addTooltip(new Text("Cost: " + + * NumberFormat.getInstance().format(75_000) + " Tea") .color(Color.GRAY.normal)) // + * .addTooltip( //Find a way to run that on server, or different approach // new + * Text("Autobuy: " + (playerData == null ? "ERROR" : playerData.autoRegen)) // + * .color(Color.GREY.normal)) .setPos(20, 20)) + */ )); return builder.build(); } diff --git a/src/main/java/kubatech/mixin/Mixin.java b/src/main/java/kubatech/mixin/Mixin.java index 79ae40951f..74f0ca5263 100644 --- a/src/main/java/kubatech/mixin/Mixin.java +++ b/src/main/java/kubatech/mixin/Mixin.java @@ -31,9 +31,11 @@ public enum Mixin { } public boolean shouldLoad(List<TargetedMod> loadedMods) { - return (side == Side.BOTH || side == Side.SERVER && FMLLaunchHandler.side().isServer() - || side == Side.CLIENT && FMLLaunchHandler.side().isClient()) - && new HashSet<>(loadedMods).containsAll(targetedMods); + return (side == Side.BOTH || side == Side.SERVER && FMLLaunchHandler.side() + .isServer() + || side == Side.CLIENT && FMLLaunchHandler.side() + .isClient()) + && new HashSet<>(loadedMods).containsAll(targetedMods); } } diff --git a/src/main/java/kubatech/mixin/MixinPlugin.java b/src/main/java/kubatech/mixin/MixinPlugin.java index 8d89f16a40..5f13983dd1 100644 --- a/src/main/java/kubatech/mixin/MixinPlugin.java +++ b/src/main/java/kubatech/mixin/MixinPlugin.java @@ -53,8 +53,8 @@ public class MixinPlugin implements IMixinConfigPlugin { final boolean isDevelopmentEnvironment = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); List<TargetedMod> loadedMods = Arrays.stream(TargetedMod.values()) - .filter(mod -> mod == VANILLA || (mod.loadInDevelopment && isDevelopmentEnvironment) || loadJarOf(mod)) - .collect(Collectors.toList()); + .filter(mod -> mod == VANILLA || (mod.loadInDevelopment && isDevelopmentEnvironment) || loadJarOf(mod)) + .collect(Collectors.toList()); for (TargetedMod mod : TargetedMod.values()) { if (loadedMods.contains(mod)) { @@ -96,7 +96,10 @@ public class MixinPlugin implements IMixinConfigPlugin { public static File findJarOf(final TargetedMod mod) { try (Stream<Path> stream = walk(MODS_DIRECTORY_PATH)) { - return stream.filter(mod::isMatchingJar).map(Path::toFile).findFirst().orElse(null); + return stream.filter(mod::isMatchingJar) + .map(Path::toFile) + .findFirst() + .orElse(null); } catch (IOException e) { e.printStackTrace(); return null; diff --git a/src/main/java/kubatech/mixin/TargetedMod.java b/src/main/java/kubatech/mixin/TargetedMod.java index 60432334be..6152a91236 100644 --- a/src/main/java/kubatech/mixin/TargetedMod.java +++ b/src/main/java/kubatech/mixin/TargetedMod.java @@ -21,7 +21,8 @@ public enum TargetedMod { @SuppressWarnings("UnstableApiUsage") public boolean isMatchingJar(Path path) { final String pathString = path.toString(); - final String nameLowerCase = Files.getNameWithoutExtension(pathString).toLowerCase(); + final String nameLowerCase = Files.getNameWithoutExtension(pathString) + .toLowerCase(); final String fileExtension = Files.getFileExtension(pathString); return nameLowerCase.startsWith(jarNamePrefixLowercase) && "jar".equals(fileExtension); @@ -30,11 +31,11 @@ public enum TargetedMod { @Override public String toString() { return "TargetedMod{" + "modName='" - + modName - + '\'' - + ", jarNamePrefixLowercase='" - + jarNamePrefixLowercase - + '\'' - + '}'; + + modName + + '\'' + + ", jarNamePrefixLowercase='" + + jarNamePrefixLowercase + + '\'' + + '}'; } } diff --git a/src/main/java/kubatech/mixin/mixins/minecraft/EnchantmentHelperMixin.java b/src/main/java/kubatech/mixin/mixins/minecraft/EnchantmentHelperMixin.java index a2fffbcf57..0e694d3387 100644 --- a/src/main/java/kubatech/mixin/mixins/minecraft/EnchantmentHelperMixin.java +++ b/src/main/java/kubatech/mixin/mixins/minecraft/EnchantmentHelperMixin.java @@ -25,7 +25,7 @@ public class EnchantmentHelperMixin { @Inject(method = "addRandomEnchantment", at = @At("HEAD"), require = 1) private static void addRandomEnchantmentDetector(Random random, ItemStack itemStack, int enchantabilityLevel, - CallbackInfoReturnable<ItemStack> callbackInfoReturnable) { + CallbackInfoReturnable<ItemStack> callbackInfoReturnable) { if (MobRecipeLoader.isInGenerationProcess && random instanceof MobRecipeLoader.fakeRand) { itemStack.setTagInfo(randomEnchantmentDetectedString, new NBTTagInt(enchantabilityLevel)); } diff --git a/src/main/java/kubatech/nei/IMCForNEI.java b/src/main/java/kubatech/nei/IMCForNEI.java index 23a60a373b..1af6399834 100644 --- a/src/main/java/kubatech/nei/IMCForNEI.java +++ b/src/main/java/kubatech/nei/IMCForNEI.java @@ -27,7 +27,7 @@ public class IMCForNEI { } private static void sendHandler(String aName, String aBlock, int width, int height, int maxrecipesperpage, - int yshift) { + int yshift) { NBTTagCompound aNBT = new NBTTagCompound(); aNBT.setString("handler", aName); aNBT.setString("modName", Tags.MODNAME); diff --git a/src/main/java/kubatech/nei/Mob_Handler.java b/src/main/java/kubatech/nei/Mob_Handler.java index eace41db28..5b600ddb97 100644 --- a/src/main/java/kubatech/nei/Mob_Handler.java +++ b/src/main/java/kubatech/nei/Mob_Handler.java @@ -90,7 +90,8 @@ public class Mob_Handler extends TemplateRecipeHandler { final String key; Translations() { - key = "mobhandler." + this.name().toLowerCase(); + key = "mobhandler." + this.name() + .toLowerCase(); } public String get() { @@ -120,7 +121,7 @@ public class Mob_Handler extends TemplateRecipeHandler { public static void addRecipe(EntityLiving e, List<MobDrop> drop) { List<MobPositionedStack> positionedStacks = new ArrayList<>(); int xorigin = 7, xoffset = xorigin, yoffset = 95, normaldrops = 0, raredrops = 0, additionaldrops = 0, - infernaldrops = 0; + infernaldrops = 0; MobDrop.DropType i = null; for (MobDrop d : drop) { if (i == d.type) { @@ -140,22 +141,22 @@ public class Mob_Handler extends TemplateRecipeHandler { else if (d.type == MobDrop.DropType.Additional) additionaldrops++; else if (d.type == MobDrop.DropType.Infernal) break; // dont render infernal drops positionedStacks.add( - new MobPositionedStack( - d.stack.copy(), - xoffset, - yoffset, - d.type, - d.chance, - d.enchantable, - d.damages != null ? new ArrayList<>(d.damages.keySet()) : null, - d.lootable, - d.playerOnly)); + new MobPositionedStack( + d.stack.copy(), + xoffset, + yoffset, + d.type, + d.chance, + d.enchantable, + d.damages != null ? new ArrayList<>(d.damages.keySet()) : null, + d.lootable, + d.playerOnly)); } instance.addRecipeInt(e, positionedStacks, normaldrops, raredrops, additionaldrops, infernaldrops); } private void addRecipeInt(EntityLiving e, List<Mob_Handler.MobPositionedStack> l, int normaldrops, int raredrops, - int additionaldrops, int infernalDrops) { + int additionaldrops, int infernalDrops) { cachedRecipes.add(new MobCachedRecipe(e, l, normaldrops, raredrops, additionaldrops, infernalDrops)); } @@ -178,10 +179,10 @@ public class Mob_Handler extends TemplateRecipeHandler { this.transferRects.add(new RecipeTransferRect(new Rectangle(7, 62, 16, 16), getOverlayIdentifier())); if (!NEI_Config.isAdded) { FMLInterModComms.sendRuntimeMessage( - kubatech.instance, - "NEIPlugins", - "register-crafting-handler", - "kubatech@" + getRecipeName() + "@" + getOverlayIdentifier()); + kubatech.instance, + "NEIPlugins", + "register-crafting-handler", + "kubatech@" + getRecipeName() + "@" + getOverlayIdentifier()); GuiCraftingRecipe.craftinghandlers.add(this); GuiUsageRecipe.usagehandlers.add(this); } @@ -207,7 +208,7 @@ public class Mob_Handler extends TemplateRecipeHandler { static { try { mainmodelfield = RendererLivingEntity.class - .getDeclaredField(ModUtils.isDeobfuscatedEnvironment ? "mainModel" : "field_77045_g"); + .getDeclaredField(ModUtils.isDeobfuscatedEnvironment ? "mainModel" : "field_77045_g"); mainmodelfield.setAccessible(true); } catch (NoSuchFieldException e) { throw new RuntimeException(e); @@ -298,12 +299,12 @@ public class Mob_Handler extends TemplateRecipeHandler { // ARGS: x, y, scale, rot, rot, entity GuiInventory.func_147046_a( - mobx, - moby, - Math.round(scaled), - (x + mobx) - mouseX, - y + moby - eheight * scaled - mouseZ, - e); + mobx, + moby, + Math.round(scaled), + (x + mobx) - mouseX, + y + moby - eheight * scaled - mouseZ, + e); } catch (Throwable ex) { Tessellator tes = Tessellator.instance; try { @@ -359,22 +360,21 @@ public class Mob_Handler extends TemplateRecipeHandler { GuiDraw.drawString(EnumChatFormatting.BOLD + "" + BOSS.get(), x, y += yshift, 0xFFD68F00, false); MobRecipeLoader.MobRecipe MBRecipe = GT_MetaTileEntity_ExtremeExterminationChamber.MobNameToRecipeMap - .get(currentrecipe.mobname); + .get(currentrecipe.mobname); if (MBRecipe != null) { if (MBRecipe.isUsable) { GuiDraw.drawString( - GT_Utility.trans("153", "Usage: ") + GT_Utility.formatNumbers(MBRecipe.mEUt) + " EU/t", - x, - y += yshift, - 0xFF555555, - false); + GT_Utility.trans("153", "Usage: ") + GT_Utility.formatNumbers(MBRecipe.mEUt) + " EU/t", + x, + y += yshift, + 0xFF555555, + false); GuiDraw.drawString( - GT_Utility.trans("158", "Time: ") + GT_Utility.formatNumbers(MBRecipe.mDuration / 20d) - + " secs", - x, - y += yshift, - 0xFF555555, - false); + GT_Utility.trans("158", "Time: ") + GT_Utility.formatNumbers(MBRecipe.mDuration / 20d) + " secs", + x, + y += yshift, + 0xFF555555, + false); } else { GuiDraw.drawString(CANNOT_USE_VIAL.get(), x, y += yshift, 0xFF555555, false); } @@ -437,17 +437,21 @@ public class Mob_Handler extends TemplateRecipeHandler { @Override public void loadUsageRecipes(ItemStack ingredient) { if (LoaderReference.EnderIO && ingredient.getItem() == Item.getItemFromBlock(EnderIO.blockPoweredSpawner)) { - if (!ingredient.hasTagCompound() || !ingredient.getTagCompound().hasKey("mobType")) { + if (!ingredient.hasTagCompound() || !ingredient.getTagCompound() + .hasKey("mobType")) { loadCraftingRecipes(getOverlayIdentifier(), (Object) null); return; } - for (MobCachedRecipe r : cachedRecipes) if (r.mInput.stream().anyMatch( + for (MobCachedRecipe r : cachedRecipes) if (r.mInput.stream() + .anyMatch( s -> s.getItem() == ingredient.getItem() && Objects.equals( - s.getTagCompound().getString("mobType"), - ingredient.getTagCompound().getString("mobType")))) + s.getTagCompound() + .getString("mobType"), + ingredient.getTagCompound() + .getString("mobType")))) arecipes.add(r); - } else for (MobCachedRecipe r : cachedRecipes) - if (r.mInput.stream().anyMatch(ingredient::isItemEqual)) arecipes.add(r); + } else for (MobCachedRecipe r : cachedRecipes) if (r.mInput.stream() + .anyMatch(ingredient::isItemEqual)) arecipes.add(r); } @Override @@ -458,8 +462,10 @@ public class Mob_Handler extends TemplateRecipeHandler { @Override public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipe) { MobCachedRecipe currentrecipe = ((MobCachedRecipe) arecipes.get(recipe)); - PositionedStack positionedStack = currentrecipe.mOutputs.stream().filter(ps -> ps.item == stack).findFirst() - .orElse(null); + PositionedStack positionedStack = currentrecipe.mOutputs.stream() + .filter(ps -> ps.item == stack) + .findFirst() + .orElse(null); if (positionedStack instanceof MobPositionedStack) currenttip.addAll(((MobPositionedStack) positionedStack).extraTooltip); return currenttip; @@ -477,7 +483,7 @@ public class Mob_Handler extends TemplateRecipeHandler { public final List<String> extraTooltip; public MobPositionedStack(Object object, int x, int y, MobDrop.DropType type, int chance, Integer enchantable, - List<Integer> damages, boolean lootable, boolean isPlayerOnly) { + List<Integer> damages, boolean lootable, boolean isPlayerOnly) { super(object, x, y, false); rand = new FastRandom(); this.type = type; @@ -495,8 +501,8 @@ public class Mob_Handler extends TemplateRecipeHandler { if (isPlayerOnly) { extraTooltip.add(EnumChatFormatting.RESET + PLAYER_ONLY.get()); extraTooltip.add( - EnumChatFormatting.RESET - + EEC_CHANCE.get(((double) chance / 100d) * Config.MobHandler.playerOnlyDropsModifier)); + EnumChatFormatting.RESET + + EEC_CHANCE.get(((double) chance / 100d) * Config.MobHandler.playerOnlyDropsModifier)); } extraTooltip.add(EnumChatFormatting.RESET + AVERAGE_REMINDER.get()); @@ -508,7 +514,8 @@ public class Mob_Handler extends TemplateRecipeHandler { if (this.item == null) this.item = this.items[0].copy(); if (enchantable) { if (this.item.getItem() == Items.enchanted_book) this.item = this.items[0].copy(); - if (this.item.hasTagCompound()) this.item.getTagCompound().removeTag("ench"); + if (this.item.hasTagCompound()) this.item.getTagCompound() + .removeTag("ench"); EnchantmentHelper.addRandomEnchantment(rand, this.item, enchantmentLevel); } if (randomdamage) this.item.setItemDamage(damages.get(rand.nextInt(damages.size()))); @@ -533,9 +540,10 @@ public class Mob_Handler extends TemplateRecipeHandler { public String isBoss = ""; public MobCachedRecipe(EntityLiving mob, List<MobPositionedStack> mOutputs, int normalOutputsCount, - int rareOutputsCount, int additionalOutputsCount, int infernalOutputsCount) { + int rareOutputsCount, int additionalOutputsCount, int infernalOutputsCount) { super(); - String classname = mob.getClass().getName(); + String classname = mob.getClass() + .getName(); this.mod = ModUtils.getModNameFromClassName(classname); this.mob = mob; this.maxHealth = mob.getMaxHealth(); @@ -549,8 +557,8 @@ public class Mob_Handler extends TemplateRecipeHandler { int id = EntityList.getEntityID(mob); mobname = EntityList.getEntityString(mob); localizedName = mobname.equals("Skeleton") && ((EntitySkeleton) mob).getSkeletonType() == 1 - ? "Wither Skeleton" - : StatCollector.translateToLocal("entity." + mobname + ".name"); + ? "Wither Skeleton" + : StatCollector.translateToLocal("entity." + mobname + ".name"); if (id != 0) { this.mInput.add(new ItemStack(Items.spawn_egg, 1, id)); this.mInput.add(new ItemStack(Blocks.mob_spawner, 1, id)); diff --git a/src/main/java/kubatech/savedata/PlayerDataManager.java b/src/main/java/kubatech/savedata/PlayerDataManager.java index ba894504e3..46946ca8b0 100644 --- a/src/main/java/kubatech/savedata/PlayerDataManager.java +++ b/src/main/java/kubatech/savedata/PlayerDataManager.java @@ -71,8 +71,14 @@ public class PlayerDataManager extends WorldSavedData { int i = 0; for (Map.Entry<UUID, PlayerData> playerDataEntry : players.entrySet()) { NBTTagCompound playerNBTData = new NBTTagCompound(); - playerNBTData.setString("uuid", playerDataEntry.getKey().toString()); - playerNBTData.setTag("data", playerDataEntry.getValue().toNBTData()); + playerNBTData.setString( + "uuid", + playerDataEntry.getKey() + .toString()); + playerNBTData.setTag( + "data", + playerDataEntry.getValue() + .toNBTData()); NBTData.setTag("Player." + (i++), playerNBTData); } } diff --git a/src/main/java/kubatech/tileentity/TeaAcceptorTile.java b/src/main/java/kubatech/tileentity/TeaAcceptorTile.java index 73bfd46d65..dd7f56f91a 100644 --- a/src/main/java/kubatech/tileentity/TeaAcceptorTile.java +++ b/src/main/java/kubatech/tileentity/TeaAcceptorTile.java @@ -46,7 +46,7 @@ import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; public class TeaAcceptorTile extends TileEntity - implements IInventory, ITileWithModularUI, KubaBlock.IModularUIProvider { + implements IInventory, ITileWithModularUI, KubaBlock.IModularUIProvider { public TeaAcceptorTile() { super(); @@ -135,7 +135,8 @@ public class TeaAcceptorTile extends TileEntity @Override public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { - return p_70300_1_.getPersistentID().equals(tileOwner); + return p_70300_1_.getPersistentID() + .equals(tileOwner); } @Override @@ -144,15 +145,17 @@ public class TeaAcceptorTile extends TileEntity @Override public void closeInventory() {} - private static final int minDamage = ItemList.BlackTea.get(1).getItemDamage(); - private static final int maxDamage = ItemList.YellowTea.get(1).getItemDamage(); + private static final int minDamage = ItemList.BlackTea.get(1) + .getItemDamage(); + private static final int maxDamage = ItemList.YellowTea.get(1) + .getItemDamage(); @Override public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { if (teaNetwork == null) return false; if (!teaNetwork.canAdd(p_94041_2_.stackSize)) return false; return p_94041_2_.getItem() == ItemLoader.kubaitems && p_94041_2_.getItemDamage() >= minDamage - && p_94041_2_.getItemDamage() <= maxDamage; + && p_94041_2_.getItemDamage() <= maxDamage; } private static final UIInfo<?, ?> UI = KubaBlock.TileEntityUIFactory.apply(ModularUIContainer::new); @@ -167,8 +170,8 @@ public class TeaAcceptorTile extends TileEntity } private static final BiFunction<TextWidget, Integer, Widget.PosProvider> posCenteredHorizontallyProvider = ( - TextWidget widget, Integer y) -> (Widget.PosProvider) (screenSize, window, - parent) -> new Pos2d((window.getSize().width / 2) - (widget.getSize().width / 2), y); + TextWidget widget, Integer y) -> (Widget.PosProvider) (screenSize, window, + parent) -> new Pos2d((window.getSize().width / 2) - (widget.getSize().width / 2), y); @Override public ModularWindow createWindow(UIBuildContext buildContext) { @@ -177,35 +180,33 @@ public class TeaAcceptorTile extends TileEntity EntityPlayer player = buildContext.getPlayer(); AtomicReference<BigInteger> teaAmount = new AtomicReference<>(BigInteger.ZERO); builder.widgets( - posCenteredHorizontally( - 10, - new TextWidget( - new Text("Tea Acceptor").format(EnumChatFormatting.BOLD) - .format(EnumChatFormatting.DARK_RED))), - posCenteredHorizontally(30, new DynamicTextWidget(() -> { - if (player.getPersistentID().equals(tileOwner)) return new Text("[Tea]").color(Color.GREEN.normal); - else return new Text("This is not your block").color(Color.RED.normal); - })), - posCenteredHorizontally( - 40, - (TextWidget) new DynamicTextWidget( - () -> new Text( - StringUtils.applyRainbow( - NEIClientUtils.shiftKey() ? numberFormat.format(teaAmount.get()) - : numberFormatScientific.format(teaAmount.get()), - (int) ((teaAmount.get().longValue() / Math.max(1, averageInput * 10)) - % Integer.MAX_VALUE), - EnumChatFormatting.BOLD.toString())).shadow()).setSynced(false) - .attachSyncer( - new FakeSyncWidget.BigIntegerSyncer( - () -> teaNetwork.teaAmount, - teaAmount::set), - builder)), - posCenteredHorizontally( - 50, - new DynamicTextWidget(() -> new Text("IN: " + averageInput + "/t").color(Color.BLACK.normal))) - .addTooltip( - new Text("Average input from the last 5 seconds").color(Color.GRAY.normal))); + posCenteredHorizontally( + 10, + new TextWidget( + new Text("Tea Acceptor").format(EnumChatFormatting.BOLD) + .format(EnumChatFormatting.DARK_RED))), + posCenteredHorizontally(30, new DynamicTextWidget(() -> { + if (player.getPersistentID() + .equals(tileOwner)) return new Text("[Tea]").color(Color.GREEN.normal); + else return new Text("This is not your block").color(Color.RED.normal); + })), + posCenteredHorizontally( + 40, + (TextWidget) new DynamicTextWidget( + () -> new Text( + StringUtils.applyRainbow( + NEIClientUtils.shiftKey() ? numberFormat.format(teaAmount.get()) + : numberFormatScientific.format(teaAmount.get()), + (int) ((teaAmount.get() + .longValue() / Math.max(1, averageInput * 10)) % Integer.MAX_VALUE), + EnumChatFormatting.BOLD.toString())).shadow()).setSynced(false) + .attachSyncer( + new FakeSyncWidget.BigIntegerSyncer(() -> teaNetwork.teaAmount, teaAmount::set), + builder)), + posCenteredHorizontally( + 50, + new DynamicTextWidget(() -> new Text("IN: " + averageInput + "/t").color(Color.BLACK.normal))) + .addTooltip(new Text("Average input from the last 5 seconds").color(Color.GRAY.normal))); return builder.build(); } } diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java index a35c275bcd..8060382053 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java @@ -99,8 +99,8 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; public class GT_MetaTileEntity_ExtremeExterminationChamber - extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_ExtremeExterminationChamber> - implements CustomTileEntityPacketHandler, ISurvivalConstructable { + extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_ExtremeExterminationChamber> + implements CustomTileEntityPacketHandler, ISurvivalConstructable { public static final HashMap<String, MobRecipeLoader.MobRecipe> MobNameToRecipeMap = new HashMap<>(); public static final double DIAMOND_SPIKES_DAMAGE = 9d; @@ -132,36 +132,34 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private static final int CASING_INDEX = 16; private static final String STRUCTURE_PIECE_MAIN = "main"; private static final IStructureDefinition<GT_MetaTileEntity_ExtremeExterminationChamber> STRUCTURE_DEFINITION = StructureDefinition - .<GT_MetaTileEntity_ExtremeExterminationChamber>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - transpose( - new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, - { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, - { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, - { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, - { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, - { "fgggf", "gsssg", "gsssg", "gsssg", "fgggf" }, - { "CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC" }, })) - .addElement('c', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 0))) - .addElement( - 'C', - buildHatchAdder(GT_MetaTileEntity_ExtremeExterminationChamber.class) - .atLeast(InputBus, OutputBus, OutputHatch, Energy, Maintenance).casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 0)))) - .addElement( - 'g', - LoaderReference.Bartworks - ? BorosilicateGlass.ofBoroGlass((byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier) - : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0))) - .addElement('f', ofFrame(Materials.Steel)) - .addElement( - 's', - LoaderReference.ExtraUtilities - ? ofBlock(Block.getBlockFromName("ExtraUtilities:spike_base_diamond"), 0) - : isAir()) - .build(); + .<GT_MetaTileEntity_ExtremeExterminationChamber>builder() + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, + { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, + { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, + { "fgggf", "gsssg", "gsssg", "gsssg", "fgggf" }, + { "CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC" }, })) + .addElement('c', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 0))) + .addElement( + 'C', + buildHatchAdder(GT_MetaTileEntity_ExtremeExterminationChamber.class) + .atLeast(InputBus, OutputBus, OutputHatch, Energy, Maintenance) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 0)))) + .addElement( + 'g', + LoaderReference.Bartworks + ? BorosilicateGlass.ofBoroGlass((byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier) + : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0))) + .addElement('f', ofFrame(Materials.Steel)) + .addElement( + 's', + LoaderReference.ExtraUtilities ? ofBlock(Block.getBlockFromName("ExtraUtilities:spike_base_diamond"), 0) + : isAir()) + .build(); private TileEntity masterStoneRitual = null; private TileEntity tileAltar = null; @@ -191,7 +189,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber mAnimationEnabled = !aNBT.hasKey("mAnimationEnabled") || aNBT.getBoolean("mAnimationEnabled"); mGlassTier = aNBT.getByte("mGlassTier"); mIsProducingInfernalDrops = !aNBT.hasKey("mIsProducingInfernalDrops") - || aNBT.getBoolean("mIsProducingInfernalDrops"); + || aNBT.getBoolean("mIsProducingInfernalDrops"); } @Override @@ -217,35 +215,44 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Powered Spawner").addInfo("Controller block for Extreme Extermination Chamber") - .addInfo(Author).addInfo("Spawns and Exterminates monsters for you") - .addInfo("You have to insert the powered spawner in controller") - .addInfo("Base energy usage: 2,000 EU/t") - .addInfo("Supports perfect OC, minimum time: 20 ticks, after that multiplies the outputs") - .addInfo("Recipe time is based on mob health") - .addInfo("You can additionally put a weapon to the ULV input bus") - .addInfo("It will speed up the process and apply looting level from the weapon (maximum 4 levels)") - .addInfo(EnumChatFormatting.RED + "Enchanting the spikes inside does nothing!") - .addInfo("Also produces 120 Liquid XP per operation").addInfo("If the mob spawns infernal") - .addInfo("it will drain 8 times more power") - .addInfo("You can prevent infernal spawns by shift clicking with a screwdriver") - .addInfo("Note: If the mob has forced infernal spawn, it will do it anyway") - .addInfo("You can enable ritual mode with a screwdriver") - .addInfo("When in ritual mode and Well Of Suffering ritual is built directly on the machine in center") - .addInfo("The mobs will start to buffer and die very slowly by a ritual") - .addInfo("You can disable mob animation with a soldering iron").addInfo(StructureHologram) - .addSeparator().beginStructureBlock(5, 7, 5, true).addController("Front Bottom Center") - .addCasingInfoMin("Solid Steel Machine Casing", 10, false) - .addOtherStructurePart("Borosilicate Glass", "All walls without corners") - .addStructureInfo("The glass tier limits the Energy Input tier") - .addOtherStructurePart("Steel Frame Box", "All vertical corners (except top and bottom)") - .addOtherStructurePart("Diamond spikes", "Inside second layer").addOutputBus("Any bottom casing", 1) - .addOtherStructurePart( - "1x ULV " + StatCollector.translateToLocal("GT5U.MBTT.InputBus"), - "Any bottom casing", - 1) - .addOutputHatch("Any bottom casing", 1).addEnergyHatch("Any bottom casing", 1) - .addMaintenanceHatch("Any bottom casing", 1).toolTipFinisher(Tags.MODNAME); + tt.addMachineType("Powered Spawner") + .addInfo("Controller block for Extreme Extermination Chamber") + .addInfo(Author) + .addInfo("Spawns and Exterminates monsters for you") + .addInfo("You have to insert the powered spawner in controller") + .addInfo("Base energy usage: 2,000 EU/t") + .addInfo("Supports perfect OC, minimum time: 20 ticks, after that multiplies the outputs") + .addInfo("Recipe time is based on mob health") + .addInfo("You can additionally put a weapon to the ULV input bus") + .addInfo("It will speed up the process and apply looting level from the weapon (maximum 4 levels)") + .addInfo(EnumChatFormatting.RED + "Enchanting the spikes inside does nothing!") + .addInfo("Also produces 120 Liquid XP per operation") + .addInfo("If the mob spawns infernal") + .addInfo("it will drain 8 times more power") + .addInfo("You can prevent infernal spawns by shift clicking with a screwdriver") + .addInfo("Note: If the mob has forced infernal spawn, it will do it anyway") + .addInfo("You can enable ritual mode with a screwdriver") + .addInfo("When in ritual mode and Well Of Suffering ritual is built directly on the machine in center") + .addInfo("The mobs will start to buffer and die very slowly by a ritual") + .addInfo("You can disable mob animation with a soldering iron") + .addInfo(StructureHologram) + .addSeparator() + .beginStructureBlock(5, 7, 5, true) + .addController("Front Bottom Center") + .addCasingInfoMin("Solid Steel Machine Casing", 10, false) + .addOtherStructurePart("Borosilicate Glass", "All walls without corners") + .addStructureInfo("The glass tier limits the Energy Input tier") + .addOtherStructurePart("Steel Frame Box", "All vertical corners (except top and bottom)") + .addOtherStructurePart("Diamond spikes", "Inside second layer") + .addOutputBus("Any bottom casing", 1) + .addOtherStructurePart( + "1x ULV " + StatCollector.translateToLocal("GT5U.MBTT.InputBus"), + "Any bottom casing", + 1) + .addOutputHatch("Any bottom casing", 1) + .addEnergyHatch("Any bottom casing", 1) + .addMaintenanceHatch("Any bottom casing", 1) + .toolTipFinisher(Tags.MODNAME); return tt; } @@ -266,16 +273,27 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { if (aSide == aFacing) { if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).extFacing().glow() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).extFacing().glow() - .build() }; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW) + .extFacing() + .glow() + .build() }; } return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; } @@ -283,10 +301,12 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @SideOnly(Side.CLIENT) private void setupEntityRenderer(IGregTechTileEntity aBaseMetaTileEntity, int time) { if (entityRenderer == null) { - ChunkCoordinates coords = this.getBaseMetaTileEntity().getCoords(); + ChunkCoordinates coords = this.getBaseMetaTileEntity() + .getCoords(); int[] abc = new int[] { 0, -2, 2 }; int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); + this.getExtendedFacing() + .getWorldOffset(abc, xyz); xyz[0] += coords.posX; xyz[1] += coords.posY; xyz[2] += coords.posZ; @@ -355,7 +375,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ)) return true; mAnimationEnabled = !mAnimationEnabled; GT_Utility.sendChatToPlayer(aPlayer, "Animations are " + (mAnimationEnabled ? "enabled" : "disabled")); @@ -396,18 +416,18 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber } ((IBloodAltar) tileAltar).sacrificialDaggerCall( - 100 * RitualEffectWellOfSuffering.amount - * (effect.canDrainReagent( - event.mrs, - ReagentRegistry.offensaReagent, - ReflectionHelper.getField(effect, "offensaDrain", 3), - true) ? 2 : 1) - * (effect.canDrainReagent( - event.mrs, - ReagentRegistry.tenebraeReagent, - ReflectionHelper.getField(effect, "tennebraeDrain", 5), - true) ? 2 : 1), - true); + 100 * RitualEffectWellOfSuffering.amount + * (effect.canDrainReagent( + event.mrs, + ReagentRegistry.offensaReagent, + ReflectionHelper.getField(effect, "offensaDrain", 3), + true) ? 2 : 1) + * (effect.canDrainReagent( + event.mrs, + ReagentRegistry.tenebraeReagent, + ReflectionHelper.getField(effect, "tennebraeDrain", 5), + true) ? 2 : 1), + true); SoulNetworkHandler.syphonFromNetwork(owner, effect.getCostPerRefresh() * 100); } @@ -434,19 +454,18 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (aStack.getItem() != poweredSpawnerItem) return false; if (aStack.getTagCompound() == null) return false; - String mobType = aStack.getTagCompound().getString("mobType"); + String mobType = aStack.getTagCompound() + .getString("mobType"); if (mobType.isEmpty()) return false; if (mobType.equals("Skeleton") && getBaseMetaTileEntity().getWorld().provider instanceof WorldProviderHell - && rand.nextInt(5) > 0) - mobType = "witherSkeleton"; + && rand.nextInt(5) > 0) mobType = "witherSkeleton"; MobRecipeLoader.MobRecipe recipe = MobNameToRecipeMap.get(mobType); if (recipe == null) return false; - if (!recipe.isPeacefulAllowed - && this.getBaseMetaTileEntity().getWorld().difficultySetting == EnumDifficulty.PEACEFUL) - return false; + if (!recipe.isPeacefulAllowed && this.getBaseMetaTileEntity() + .getWorld().difficultySetting == EnumDifficulty.PEACEFUL) return false; if (isInRitualMode && isRitualValid()) { if (getMaxInputEu() < recipe.mEUt / 4) return false; @@ -471,28 +490,29 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber try { // noinspection unchecked weaponCache.attackDamage = ((Multimap<String, AttributeModifier>) lootingHolder - .getAttributeModifiers()) - .get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()).stream() - .mapToDouble( - attr -> attr.getAmount() + (double) EnchantmentHelper - .func_152377_a(lootingHolder, EnumCreatureAttribute.UNDEFINED)) - .sum(); + .getAttributeModifiers()) + .get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()) + .stream() + .mapToDouble( + attr -> attr.getAmount() + (double) EnchantmentHelper + .func_152377_a(lootingHolder, EnumCreatureAttribute.UNDEFINED)) + .sum(); } catch (Exception ex) { ex.printStackTrace(); } weaponCache.isValid = true; weaponCache.looting = Math - .min(4, EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, lootingHolder)); + .min(4, EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, lootingHolder)); weaponCache.id = ItemID.create_NoCopy(lootingHolder, true, true); } if (weaponCache.isValid) attackDamage += weaponCache.attackDamage; this.mOutputItems = recipe.generateOutputs( - rand, - this, - attackDamage, - weaponCache.isValid ? weaponCache.looting : 0, - mIsProducingInfernalDrops); + rand, + this, + attackDamage, + weaponCache.isValid ? weaponCache.looting : 0, + mIsProducingInfernalDrops); this.mOutputFluids = new FluidStack[] { FluidRegistry.getFluidStack("xpjuice", 120) }; int times = this.calculatePerfectOverclock(this.lEUt, this.mMaxProgresstime); // noinspection ConstantConditions @@ -529,8 +549,8 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private boolean isRitualValid() { if (!isInRitualMode) return false; if (masterStoneRitual == null) return false; - if (masterStoneRitual.isInvalid() - || !(((TEMasterStone) masterStoneRitual).getCurrentRitual().equals(WellOfSufferingRitualName))) { + if (masterStoneRitual.isInvalid() || !(((TEMasterStone) masterStoneRitual).getCurrentRitual() + .equals(WellOfSufferingRitualName))) { masterStoneRitual = null; return false; } @@ -539,16 +559,20 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private boolean connectToRitual() { if (!LoaderReference.BloodMagic) return false; - ChunkCoordinates coords = this.getBaseMetaTileEntity().getCoords(); + ChunkCoordinates coords = this.getBaseMetaTileEntity() + .getCoords(); int[] abc = new int[] { 0, -8, 2 }; int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); + this.getExtendedFacing() + .getWorldOffset(abc, xyz); xyz[0] += coords.posX; xyz[1] += coords.posY; xyz[2] += coords.posZ; - TileEntity te = this.getBaseMetaTileEntity().getTileEntity(xyz[0], xyz[1], xyz[2]); + TileEntity te = this.getBaseMetaTileEntity() + .getTileEntity(xyz[0], xyz[1], xyz[2]); if (te instanceof TEMasterStone) { - if (((TEMasterStone) te).getCurrentRitual().equals(WellOfSufferingRitualName)) { + if (((TEMasterStone) te).getCurrentRitual() + .equals(WellOfSufferingRitualName)) { masterStoneRitual = te; return true; } @@ -561,8 +585,8 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber mGlassTier = 0; if (!checkPiece(STRUCTURE_PIECE_MAIN, 2, 6, 0)) return false; if (mCasing < 10 || mMaintenanceHatches.size() != 1 - || mEnergyHatches.size() == 0 - || !(mInputBusses.size() == 0 || (mInputBusses.size() == 1 && mInputBusses.get(0).mTier == 0))) + || mEnergyHatches.size() == 0 + || !(mInputBusses.size() == 0 || (mInputBusses.size() == 1 && mInputBusses.get(0).mTier == 0))) return false; if (mGlassTier < 8) for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) if (hatch.mTier > mGlassTier) return false; @@ -575,20 +599,20 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber ArrayList<String> info = new ArrayList<>(Arrays.asList(super.getInfoData())); info.add("Animations: " + EnumChatFormatting.YELLOW + (mAnimationEnabled ? "Enabled" : "Disabled")); info.add( - "Is allowed to produce infernal drops: " + EnumChatFormatting.YELLOW - + (mIsProducingInfernalDrops ? "Yes" : "No")); + "Is allowed to produce infernal drops: " + EnumChatFormatting.YELLOW + + (mIsProducingInfernalDrops ? "Yes" : "No")); info.add("Is in ritual mode: " + EnumChatFormatting.YELLOW + (isInRitualMode ? "Yes" : "No")); if (isInRitualMode) info.add( - "Is connected to ritual: " - + (isRitualValid() ? EnumChatFormatting.GREEN + "Yes" : EnumChatFormatting.RED + "No")); + "Is connected to ritual: " + + (isRitualValid() ? EnumChatFormatting.GREEN + "Yes" : EnumChatFormatting.RED + "No")); else { info.add("Inserted weapon: " + EnumChatFormatting.YELLOW + (weaponCache.isValid ? "Yes" : "No")); if (weaponCache.isValid) { info.add("Weapon attack damage: " + EnumChatFormatting.YELLOW + weaponCache.attackDamage); info.add("Weapon looting level: " + EnumChatFormatting.YELLOW + weaponCache.looting); info.add( - "Total attack damage: " + EnumChatFormatting.YELLOW - + (DIAMOND_SPIKES_DAMAGE + weaponCache.attackDamage)); + "Total attack damage: " + EnumChatFormatting.YELLOW + + (DIAMOND_SPIKES_DAMAGE + weaponCache.attackDamage)); } else info.add("Total attack damage: " + EnumChatFormatting.YELLOW + DIAMOND_SPIKES_DAMAGE); } return info.toArray(new String[0]); @@ -611,44 +635,51 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.bindPlayerInventory(buildContext.getPlayer(), new Pos2d(7, 83), this.getGUITextureSet().getItemSlot()); + builder.bindPlayerInventory( + buildContext.getPlayer(), + new Pos2d(7, 83), + this.getGUITextureSet() + .getItemSlot()); } @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(143, 75) - .setEnabled(widget -> !isFixed.apply(widget))); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4) + .setSize(143, 75) + .setEnabled(widget -> !isFixed.apply(widget))); final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1) - .setFilter(stack -> stack.getItem() == poweredSpawnerItem); + .setFilter(stack -> stack.getItem() == poweredSpawnerItem); DynamicPositionedColumn configurationElements = new DynamicPositionedColumn(); addConfigurationWidgets(configurationElements, buildContext, inventorySlot); builder.widget( - new DynamicPositionedColumn().setSynced(false).widget(inventorySlot).widget( - new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { - if (works) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); - - if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; - String tChat = GT_Utility.trans("090", "Machine Processing: ") - + (works ? GT_Utility.trans("088", "Enabled") - : GT_Utility.trans("087", "Disabled")); - if (hasAlternativeModeText()) tChat = getAlternativeModeText(); - GT_Utility.sendChatToPlayer(buildContext.getPlayer(), tChat); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18) - .addTooltip("Working status")) - .widget(configurationElements.setEnabled(widget -> !getBaseMetaTileEntity().isActive())) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS).setSize(18, 18) - .addTooltip( - new Text("Please stop the machine to configure it") - .color(Color.RED.dark(3))) - .setEnabled(widget -> getBaseMetaTileEntity().isActive())) - .setPos(151, 4)); + new DynamicPositionedColumn().setSynced(false) + .widget(inventorySlot) + .widget(new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { + if (works) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); + + if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; + String tChat = GT_Utility.trans("090", "Machine Processing: ") + + (works ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); + if (hasAlternativeModeText()) tChat = getAlternativeModeText(); + GT_Utility.sendChatToPlayer(buildContext.getPlayer(), tChat); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Working status")) + .widget(configurationElements.setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS) + .setSize(18, 18) + .addTooltip(new Text("Please stop the machine to configure it").color(Color.RED.dark(3))) + .setEnabled(widget -> getBaseMetaTileEntity().isActive())) + .setPos(151, 4)); final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); drawTexts(screenElements, inventorySlot); @@ -656,7 +687,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber } private void addConfigurationWidgets(DynamicPositionedColumn configurationElements, UIBuildContext buildContext, - SlotWidget inventorySlot) { + SlotWidget inventorySlot) { configurationElements.setSynced(false); configurationElements.widget(new CycleButtonWidget().setToggle(() -> isInRitualMode, v -> { if (this.mMaxProgresstime > 0) { @@ -675,7 +706,10 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Successfully connected to the ritual"); else GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Can't connect to the ritual"); } - }).setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18).addTooltip("Ritual mode")); + }) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Ritual mode")); configurationElements.widget(new CycleButtonWidget().setToggle(() -> mIsProducingInfernalDrops, v -> { if (this.mMaxProgresstime > 0) { GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Can't change mode when running !"); @@ -686,29 +720,33 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; if (!mIsProducingInfernalDrops) GT_Utility - .sendChatToPlayer(buildContext.getPlayer(), "Mobs will now be prevented from spawning infernal"); + .sendChatToPlayer(buildContext.getPlayer(), "Mobs will now be prevented from spawning infernal"); else GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Mobs can spawn infernal now"); - }).setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18) - .addTooltip("Is allowed to spawn infernal mobs") - .addTooltip(new Text("Does not affect mobs that are always infernal !").color(Color.GRAY.normal))); + }) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Is allowed to spawn infernal mobs") + .addTooltip(new Text("Does not affect mobs that are always infernal !").color(Color.GRAY.normal))); } @Override protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { - screenElements.setSynced(false).setSpace(0).setPos(10, 7); + screenElements.setSynced(false) + .setSpace(0) + .setPos(10, 7); screenElements.widget( - new DynamicPositionedRow().setSynced(false) - .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) - .widget(new DynamicTextWidget(() -> { - if (getBaseMetaTileEntity().isActive()) - return new Text("Working !").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().isAllowedToWork()) - return new Text("Enabled").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().wasShutdown()) - return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); - else return new Text("Disabled").color(Color.RED.dark(3)); - })).setEnabled(isFixed)); + new DynamicPositionedRow().setSynced(false) + .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) + .widget(new DynamicTextWidget(() -> { + if (getBaseMetaTileEntity().isActive()) return new Text("Working !").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().isAllowedToWork()) + return new Text("Enabled").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().wasShutdown()) + return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); + else return new Text("Disabled").color(Color.RED.dark(3)); + })) + .setEnabled(isFixed)); screenElements.widget(new DynamicTextWidget(() -> { ItemStack aStack = mInventory[1]; if (aStack == null) return new Text("Insert Powered Spawner").color(Color.RED.dark(3)); @@ -717,51 +755,53 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (aStack.getItem() != poweredSpawnerItem) return invalid; if (aStack.getTagCompound() == null) return invalid; - String mobType = aStack.getTagCompound().getString("mobType"); + String mobType = aStack.getTagCompound() + .getString("mobType"); if (mobType.isEmpty()) return invalid; if (!MobNameToRecipeMap.containsKey(mobType)) return invalid; return new Text(StatCollector.translateToLocal("entity." + mobType + ".name")) - .color(Color.GREEN.dark(3)); + .color(Color.GREEN.dark(3)); } }).setEnabled(isFixed)); screenElements - .widget( - new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + .widget( + new TextWidget(GT_Utility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mWrench)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("133", "Screws are loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + .widget( + new TextWidget(GT_Utility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mScrewdriver)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("134", "Something is stuck.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSoftHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("135", "Platings are dented.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mHardHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + .widget( + new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSolderingTool)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + .widget( + new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mCrowbar)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + .widget( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); } private static class EECFakePlayer extends FakePlayer { @@ -771,10 +811,11 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber public EECFakePlayer(GT_MetaTileEntity_ExtremeExterminationChamber mte) { super( - (WorldServer) mte.getBaseMetaTileEntity().getWorld(), - new GameProfile( - UUID.nameUUIDFromBytes("[EEC Fake Player]".getBytes(StandardCharsets.UTF_8)), - "[EEC Fake Player]")); + (WorldServer) mte.getBaseMetaTileEntity() + .getWorld(), + new GameProfile( + UUID.nameUUIDFromBytes("[EEC Fake Player]".getBytes(StandardCharsets.UTF_8)), + "[EEC Fake Player]")); this.mte = mte; } diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java index 00cfd2f0cc..10ba6ce88e 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java @@ -97,7 +97,7 @@ import ic2.core.crop.TileEntityCrop; @SuppressWarnings("unused") public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse - extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_ExtremeIndustrialGreenhouse> { + extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_ExtremeIndustrialGreenhouse> { private static final boolean debug = false; private static final int EIG_MATH_VERSION = 0; @@ -117,57 +117,48 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse private static final Item forestryfertilizer = GameRegistry.findItem("Forestry", "fertilizerCompound"); private static final Fluid weedex = Materials.WeedEX9000.mFluid; private static final IStructureDefinition<GT_MetaTileEntity_ExtremeIndustrialGreenhouse> STRUCTURE_DEFINITION = StructureDefinition - .<GT_MetaTileEntity_ExtremeIndustrialGreenhouse>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - transpose( - new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, - { "ccccc", "clllc", "clllc", "clllc", "ccccc" }, - { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, - { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, - { "ccccc", "cdddc", "cdwdc", "cdddc", "ccccc" }, - { "cc~cc", "cCCCc", "cCCCc", "cCCCc", "ccccc" }, })) - .addElement( - 'c', - ofChain( - onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), - ofHatchAdder( - GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addEnergyInputToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addMaintenanceToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addInputToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addOutputToMachineList, - CASING_INDEX, - 1))) - .addElement('C', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1))) - .addElement( - 'l', - LoaderReference.ProjRedIllumination - ? ofBlock(Block.getBlockFromName("ProjRed|Illumination:projectred.illumination.lamp"), 10) - : ofChain(ofBlock(Blocks.redstone_lamp, 0), ofBlock(Blocks.lit_redstone_lamp, 0))) - .addElement( - 'g', - LoaderReference.Bartworks ? BorosilicateGlass.ofBoroGlass( - (byte) 0, - (byte) 1, - Byte.MAX_VALUE, - (te, t) -> te.glasTier = t, - te -> te.glasTier) : onElementPass(t -> t.glasTier = 100, ofBlock(Blocks.glass, 0))) - .addElement( - 'd', - ofBlock( - LoaderReference.RandomThings ? Block.getBlockFromName("RandomThings:fertilizedDirt_tilled") - : Blocks.farmland, - 0)) - .addElement('w', ofBlock(Blocks.water, 0)).build(); + .<GT_MetaTileEntity_ExtremeIndustrialGreenhouse>builder() + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, + { "ccccc", "clllc", "clllc", "clllc", "ccccc" }, { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, + { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, { "ccccc", "cdddc", "cdwdc", "cdddc", "ccccc" }, + { "cc~cc", "cCCCc", "cCCCc", "cCCCc", "ccccc" }, })) + .addElement( + 'c', + ofChain( + onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), + ofHatchAdder( + GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addEnergyInputToMachineList, + CASING_INDEX, + 1), + ofHatchAdder( + GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addMaintenanceToMachineList, + CASING_INDEX, + 1), + ofHatchAdder(GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addInputToMachineList, CASING_INDEX, 1), + ofHatchAdder(GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addOutputToMachineList, CASING_INDEX, 1))) + .addElement('C', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1))) + .addElement( + 'l', + LoaderReference.ProjRedIllumination + ? ofBlock(Block.getBlockFromName("ProjRed|Illumination:projectred.illumination.lamp"), 10) + : ofChain(ofBlock(Blocks.redstone_lamp, 0), ofBlock(Blocks.lit_redstone_lamp, 0))) + .addElement( + 'g', + LoaderReference.Bartworks + ? BorosilicateGlass + .ofBoroGlass((byte) 0, (byte) 1, Byte.MAX_VALUE, (te, t) -> te.glasTier = t, te -> te.glasTier) + : onElementPass(t -> t.glasTier = 100, ofBlock(Blocks.glass, 0))) + .addElement( + 'd', + ofBlock( + LoaderReference.RandomThings ? Block.getBlockFromName("RandomThings:fertilizedDirt_tilled") + : Blocks.farmland, + 0)) + .addElement('w', ofBlock(Blocks.water, 0)) + .build(); public GT_MetaTileEntity_ExtremeIndustrialGreenhouse(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -198,15 +189,15 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse this.setupphase++; if (this.setupphase == 3) this.setupphase = 0; GT_Utility.sendChatToPlayer( - aPlayer, - "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." - : (this.setupphase == 2 ? "setup mode (output)." : "normal operation."))); + aPlayer, + "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." + : (this.setupphase == 2 ? "setup mode (output)." : "normal operation."))); } } @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { isNoHumidity = !isNoHumidity; GT_Utility.sendChatToPlayer(aPlayer, "Give incoming crops no humidity " + isNoHumidity); return true; @@ -230,48 +221,58 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Crop Farm").addInfo("Controller block for the Extreme Industrial Greenhouse").addInfo(Author) - .addInfo("Grow your crops like a chad !").addInfo("Use screwdriver to enable/change/disable setup mode") - .addInfo("Use screwdriver while sneaking to enable/disable IC2 mode") - .addInfo("Use wire cutters to give incoming IC2 crops 0 humidity") - .addInfo("Uses 1000L of water per crop per operation") - .addInfo("If there are >= 1000 crops -> Uses 1L of Weed-EX 9000 per crop per second") - .addInfo("Otherwise, around 1% of crops will die each operation") - .addInfo("You can insert fertilizer each operation to get more drops (max +400%)") - .addInfo("-------------------- SETUP MODE --------------------").addInfo("Does not take power") - .addInfo("There are two modes: input / output") - .addInfo("Input mode: machine will take seeds from input bus and plant them") - .addInfo("[IC2] You need to also input block that is required under the crop") - .addInfo("Output mode: machine will take planted seeds and output them") - .addInfo("-------------------- NORMAL CROPS --------------------") - .addInfo("Minimal tier: " + voltageTooltipFormatted(4)).addInfo("Starting with 1 slot") - .addInfo("Every slot gives 64 crops") - .addInfo("Every tier past " + voltageTooltipFormatted(4) + ", slots are multiplied by 2") - .addInfo("Base process time: 5 sec") - .addInfo( - "Process time is divided by number of tiers past " + voltageTooltipFormatted(3) - + " (Minimum 1 sec)") - .addInfo("All crops are grown at the end of the operation") - .addInfo("Will automatically craft seeds if they are not dropped") - .addInfo("1 Fertilizer per 1 crop +200%") - .addInfo("-------------------- IC2 CROPS --------------------") - .addInfo("Minimal tier: " + voltageTooltipFormatted(6)) - .addInfo("Need " + voltageTooltipFormatted(6) + " glass tier").addInfo("Starting with 4 slots") - .addInfo("Every slot gives 1 crop") - .addInfo("Every tier past " + voltageTooltipFormatted(6) + ", slots are multiplied by 4") - .addInfo("Process time: 5 sec").addInfo("All crops are accelerated by x32 times") - .addInfo("1 Fertilizer per 1 crop +10%").addInfo(StructureHologram).addSeparator() - .beginStructureBlock(5, 6, 5, false).addController("Front bottom center") - .addCasingInfoMin("Clean Stainless Steel Casings", 70, false) - .addOtherStructurePart("Borosilicate Glass", "Hollow two middle layers") - .addStructureInfo("The glass tier limits the Energy Input tier") - .addStructureInfo("The dirt is from RandomThings, must be tilled") - .addStructureInfo("Purple lamps are from ProjectRedIllumination. They can be powered and/or inverted") - .addMaintenanceHatch("Any casing (Except inner bottom ones)", 1) - .addInputBus("Any casing (Except inner bottom ones)", 1) - .addOutputBus("Any casing (Except inner bottom ones)", 1) - .addInputHatch("Any casing (Except inner bottom ones)", 1) - .addEnergyHatch("Any casing (Except inner bottom ones)", 1).toolTipFinisher(Tags.MODNAME); + tt.addMachineType("Crop Farm") + .addInfo("Controller block for the Extreme Industrial Greenhouse") + .addInfo(Author) + .addInfo("Grow your crops like a chad !") + .addInfo("Use screwdriver to enable/change/disable setup mode") + .addInfo("Use screwdriver while sneaking to enable/disable IC2 mode") + .addInfo("Use wire cutters to give incoming IC2 crops 0 humidity") + .addInfo("Uses 1000L of water per crop per operation") + .addInfo("If there are >= 1000 crops -> Uses 1L of Weed-EX 9000 per crop per second") + .addInfo("Otherwise, around 1% of crops will die each operation") + .addInfo("You can insert fertilizer each operation to get more drops (max +400%)") + .addInfo("-------------------- SETUP MODE --------------------") + .addInfo("Does not take power") + .addInfo("There are two modes: input / output") + .addInfo("Input mode: machine will take seeds from input bus and plant them") + .addInfo("[IC2] You need to also input block that is required under the crop") + .addInfo("Output mode: machine will take planted seeds and output them") + .addInfo("-------------------- NORMAL CROPS --------------------") + .addInfo("Minimal tier: " + voltageTooltipFormatted(4)) + .addInfo("Starting with 1 slot") + .addInfo("Every slot gives 64 crops") + .addInfo("Every tier past " + voltageTooltipFormatted(4) + ", slots are multiplied by 2") + .addInfo("Base process time: 5 sec") + .addInfo( + "Process time is divided by number of tiers past " + voltageTooltipFormatted(3) + " (Minimum 1 sec)") + .addInfo("All crops are grown at the end of the operation") + .addInfo("Will automatically craft seeds if they are not dropped") + .addInfo("1 Fertilizer per 1 crop +200%") + .addInfo("-------------------- IC2 CROPS --------------------") + .addInfo("Minimal tier: " + voltageTooltipFormatted(6)) + .addInfo("Need " + voltageTooltipFormatted(6) + " glass tier") + .addInfo("Starting with 4 slots") + .addInfo("Every slot gives 1 crop") + .addInfo("Every tier past " + voltageTooltipFormatted(6) + ", slots are multiplied by 4") + .addInfo("Process time: 5 sec") + .addInfo("All crops are accelerated by x32 times") + .addInfo("1 Fertilizer per 1 crop +10%") + .addInfo(StructureHologram) + .addSeparator() + .beginStructureBlock(5, 6, 5, false) + .addController("Front bottom center") + .addCasingInfoMin("Clean Stainless Steel Casings", 70, false) + .addOtherStructurePart("Borosilicate Glass", "Hollow two middle layers") + .addStructureInfo("The glass tier limits the Energy Input tier") + .addStructureInfo("The dirt is from RandomThings, must be tilled") + .addStructureInfo("Purple lamps are from ProjectRedIllumination. They can be powered and/or inverted") + .addMaintenanceHatch("Any casing (Except inner bottom ones)", 1) + .addInputBus("Any casing (Except inner bottom ones)", 1) + .addOutputBus("Any casing (Except inner bottom ones)", 1) + .addInputHatch("Any casing (Except inner bottom ones)", 1) + .addEnergyHatch("Any casing (Except inner bottom ones)", 1) + .toolTipFinisher(Tags.MODNAME); return tt; } @@ -292,7 +293,10 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse aNBT.setBoolean("isIC2Mode", isIC2Mode); aNBT.setBoolean("isNoHumidity", isNoHumidity); aNBT.setInteger("mStorageSize", mStorage.size()); - for (int i = 0; i < mStorage.size(); i++) aNBT.setTag("mStorage." + i, mStorage.get(i).toNBTTagCompound()); + for (int i = 0; i < mStorage.size(); i++) aNBT.setTag( + "mStorage." + i, + mStorage.get(i) + .toNBTTagCompound()); } @Override @@ -320,7 +324,8 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (aBaseMetaTileEntity.isActive() && aTick % 40 == 0) { int[] abc = new int[] { 0, -2, 2 }; int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); + this.getExtendedFacing() + .getWorldOffset(abc, xyz); xyz[0] += aBaseMetaTileEntity.getXCoord(); xyz[1] += aBaseMetaTileEntity.getYCoord(); xyz[2] += aBaseMetaTileEntity.getZCoord(); @@ -445,8 +450,8 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse ArrayList<ItemStack> inputs = getStoredInputs(); for (ItemStack i : inputs) { if ((i.getItem() == Items.dye && i.getItemDamage() == 15) - || (forestryfertilizer != null && (i.getItem() == forestryfertilizer)) - || (GT_Utility.areStacksEqual(i, Ic2Items.fertilizer))) { + || (forestryfertilizer != null && (i.getItem() == forestryfertilizer)) + || (GT_Utility.areStacksEqual(i, Ic2Items.fertilizer))) { int used = Math.min(i.stackSize, maxboost - boost); i.stackSize -= used; boost += used; @@ -460,14 +465,16 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (glasTier < 6) return false; this.mMaxProgresstime = 100; List<ItemStack> outputs = new ArrayList<>(); - for (int i = 0; i < Math.min(mMaxSlots, mStorage.size()); i++) - outputs.addAll(mStorage.get(i).getIC2Drops(((double) this.mMaxProgresstime * 32d) * multiplier)); + for (int i = 0; i < Math.min(mMaxSlots, mStorage.size()); i++) outputs.addAll( + mStorage.get(i) + .getIC2Drops(((double) this.mMaxProgresstime * 32d) * multiplier)); this.mOutputItems = outputs.toArray(new ItemStack[0]); } else { this.mMaxProgresstime = Math.max(20, 100 / (tier - 3)); // Min 1 s List<ItemStack> outputs = new ArrayList<>(); for (int i = 0; i < Math.min(mMaxSlots, mStorage.size()); i++) { - for (ItemStack drop : mStorage.get(i).getDrops()) { + for (ItemStack drop : mStorage.get(i) + .getDrops()) { ItemStack s = drop.copy(); s.stackSize = (int) ((double) s.stackSize * multiplier); outputs.add(s); @@ -518,21 +525,25 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse @Override public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.bindPlayerInventory(buildContext.getPlayer(), new Pos2d(7, 83), this.getGUITextureSet().getItemSlot()); + builder.bindPlayerInventory( + buildContext.getPlayer(), + new Pos2d(7, 83), + this.getGUITextureSet() + .getItemSlot()); } private static final UIInfo<?, ?> GreenhouseUI = createKTMetaTileEntityUI( - KT_ModulaUIContainer_ExtremeIndustrialGreenhouse::new); + KT_ModulaUIContainer_ExtremeIndustrialGreenhouse::new); @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) return true; GreenhouseUI.open( - aPlayer, - aBaseMetaTileEntity.getWorld(), - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()); + aPlayer, + aBaseMetaTileEntity.getWorld(), + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord()); return true; } @@ -541,7 +552,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse final WeakReference<GT_MetaTileEntity_ExtremeIndustrialGreenhouse> parent; public KT_ModulaUIContainer_ExtremeIndustrialGreenhouse(ModularUIContext context, ModularWindow mainWindow, - GT_MetaTileEntity_ExtremeIndustrialGreenhouse mte) { + GT_MetaTileEntity_ExtremeIndustrialGreenhouse mte) { super(context, mainWindow); parent = new WeakReference<>(mte); } @@ -576,8 +587,10 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(143, 75) - .setEnabled(widget -> !isFixed.apply(widget))); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4) + .setSize(143, 75) + .setEnabled(widget -> !isFixed.apply(widget))); buildContext.addSyncedWindow(CONFIGURATION_WINDOW_ID, this::createConfigurationWindow); EntityPlayer player = buildContext.getPlayer(); @@ -585,33 +598,32 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse // Slot is not needed builder.widget( - new DynamicPositionedColumn().setSynced(false).widget( - new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { - if (works) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); + new DynamicPositionedColumn().setSynced(false) + .widget(new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { + if (works) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); - if (!(player instanceof EntityPlayerMP)) return; - String tChat = GT_Utility.trans("090", "Machine Processing: ") - + (works ? GT_Utility.trans("088", "Enabled") - : GT_Utility.trans("087", "Disabled")); - if (hasAlternativeModeText()) tChat = getAlternativeModeText(); - GT_Utility.sendChatToPlayer(player, tChat); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18) - .addTooltip("Working status")) - .widget( - new ButtonWidget() - .setOnClick( - (clickData, widget) -> { - if (!widget.isClient()) - widget.getContext().openSyncedWindow(CONFIGURATION_WINDOW_ID); - }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_CYCLIC) - .addTooltip("Configuration").setSize(18, 18)) - .setPos(151, 4)); + if (!(player instanceof EntityPlayerMP)) return; + String tChat = GT_Utility.trans("090", "Machine Processing: ") + + (works ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); + if (hasAlternativeModeText()) tChat = getAlternativeModeText(); + GT_Utility.sendChatToPlayer(player, tChat); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Working status")) + .widget( + new ButtonWidget().setOnClick( + (clickData, widget) -> { + if (!widget.isClient()) widget.getContext() + .openSyncedWindow(CONFIGURATION_WINDOW_ID); + }) + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .addTooltip("Configuration") + .setSize(18, 18)) + .setPos(151, 4)); ChangeableWidget cropsContainer = new ChangeableWidget(() -> createCropsContainerWidget(player)); @@ -627,30 +639,36 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse mMaxSlots = i; cropsContainer.notifyChangeNoSync(); } - }), builder).attachSyncer( + }), builder) + .attachSyncer( new FakeSyncWidget.ListSyncer<>( - () -> mStorage.stream().map(s -> s.input).collect(Collectors.toList()), - l -> { - drawables.clear(); - drawables.addAll(l); - if (cropsContainer.getChildren().size() > 0) IWidgetParent.forEachByLayer( - (IWidgetParent) cropsContainer.getChildren().get(0), - Widget::notifyTooltipChange); - }, - (buffer, i) -> { - try { - buffer.writeItemStackToBuffer(i); - } catch (IOException e) { - throw new RuntimeException(e); - } - }, - buffer -> { - try { - return buffer.readItemStackFromBuffer(); - } catch (IOException e) { - throw new RuntimeException(e); - } - }), + () -> mStorage.stream() + .map(s -> s.input) + .collect(Collectors.toList()), + l -> { + drawables.clear(); + drawables.addAll(l); + if (cropsContainer.getChildren() + .size() > 0) + IWidgetParent.forEachByLayer( + (IWidgetParent) cropsContainer.getChildren() + .get(0), + Widget::notifyTooltipChange); + }, + (buffer, i) -> { + try { + buffer.writeItemStackToBuffer(i); + } catch (IOException e) { + throw new RuntimeException(e); + } + }, + buffer -> { + try { + return buffer.readItemStackFromBuffer(); + } catch (IOException e) { + throw new RuntimeException(e); + } + }), builder)); final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); @@ -674,8 +692,8 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (input != null) { if (this.mMaxProgresstime > 0) { GT_Utility.sendChatToPlayer( - player, - EnumChatFormatting.RED + "Can't replace/insert while running !"); + player, + EnumChatFormatting.RED + "Can't replace/insert while running !"); return; } if (addCrop(input, -1, true)) { @@ -718,231 +736,262 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse addOutput(removed.input); GT_Utility.sendChatToPlayer(player, "Crop ejected !"); - }).setBackground( - () -> new IDrawable[] { getBaseMetaTileEntity().getGUITextureSet().getItemSlot(), - new ItemDrawable(drawables.size() > ID ? drawables.get(ID) : null) - .withFixedSize(16, 16, 1, 1), - new Text(drawables.size() > ID ? String.valueOf(drawables.get(ID).stackSize) : "") - .color(Color.WHITE.normal).shadow().alignment(Alignment.BottomRight) }) - .dynamicTooltip(() -> { - if (drawables.size() > ID) return Arrays.asList( - drawables.get(ID).getDisplayName(), - EnumChatFormatting.GRAY + "Left click to eject into input bus", - EnumChatFormatting.GRAY + "Right click to get into mouse", - EnumChatFormatting.GRAY + "Shift click to get into inventory", - EnumChatFormatting.GRAY + "Click with other crop in mouse to replace"); - return Collections.emptyList(); - }).setSize(18, 18)); + }) + .setBackground( + () -> new IDrawable[] { getBaseMetaTileEntity().getGUITextureSet() + .getItemSlot(), + new ItemDrawable(drawables.size() > ID ? drawables.get(ID) : null) + .withFixedSize(16, 16, 1, 1), + new Text(drawables.size() > ID ? String.valueOf(drawables.get(ID).stackSize) : "") + .color(Color.WHITE.normal) + .shadow() + .alignment(Alignment.BottomRight) }) + .dynamicTooltip(() -> { + if (drawables.size() > ID) return Arrays.asList( + drawables.get(ID) + .getDisplayName(), + EnumChatFormatting.GRAY + "Left click to eject into input bus", + EnumChatFormatting.GRAY + "Right click to get into mouse", + EnumChatFormatting.GRAY + "Shift click to get into inventory", + EnumChatFormatting.GRAY + "Click with other crop in mouse to replace"); + return Collections.emptyList(); + }) + .setSize(18, 18)); } cropsContainer.widget(row.setPos(0, i * 18)); } - return cropsContainer.setPos(10, 16).setSize(128, 60); + return cropsContainer.setPos(10, 16) + .setSize(128, 60); } protected ModularWindow createConfigurationWindow(final EntityPlayer player) { ModularWindow.Builder builder = ModularWindow.builder(200, 100); builder.setBackground(ModularUITextures.VANILLA_BACKGROUND); builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC).setPos(5, 5).setSize(16, 16)) - .widget(new TextWidget("Configuration").setPos(25, 9)) - .widget(ButtonWidget.closeWindowButton(true).setPos(185, 3)) - .widget( - new Column().widget( - new CycleButtonWidget().setLength(3).setGetter(() -> setupphase).setSetter(val -> { - if (!(player instanceof EntityPlayerMP)) return; - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer( - player, - "You can't enable/disable setup if the machine is working!"); - return; - } - this.setupphase = val; + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setPos(5, 5) + .setSize(16, 16)) + .widget(new TextWidget("Configuration").setPos(25, 9)) + .widget( + ButtonWidget.closeWindowButton(true) + .setPos(185, 3)) + .widget( + new Column().widget( + new CycleButtonWidget().setLength(3) + .setGetter(() -> setupphase) + .setSetter(val -> { + if (!(player instanceof EntityPlayerMP)) return; + if (this.mMaxProgresstime > 0) { + GT_Utility.sendChatToPlayer( + player, + "You can't enable/disable setup if the machine is working!"); + return; + } + this.setupphase = val; + GT_Utility.sendChatToPlayer( + player, + "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." + : (this.setupphase == 2 ? "setup mode (output)." : "normal operation."))); + }) + .addTooltip(0, new Text("Operating").color(Color.GREEN.dark(3))) + .addTooltip(1, new Text("Input").color(Color.YELLOW.dark(3))) + .addTooltip(2, new Text("Output").color(Color.YELLOW.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Operating").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : i == 1 ? new Text("Input").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Output").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("Setup mode")) + .widget( + new CycleButtonWidget().setLength(2) + .setGetter(() -> isIC2Mode ? 1 : 0) + .setSetter(val -> { + if (!(player instanceof EntityPlayerMP)) return; + if (this.mMaxProgresstime > 0) { GT_Utility.sendChatToPlayer( - player, - "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." - : (this.setupphase == 2 ? "setup mode (output)." - : "normal operation."))); - }).addTooltip(0, new Text("Operating").color(Color.GREEN.dark(3))) - .addTooltip(1, new Text("Input").color(Color.YELLOW.dark(3))) - .addTooltip(2, new Text("Output").color(Color.YELLOW.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), - i == 0 ? new Text("Operating").color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : i == 1 ? new Text("Input").color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Output").color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("Setup mode")) - .widget( - new CycleButtonWidget().setLength(2).setGetter(() -> isIC2Mode ? 1 : 0) - .setSetter(val -> { - if (!(player instanceof EntityPlayerMP)) return; - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer( - player, - "You can't change IC2 mode if the machine is working!"); - return; - } - if (!mStorage.isEmpty()) { - GT_Utility.sendChatToPlayer( - player, - "You can't change IC2 mode if there are seeds inside!"); - return; - } - this.isIC2Mode = val == 1; - GT_Utility.sendChatToPlayer( - player, - "IC2 mode is now " - + (this.isIC2Mode ? "enabled" : "disabled.")); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC - .withFixedSize(18, 18), - i == 0 ? new Text("Disabled").color(Color.RED.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Enabled").color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("IC2 mode")) - .widget( - new CycleButtonWidget().setLength(2).setGetter(() -> isNoHumidity ? 1 : 0) - .setSetter(val -> { - if (!(player instanceof EntityPlayerMP)) return; - isNoHumidity = val == 1; - GT_Utility.sendChatToPlayer( - player, - "Give incoming crops no humidity " + isNoHumidity); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC - .withFixedSize(18, 18), - i == 0 ? new Text("Disabled").color(Color.RED.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Enabled").color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("No Humidity mode")) - .setEnabled(widget -> !getBaseMetaTileEntity().isActive()).setPos(10, 30)) - .widget( - new Column().widget(new TextWidget("Setup mode").setSize(100, 18)) - .widget(new TextWidget("IC2 mode").setSize(100, 18)) - .widget(new TextWidget("No Humidity mode").setSize(100, 18)) - .setEnabled(widget -> !getBaseMetaTileEntity().isActive()).setPos(80, 30)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS).setSize(18, 18) - .setPos(10, 30) - .addTooltip( - new Text("Can't change configuration when running !").color(Color.RED.dark(3))) - .setEnabled(widget -> getBaseMetaTileEntity().isActive())); + player, + "You can't change IC2 mode if the machine is working!"); + return; + } + if (!mStorage.isEmpty()) { + GT_Utility.sendChatToPlayer( + player, + "You can't change IC2 mode if there are seeds inside!"); + return; + } + this.isIC2Mode = val == 1; + GT_Utility.sendChatToPlayer( + player, + "IC2 mode is now " + (this.isIC2Mode ? "enabled" : "disabled.")); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Disabled").color(Color.RED.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Enabled").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("IC2 mode")) + .widget( + new CycleButtonWidget().setLength(2) + .setGetter(() -> isNoHumidity ? 1 : 0) + .setSetter(val -> { + if (!(player instanceof EntityPlayerMP)) return; + isNoHumidity = val == 1; + GT_Utility.sendChatToPlayer(player, "Give incoming crops no humidity " + isNoHumidity); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Disabled").color(Color.RED.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Enabled").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("No Humidity mode")) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(10, 30)) + .widget( + new Column().widget(new TextWidget("Setup mode").setSize(100, 18)) + .widget(new TextWidget("IC2 mode").setSize(100, 18)) + .widget(new TextWidget("No Humidity mode").setSize(100, 18)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(80, 30)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS) + .setSize(18, 18) + .setPos(10, 30) + .addTooltip(new Text("Can't change configuration when running !").color(Color.RED.dark(3))) + .setEnabled(widget -> getBaseMetaTileEntity().isActive())); return builder.build(); } @Override protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { - screenElements.setSynced(false).setSpace(0).setPos(10, 7); + screenElements.setSynced(false) + .setSpace(0) + .setPos(10, 7); screenElements.widget( - new DynamicPositionedRow().setSynced(false) - .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) - .widget(new DynamicTextWidget(() -> { - if (getBaseMetaTileEntity().isActive()) - return new Text("Working !").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().isAllowedToWork()) - return new Text("Enabled").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().wasShutdown()) - return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); - else return new Text("Disabled").color(Color.RED.dark(3)); - })).setEnabled(isFixed)); + new DynamicPositionedRow().setSynced(false) + .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) + .widget(new DynamicTextWidget(() -> { + if (getBaseMetaTileEntity().isActive()) return new Text("Working !").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().isAllowedToWork()) + return new Text("Enabled").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().wasShutdown()) + return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); + else return new Text("Disabled").color(Color.RED.dark(3)); + })) + .setEnabled(isFixed)); screenElements - .widget( - new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + .widget( + new TextWidget(GT_Utility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mWrench)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("133", "Screws are loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + .widget( + new TextWidget(GT_Utility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mScrewdriver)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("134", "Something is stuck.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSoftHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("135", "Platings are dented.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mHardHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + .widget( + new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSolderingTool)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + .widget( + new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mCrowbar)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + .widget( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); } @Override public String[] getInfoData() { List<String> info = new ArrayList<>( - Arrays.asList( - "Running in mode: " + EnumChatFormatting.GREEN - + (setupphase == 0 ? (isIC2Mode ? "IC2 crops" : "Normal crops") - : ("Setup mode " + (setupphase == 1 ? "(input)" : "(output)"))) - + EnumChatFormatting.RESET, - "Uses " + waterusage + "L/operation of water", - "Uses " + weedexusage + "L/second of Weed-EX 9000", - "Max slots: " + EnumChatFormatting.GREEN + this.mMaxSlots + EnumChatFormatting.RESET, - "Used slots: " - + ((mStorage.size() > mMaxSlots) ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) - + this.mStorage.size() - + EnumChatFormatting.RESET)); + Arrays.asList( + "Running in mode: " + EnumChatFormatting.GREEN + + (setupphase == 0 ? (isIC2Mode ? "IC2 crops" : "Normal crops") + : ("Setup mode " + (setupphase == 1 ? "(input)" : "(output)"))) + + EnumChatFormatting.RESET, + "Uses " + waterusage + "L/operation of water", + "Uses " + weedexusage + "L/second of Weed-EX 9000", + "Max slots: " + EnumChatFormatting.GREEN + this.mMaxSlots + EnumChatFormatting.RESET, + "Used slots: " + ((mStorage.size() > mMaxSlots) ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) + + this.mStorage.size() + + EnumChatFormatting.RESET)); HashMap<String, Integer> storageList = new HashMap<>(); for (GreenHouseSlot greenHouseSlot : mStorage) { if (!greenHouseSlot.isValid) continue; StringBuilder a = new StringBuilder( - EnumChatFormatting.GREEN + "x" - + greenHouseSlot.input.stackSize - + " " - + greenHouseSlot.input.getDisplayName()); + EnumChatFormatting.GREEN + "x" + + greenHouseSlot.input.stackSize + + " " + + greenHouseSlot.input.getDisplayName()); if (this.isIC2Mode) { - a.append(" | Humidity: ").append(greenHouseSlot.noHumidity ? 0 : 12); + a.append(" | Humidity: ") + .append(greenHouseSlot.noHumidity ? 0 : 12); } a.append(EnumChatFormatting.RESET); storageList.merge(a.toString(), 1, Integer::sum); } storageList.forEach((k, v) -> info.add("x" + v + " " + k)); - if (mStorage.size() > mMaxSlots) info.add( - EnumChatFormatting.DARK_RED + "There are too many crops inside to run !" + EnumChatFormatting.RESET); + if (mStorage.size() > mMaxSlots) info + .add(EnumChatFormatting.DARK_RED + "There are too many crops inside to run !" + EnumChatFormatting.RESET); info.addAll(Arrays.asList(super.getInfoData())); return info.toArray(new String[0]); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { if (aSide == aFacing) { if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).extFacing().glow() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).extFacing().glow() - .build() }; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW) + .extFacing() + .glow() + .build() }; } return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; } @@ -952,7 +1001,10 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse private boolean addCrop(ItemStack input, int slot, boolean simulate) { if (!isIC2Mode && !simulate) for (GreenHouseSlot g : mStorage) if (g.input.stackSize < 64 && GT_Utility.areStacksEqual(g.input, input)) { - g.addAll(this.getBaseMetaTileEntity().getWorld(), input); + g.addAll( + this.getBaseMetaTileEntity() + .getWorld(), + input); if (input.stackSize == 0) return true; } GreenHouseSlot h = new GreenHouseSlot(this, simulate ? input.copy() : input, isIC2Mode, isNoHumidity); @@ -1002,22 +1054,33 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse aNBT.setInteger("crop", Block.getIdFromBlock(crop)); if (customDrops != null && customDrops.size() > 0) { aNBT.setInteger("customDropsCount", customDrops.size()); - for (int i = 0; i < customDrops.size(); i++) - aNBT.setTag("customDrop." + i, customDrops.get(i).writeToNBT(new NBTTagCompound())); + for (int i = 0; i < customDrops.size(); i++) aNBT.setTag( + "customDrop." + i, + customDrops.get(i) + .writeToNBT(new NBTTagCompound())); } aNBT.setInteger("dropscount", drops.size()); - for (int i = 0; i < drops.size(); i++) - aNBT.setTag("drop." + i, drops.get(i).writeToNBT(new NBTTagCompound())); + for (int i = 0; i < drops.size(); i++) aNBT.setTag( + "drop." + i, + drops.get(i) + .writeToNBT(new NBTTagCompound())); aNBT.setInteger("optimalgrowth", optimalgrowth); aNBT.setBoolean("needsreplanting", needsreplanting); } else { if (undercrop != null) aNBT.setTag("undercrop", undercrop.writeToNBT(new NBTTagCompound())); aNBT.setInteger("generationscount", generations.size()); for (int i = 0; i < generations.size(); i++) { - aNBT.setInteger("generation." + i + ".count", generations.get(i).size()); - for (int j = 0; j < generations.get(i).size(); j++) aNBT.setTag( + aNBT.setInteger( + "generation." + i + ".count", + generations.get(i) + .size()); + for (int j = 0; j < generations.get(i) + .size(); j++) + aNBT.setTag( "generation." + i + "." + j, - generations.get(i).get(j).writeToNBT(new NBTTagCompound())); + generations.get(i) + .get(j) + .writeToNBT(new NBTTagCompound())); } aNBT.setInteger("growthticks", growthticks); aNBT.setBoolean("noHumidity", noHumidity); @@ -1051,7 +1114,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse for (int i = 0; i < aNBT.getInteger("generationscount"); i++) { generations.add(new ArrayList<>()); for (int j = 0; j < aNBT.getInteger("generation." + i + ".count"); j++) generations.get(i) - .add(ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("generation." + i + "." + j))); + .add(ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("generation." + i + "." + j))); } growthticks = aNBT.getInteger("growthticks"); noHumidity = aNBT.getBoolean("noHumidity"); @@ -1073,10 +1136,14 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (recipe != null) return true; out: for (ItemStack drop : drops) { recipeInput = drop; - for (int j = 0; j < CraftingManager.getInstance().getRecipeList().size(); j++) { - recipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(j); + for (int j = 0; j < CraftingManager.getInstance() + .getRecipeList() + .size(); j++) { + recipe = (IRecipe) CraftingManager.getInstance() + .getRecipeList() + .get(j); if (recipe.matches(this, world) - && GT_Utility.areStacksEqual(recipe.getCraftingResult(this), input)) { + && GT_Utility.areStacksEqual(recipe.getCraftingResult(this), input)) { break out; } else recipe = null; } @@ -1105,9 +1172,10 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {} public GreenHouseSlot(GT_MetaTileEntity_ExtremeIndustrialGreenhouse tileEntity, ItemStack input, boolean IC2, - boolean noHumidity) { + boolean noHumidity) { super(null, 3, 3); - World world = tileEntity.getBaseMetaTileEntity().getWorld(); + World world = tileEntity.getBaseMetaTileEntity() + .getWorld(); this.input = input.copy(); this.isValid = false; if (IC2) { @@ -1166,7 +1234,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse } public void GreenHouseSlotIC2(GT_MetaTileEntity_ExtremeIndustrialGreenhouse tileEntity, World world, - ItemStack input, boolean noHumidity) { + ItemStack input, boolean noHumidity) { if (!ItemList.IC2_Crop_Seeds.isStackEqual(input, true, true)) return; this.isIC2Crop = true; this.noHumidity = noHumidity; @@ -1181,14 +1249,14 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse short tDamage = (short) item.getDamage(a); if (item instanceof GT_Item_Ores && tDamage > 0) { if (!world.setBlock( - x, - y, - z, - b, - GT_TileEntity_Ores.getHarvestData( - tDamage, - ((GT_Block_Ores_Abstract) b).getBaseBlockHarvestLevel(tDamage % 16000 / 1000)), - 0)) { + x, + y, + z, + b, + GT_TileEntity_Ores.getHarvestData( + tDamage, + ((GT_Block_Ores_Abstract) b).getBaseBlockHarvestLevel(tDamage % 16000 / 1000)), + 0)) { return false; } GT_TileEntity_Ores tTileEntity = (GT_TileEntity_Ores) world.getTileEntity(x, y, z); @@ -1208,14 +1276,18 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse byte re = nbt.getByte("resistance"); int[] abc = new int[] { 0, -2, 3 }; int[] xyz = new int[] { 0, 0, 0 }; - tileEntity.getExtendedFacing().getWorldOffset(abc, xyz); - xyz[0] += tileEntity.getBaseMetaTileEntity().getXCoord(); - xyz[1] += tileEntity.getBaseMetaTileEntity().getYCoord(); - xyz[2] += tileEntity.getBaseMetaTileEntity().getZCoord(); + tileEntity.getExtendedFacing() + .getWorldOffset(abc, xyz); + xyz[0] += tileEntity.getBaseMetaTileEntity() + .getXCoord(); + xyz[1] += tileEntity.getBaseMetaTileEntity() + .getYCoord(); + xyz[2] += tileEntity.getBaseMetaTileEntity() + .getZCoord(); boolean cheating = false; try { if (world.getBlock(xyz[0], xyz[1] - 2, xyz[2]) != GregTech_API.sBlockCasings4 - || world.getBlockMetadata(xyz[0], xyz[1] - 2, xyz[2]) != 1) { + || world.getBlockMetadata(xyz[0], xyz[1] - 2, xyz[2]) != 1) { // no cheating = true; return; @@ -1287,7 +1359,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse int rate = te.calcGrowthRate(); if (rate == 0) return; // should not be possible with those stats growthticks = (int) Math.ceil( - ((double) dur / (double) rate) * (double) cc.maxSize() * (double) TileEntityCrop.tickRate); + ((double) dur / (double) rate) * (double) cc.maxSize() * (double) TileEntityCrop.tickRate); if (growthticks < 1) growthticks = 1; if (tobeused != null) tobeused.stackSize--; @@ -1329,9 +1401,14 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse } copied.clear(); for (Map.Entry<String, Double> entry : dropprogress.entrySet()) if (entry.getValue() >= 1d) { - copied.add(dropstacks.get(entry.getKey()).copy()); - copied.get(copied.size() - 1).stackSize = entry.getValue().intValue(); - entry.setValue(entry.getValue() - (double) entry.getValue().intValue()); + copied.add( + dropstacks.get(entry.getKey()) + .copy()); + copied.get(copied.size() - 1).stackSize = entry.getValue() + .intValue(); + entry.setValue( + entry.getValue() - (double) entry.getValue() + .intValue()); } return copied; } diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java index a17af113c0..d9e368af89 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java @@ -82,7 +82,7 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; public class GT_MetaTileEntity_MegaIndustrialApiary - extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_MegaIndustrialApiary> implements ISurvivalConstructable { + extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_MegaIndustrialApiary> implements ISurvivalConstructable { private byte mGlassTier = 0; private int mCasing = 0; @@ -99,7 +99,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary private static final int MEGA_APIARY_STORAGE_VERSION = 2; private static final String[][] struct = transpose( - new String[][] { // spotless:off + new String[][] { // spotless:off {" "," "," "," HHH "," HHAAAHH "," HAPLPAH "," HAPAAAPAH "," HALAAALAH "," HAPAAAPAH "," HAPLPAH "," HHAAAHH "," HHH "," "," "," "}, {" "," "," GGG "," GGG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GGG "," "," "}, {" "," HHH "," HHH HHH "," H GH "," H H "," H H "," H H "," H H "," H H "," H H "," H H "," HG GH "," HHH HHH "," HHH "," "}, @@ -120,63 +120,74 @@ public class GT_MetaTileEntity_MegaIndustrialApiary });// spotless:on private static final IStructureDefinition<GT_MetaTileEntity_MegaIndustrialApiary> STRUCTURE_DEFINITION = StructureDefinition - .<GT_MetaTileEntity_MegaIndustrialApiary>builder().addShape(STRUCTURE_PIECE_MAIN, struct) - .addShape( - STRUCTURE_PIECE_MAIN_SURVIVAL, - Arrays.stream(struct) - .map( - sa -> Arrays.stream(sa).map(s -> s.replaceAll("W", " ").replaceAll("F", " ")) - .toArray(String[]::new)) - .toArray(String[][]::new)) - .addElement( - 'A', - LoaderReference.Bartworks - ? BorosilicateGlass.ofBoroGlass((byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier) - : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0))) - .addElement('B', ofChain(ofBlockAnyMeta(Blocks.dirt, 0), ofBlock(Blocks.grass, 0))) - .addElement( - 'G', - buildHatchAdder(GT_MetaTileEntity_MegaIndustrialApiary.class) - .atLeast(InputBus, OutputBus, Energy, Maintenance).casingIndex(CASING_INDEX).dot(1) - .buildAndChain(onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings1, 10)))) - .addElement( - 'H', - ofBlocksMap( - Collections.singletonMap( - Blocks.planks, - IntStream.rangeClosed(0, 5).boxed().collect(Collectors.toList())), - Blocks.planks, - 5)) - .addElement( - 'I', - ofBlocksMap( - Collections.singletonMap( - Blocks.wooden_slab, - IntStream.rangeClosed(0, 5).boxed().collect(Collectors.toList())), - Blocks.wooden_slab, - 5)) - .addElement('J', ofBlock(PluginApiculture.blocks.apiculture, BlockApicultureType.APIARY.getMeta())) - .addElement('K', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.PLAIN.ordinal())) - .addElement('L', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HYGRO.ordinal())) - .addElement('N', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.STABILIZER.ordinal())) - .addElement('O', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HEATER.ordinal())) - .addElement('P', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.FAN.ordinal())) - .addElement('W', ofBlock(Blocks.water, 0)) - .addElement('F', new IStructureElementNoPlacement<GT_MetaTileEntity_MegaIndustrialApiary>() { - - @Override - public boolean check(GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z) { - mte.flowerCheck(world, x, y, z); - return true; - } + .<GT_MetaTileEntity_MegaIndustrialApiary>builder() + .addShape(STRUCTURE_PIECE_MAIN, struct) + .addShape( + STRUCTURE_PIECE_MAIN_SURVIVAL, + Arrays.stream(struct) + .map( + sa -> Arrays.stream(sa) + .map( + s -> s.replaceAll("W", " ") + .replaceAll("F", " ")) + .toArray(String[]::new)) + .toArray(String[][]::new)) + .addElement( + 'A', + LoaderReference.Bartworks + ? BorosilicateGlass.ofBoroGlass((byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier) + : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0))) + .addElement('B', ofChain(ofBlockAnyMeta(Blocks.dirt, 0), ofBlock(Blocks.grass, 0))) + .addElement( + 'G', + buildHatchAdder(GT_MetaTileEntity_MegaIndustrialApiary.class) + .atLeast(InputBus, OutputBus, Energy, Maintenance) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings1, 10)))) + .addElement( + 'H', + ofBlocksMap( + Collections.singletonMap( + Blocks.planks, + IntStream.rangeClosed(0, 5) + .boxed() + .collect(Collectors.toList())), + Blocks.planks, + 5)) + .addElement( + 'I', + ofBlocksMap( + Collections.singletonMap( + Blocks.wooden_slab, + IntStream.rangeClosed(0, 5) + .boxed() + .collect(Collectors.toList())), + Blocks.wooden_slab, + 5)) + .addElement('J', ofBlock(PluginApiculture.blocks.apiculture, BlockApicultureType.APIARY.getMeta())) + .addElement('K', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.PLAIN.ordinal())) + .addElement('L', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HYGRO.ordinal())) + .addElement('N', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.STABILIZER.ordinal())) + .addElement('O', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HEATER.ordinal())) + .addElement('P', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.FAN.ordinal())) + .addElement('W', ofBlock(Blocks.water, 0)) + .addElement('F', new IStructureElementNoPlacement<GT_MetaTileEntity_MegaIndustrialApiary>() { - @Override - public boolean spawnHint(GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z, - ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 2 - 1); - return true; - } - }).build(); + @Override + public boolean check(GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z) { + mte.flowerCheck(world, x, y, z); + return true; + } + + @Override + public boolean spawnHint(GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z, + ItemStack trigger) { + StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 2 - 1); + return true; + } + }) + .build(); @SuppressWarnings("unused") public GT_MetaTileEntity_MegaIndustrialApiary(int aID, String aName, String aNameRegional) { @@ -209,8 +220,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary int built = survivialBuildPiece(STRUCTURE_PIECE_MAIN_SURVIVAL, stackSize, 7, 8, 0, elementBudget, env, true); if (built == -1) { GT_Utility.sendChatToPlayer( - env.getActor(), - EnumChatFormatting.GREEN + "Auto placing done ! Now go place the water and flowers yourself !"); + env.getActor(), + EnumChatFormatting.GREEN + "Auto placing done ! Now go place the water and flowers yourself !"); return 0; } return built; @@ -230,36 +241,52 @@ public class GT_MetaTileEntity_MegaIndustrialApiary protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Apiary") - .addInfo("Controller block for Industrial Apicultural Acclimatiser and Drone Domestication Station") - .addInfo(buildAuthorList("kuba6000", "Runakai")).addInfo("The ideal home for your bees") - .addInfo("AKA. Mega Apiary").addInfo("Use screwdriver to change primary mode (INPUT/OUTPUT/OPERATING)") - .addInfo("Use screwdriver + shift to change operation mode (NORMAL/SWARMER)") - .addInfo("--------------------- INPUT MODE ---------------------").addInfo("- Does not take power") - .addInfo("- Put your queens in the input bus to put them in the internal buffer") - .addInfo("-------------------- OUTPUT MODE ---------------------").addInfo("- Does not take power") - .addInfo("- Will give your bees back to output bus") - .addInfo("------------------- OPERATING MODE -------------------").addInfo("- NORMAL:") - .addInfo(" - For each " + voltageTooltipFormatted(6) + " amp you can insert 1 bee") - .addInfo(" - Processing time: 5 seconds") - .addInfo(" - Uses 1 " + voltageTooltipFormatted(6) + " amp per queen") - .addInfo(" - All bees are accelerated 64 times").addInfo(" - 8 production upgrades are applied") - .addInfo(" - Genetic Stabilizer upgrade applied") - .addInfo(" - Simulates perfect environment for your bees") - .addInfo(" - Additionally you can provide royal jelly to increase the outputs:") - .addInfo(" - 1 royal jelly grants 5% bonus per bee") - .addInfo(" - They will be consumed on each start of operation") - .addInfo(" - and be applied to that operation only").addInfo(" - Max bonus: 200%") - .addInfo("- SWARMER:").addInfo(" - You can only insert 1 queen") - .addInfo(" - It will slowly produce ignoble princesses") - .addInfo(" - Consumes 100 royal jelly per operation").addInfo(" - Base processing time: 1 minute") - .addInfo(" - Uses 1 amp " + voltageTooltipFormatted(5)).addInfo(" - Can overclock") - .addInfo(StructureHologram).addSeparator().beginStructureBlock(15, 17, 15, false) - .addController("Front Bottom Center").addCasingInfoMin("Bronze Plated Bricks", 190, false) - .addOtherStructurePart("Borosilicate Glass", "Look at the hologram") - .addStructureInfo("The glass tier limits the Energy Input tier") - .addOtherStructurePart("Flowers", "On dirt/grass", 2).addInputBus("Any casing", 1) - .addOutputBus("Any casing", 1).addEnergyHatch("Any casing", 1).addMaintenanceHatch("Any casing", 1) - .toolTipFinisher(Tags.MODNAME); + .addInfo("Controller block for Industrial Apicultural Acclimatiser and Drone Domestication Station") + .addInfo(buildAuthorList("kuba6000", "Runakai")) + .addInfo("The ideal home for your bees") + .addInfo("AKA. Mega Apiary") + .addInfo("Use screwdriver to change primary mode (INPUT/OUTPUT/OPERATING)") + .addInfo("Use screwdriver + shift to change operation mode (NORMAL/SWARMER)") + .addInfo("--------------------- INPUT MODE ---------------------") + .addInfo("- Does not take power") + .addInfo("- Put your queens in the input bus to put them in the internal buffer") + .addInfo("-------------------- OUTPUT MODE ---------------------") + .addInfo("- Does not take power") + .addInfo("- Will give your bees back to output bus") + .addInfo("------------------- OPERATING MODE -------------------") + .addInfo("- NORMAL:") + .addInfo(" - For each " + voltageTooltipFormatted(6) + " amp you can insert 1 bee") + .addInfo(" - Processing time: 5 seconds") + .addInfo(" - Uses 1 " + voltageTooltipFormatted(6) + " amp per queen") + .addInfo(" - All bees are accelerated 64 times") + .addInfo(" - 8 production upgrades are applied") + .addInfo(" - Genetic Stabilizer upgrade applied") + .addInfo(" - Simulates perfect environment for your bees") + .addInfo(" - Additionally you can provide royal jelly to increase the outputs:") + .addInfo(" - 1 royal jelly grants 5% bonus per bee") + .addInfo(" - They will be consumed on each start of operation") + .addInfo(" - and be applied to that operation only") + .addInfo(" - Max bonus: 200%") + .addInfo("- SWARMER:") + .addInfo(" - You can only insert 1 queen") + .addInfo(" - It will slowly produce ignoble princesses") + .addInfo(" - Consumes 100 royal jelly per operation") + .addInfo(" - Base processing time: 1 minute") + .addInfo(" - Uses 1 amp " + voltageTooltipFormatted(5)) + .addInfo(" - Can overclock") + .addInfo(StructureHologram) + .addSeparator() + .beginStructureBlock(15, 17, 15, false) + .addController("Front Bottom Center") + .addCasingInfoMin("Bronze Plated Bricks", 190, false) + .addOtherStructurePart("Borosilicate Glass", "Look at the hologram") + .addStructureInfo("The glass tier limits the Energy Input tier") + .addOtherStructurePart("Flowers", "On dirt/grass", 2) + .addInputBus("Any casing", 1) + .addOutputBus("Any casing", 1) + .addEnergyHatch("Any casing", 1) + .addMaintenanceHatch("Any casing", 1) + .toolTipFinisher(Tags.MODNAME); return tt; } @@ -270,7 +297,10 @@ public class GT_MetaTileEntity_MegaIndustrialApiary aNBT.setInteger("mPrimaryMode", mPrimaryMode); aNBT.setInteger("mSecondaryMode", mSecondaryMode); aNBT.setInteger("mStorageSize", mStorage.size()); - for (int i = 0; i < mStorage.size(); i++) aNBT.setTag("mStorage." + i, mStorage.get(i).toNBTTagCompound()); + for (int i = 0; i < mStorage.size(); i++) aNBT.setTag( + "mStorage." + i, + mStorage.get(i) + .toNBTTagCompound()); aNBT.setInteger("MEGA_APIARY_STORAGE_VERSION", MEGA_APIARY_STORAGE_VERSION); } @@ -348,7 +378,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (aBaseMetaTileEntity.isActive() && aTick % 100 == 0) { int[] abc = new int[] { 0, -2, 7 }; int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); + this.getExtendedFacing() + .getWorldOffset(abc, xyz); xyz[0] += aBaseMetaTileEntity.getXCoord(); xyz[1] += aBaseMetaTileEntity.getYCoord(); xyz[2] += aBaseMetaTileEntity.getZCoord(); @@ -444,7 +475,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary this.mOutputItems = stacks.toArray(new ItemStack[0]); } else { if (!depleteInput(PluginApiculture.items.royalJelly.getItemStack(64)) - || !depleteInput(PluginApiculture.items.royalJelly.getItemStack(36))) { + || !depleteInput(PluginApiculture.items.royalJelly.getItemStack(36))) { this.updateSlots(); return false; } @@ -452,7 +483,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (this.lEUt > 0) this.lEUt = -this.lEUt; this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - this.mOutputItems = new ItemStack[] { this.mStorage.get(0).createIgnobleCopy() }; + this.mOutputItems = new ItemStack[] { this.mStorage.get(0) + .createIgnobleCopy() }; this.updateSlots(); } return true; @@ -466,21 +498,20 @@ public class GT_MetaTileEntity_MegaIndustrialApiary public String[] getInfoData() { ArrayList<String> info = new ArrayList<>(Arrays.asList(super.getInfoData())); info.add( - "Running in mode: " + EnumChatFormatting.GOLD - + (mPrimaryMode == 0 ? "Input mode" - : (mPrimaryMode == 1 ? "Output mode" - : (mSecondaryMode == 0 ? "Operating mode (NORMAL)" - : "Operating mode (SWARMER)")))); + "Running in mode: " + EnumChatFormatting.GOLD + + (mPrimaryMode == 0 ? "Input mode" + : (mPrimaryMode == 1 ? "Output mode" + : (mSecondaryMode == 0 ? "Operating mode (NORMAL)" : "Operating mode (SWARMER)")))); info.add( - "Bee storage (" + EnumChatFormatting.GOLD - + mStorage.size() - + EnumChatFormatting.RESET - + "/" - + (mStorage.size() > mMaxSlots ? EnumChatFormatting.DARK_RED.toString() - : EnumChatFormatting.GOLD.toString()) - + mMaxSlots - + EnumChatFormatting.RESET - + "):"); + "Bee storage (" + EnumChatFormatting.GOLD + + mStorage.size() + + EnumChatFormatting.RESET + + "/" + + (mStorage.size() > mMaxSlots ? EnumChatFormatting.DARK_RED.toString() + : EnumChatFormatting.GOLD.toString()) + + mMaxSlots + + EnumChatFormatting.RESET + + "):"); HashMap<String, Integer> infos = new HashMap<>(); for (int i = 0; i < mStorage.size(); i++) { StringBuilder builder = new StringBuilder(); @@ -522,16 +553,27 @@ public class GT_MetaTileEntity_MegaIndustrialApiary @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { if (aSide == aFacing) { if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).extFacing().glow() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).extFacing().glow() - .build() }; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW) + .extFacing() + .glow() + .build() }; } return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; } @@ -553,21 +595,25 @@ public class GT_MetaTileEntity_MegaIndustrialApiary @Override public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.bindPlayerInventory(buildContext.getPlayer(), new Pos2d(7, 83), this.getGUITextureSet().getItemSlot()); + builder.bindPlayerInventory( + buildContext.getPlayer(), + new Pos2d(7, 83), + this.getGUITextureSet() + .getItemSlot()); } private static final UIInfo<?, ?> MegaApiaryUI = createKTMetaTileEntityUI( - KT_ModulaUIContainer_MegaIndustrialApiary::new); + KT_ModulaUIContainer_MegaIndustrialApiary::new); @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) return true; MegaApiaryUI.open( - aPlayer, - aBaseMetaTileEntity.getWorld(), - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()); + aPlayer, + aBaseMetaTileEntity.getWorld(), + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord()); return true; } @@ -576,7 +622,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary final WeakReference<GT_MetaTileEntity_MegaIndustrialApiary> parent; public KT_ModulaUIContainer_MegaIndustrialApiary(ModularUIContext context, ModularWindow mainWindow, - GT_MetaTileEntity_MegaIndustrialApiary mte) { + GT_MetaTileEntity_MegaIndustrialApiary mte) { super(context, mainWindow); parent = new WeakReference<>(mte); } @@ -597,7 +643,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary GT_Utility.sendChatToPlayer(aPlayer, EnumChatFormatting.RED + "Can't insert while running !"); return super.transferStackInSlot(aPlayer, aSlotIndex); } - World w = mte.getBaseMetaTileEntity().getWorld(); + World w = mte.getBaseMetaTileEntity() + .getWorld(); float t = (float) mte.getVoltageTierExact(); BeeSimulator bs = new BeeSimulator(aStack, w, t); if (bs.isValid) { @@ -618,8 +665,10 @@ public class GT_MetaTileEntity_MegaIndustrialApiary @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(143, 75) - .setEnabled(widget -> !isFixed.apply(widget))); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4) + .setSize(143, 75) + .setEnabled(widget -> !isFixed.apply(widget))); buildContext.addSyncedWindow(CONFIGURATION_WINDOW_ID, this::createConfigurationWindow); EntityPlayer player = buildContext.getPlayer(); @@ -627,33 +676,32 @@ public class GT_MetaTileEntity_MegaIndustrialApiary // Slot is not needed builder.widget( - new DynamicPositionedColumn().setSynced(false).widget( - new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { - if (works) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); + new DynamicPositionedColumn().setSynced(false) + .widget(new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { + if (works) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); - if (!(player instanceof EntityPlayerMP)) return; - String tChat = GT_Utility.trans("090", "Machine Processing: ") - + (works ? GT_Utility.trans("088", "Enabled") - : GT_Utility.trans("087", "Disabled")); - if (hasAlternativeModeText()) tChat = getAlternativeModeText(); - GT_Utility.sendChatToPlayer(player, tChat); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18) - .addTooltip("Working status")) - .widget( - new ButtonWidget() - .setOnClick( - (clickData, widget) -> { - if (!widget.isClient()) - widget.getContext().openSyncedWindow(CONFIGURATION_WINDOW_ID); - }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_CYCLIC) - .addTooltip("Configuration").setSize(18, 18)) - .setPos(151, 4)); + if (!(player instanceof EntityPlayerMP)) return; + String tChat = GT_Utility.trans("090", "Machine Processing: ") + + (works ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); + if (hasAlternativeModeText()) tChat = getAlternativeModeText(); + GT_Utility.sendChatToPlayer(player, tChat); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Working status")) + .widget( + new ButtonWidget().setOnClick( + (clickData, widget) -> { + if (!widget.isClient()) widget.getContext() + .openSyncedWindow(CONFIGURATION_WINDOW_ID); + }) + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .addTooltip("Configuration") + .setSize(18, 18)) + .setPos(151, 4)); ChangeableWidget beesContainer = new ChangeableWidget(() -> createBeesContainerWidget(player)); @@ -669,30 +717,36 @@ public class GT_MetaTileEntity_MegaIndustrialApiary mMaxSlots = i; beesContainer.notifyChangeNoSync(); } - }), builder).attachSyncer( + }), builder) + .attachSyncer( new FakeSyncWidget.ListSyncer<>( - () -> mStorage.stream().map(s -> s.queenStack).collect(Collectors.toList()), - l -> { - drawables.clear(); - drawables.addAll(l); - if (beesContainer.getChildren().size() > 0) IWidgetParent.forEachByLayer( - (IWidgetParent) beesContainer.getChildren().get(0), - Widget::notifyTooltipChange); - }, - (buffer, i) -> { - try { - buffer.writeItemStackToBuffer(i); - } catch (IOException e) { - throw new RuntimeException(e); - } - }, - buffer -> { - try { - return buffer.readItemStackFromBuffer(); - } catch (IOException e) { - throw new RuntimeException(e); - } - }), + () -> mStorage.stream() + .map(s -> s.queenStack) + .collect(Collectors.toList()), + l -> { + drawables.clear(); + drawables.addAll(l); + if (beesContainer.getChildren() + .size() > 0) + IWidgetParent.forEachByLayer( + (IWidgetParent) beesContainer.getChildren() + .get(0), + Widget::notifyTooltipChange); + }, + (buffer, i) -> { + try { + buffer.writeItemStackToBuffer(i); + } catch (IOException e) { + throw new RuntimeException(e); + } + }, + buffer -> { + try { + return buffer.readItemStackFromBuffer(); + } catch (IOException e) { + throw new RuntimeException(e); + } + }), builder)); final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); @@ -716,8 +770,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (input != null) { if (this.mMaxProgresstime > 0) { GT_Utility.sendChatToPlayer( - player, - EnumChatFormatting.RED + "Can't replace/insert while running !"); + player, + EnumChatFormatting.RED + "Can't replace/insert while running !"); return; } if (beeRoot.getType(input) == EnumBeeType.QUEEN) { @@ -768,25 +822,29 @@ public class GT_MetaTileEntity_MegaIndustrialApiary addOutput(removed.queenStack); GT_Utility.sendChatToPlayer(player, "Queen ejected !"); - }).setBackground( - () -> new IDrawable[] { getBaseMetaTileEntity().getGUITextureSet().getItemSlot(), - GT_UITextures.OVERLAY_SLOT_BEE_QUEEN, - new ItemDrawable(drawables.size() > ID ? drawables.get(ID) : null) - .withFixedSize(16, 16, 1, 1) }) - .dynamicTooltip(() -> { - if (drawables.size() > ID) return Arrays.asList( - drawables.get(ID).getDisplayName(), - EnumChatFormatting.GRAY + "Left click to eject into input bus", - EnumChatFormatting.GRAY + "Right click to get into mouse", - EnumChatFormatting.GRAY + "Shift click to get into inventory", - EnumChatFormatting.GRAY + "Click with other queen in mouse to replace"); - return Collections - .singletonList(EnumChatFormatting.GRAY + "Click with queen in mouse to insert"); - }).setSize(18, 18)); + }) + .setBackground( + () -> new IDrawable[] { getBaseMetaTileEntity().getGUITextureSet() + .getItemSlot(), GT_UITextures.OVERLAY_SLOT_BEE_QUEEN, + new ItemDrawable(drawables.size() > ID ? drawables.get(ID) : null) + .withFixedSize(16, 16, 1, 1) }) + .dynamicTooltip(() -> { + if (drawables.size() > ID) return Arrays.asList( + drawables.get(ID) + .getDisplayName(), + EnumChatFormatting.GRAY + "Left click to eject into input bus", + EnumChatFormatting.GRAY + "Right click to get into mouse", + EnumChatFormatting.GRAY + "Shift click to get into inventory", + EnumChatFormatting.GRAY + "Click with other queen in mouse to replace"); + return Collections + .singletonList(EnumChatFormatting.GRAY + "Click with queen in mouse to insert"); + }) + .setSize(18, 18)); } beesContainer.widget(row.setPos(0, i * 18)); } - beesContainer.setPos(10, 16).setSize(128, 60); + beesContainer.setPos(10, 16) + .setSize(128, 60); return beesContainer; } @@ -794,151 +852,155 @@ public class GT_MetaTileEntity_MegaIndustrialApiary ModularWindow.Builder builder = ModularWindow.builder(200, 100); builder.setBackground(ModularUITextures.VANILLA_BACKGROUND); builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC).setPos(5, 5).setSize(16, 16)) - .widget(new TextWidget("Configuration").setPos(25, 9)) - .widget(ButtonWidget.closeWindowButton(true).setPos(185, 3)) - .widget( - new Column().widget( - new CycleButtonWidget().setLength(3).setGetter(() -> mPrimaryMode).setSetter(val -> { - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer(player, "Can't change mode when running !"); - return; - } - mPrimaryMode = val; - - if (!(player instanceof EntityPlayerMP)) return; - switch (mPrimaryMode) { - case 0: - GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Input mode"); - break; - case 1: - GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Output mode"); - break; - case 2: - GT_Utility.sendChatToPlayer( - player, - "Changed primary mode to: Operating mode"); - break; - } - }).addTooltip(0, new Text("Input").color(Color.YELLOW.dark(3))) - .addTooltip(1, new Text("Output").color(Color.YELLOW.dark(3))) - .addTooltip(2, new Text("Operating").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), - i == 0 ? new Text("Input").color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : i == 1 ? new Text("Output") - .color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Operating") - .color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("Primary mode")) - .widget( - new CycleButtonWidget().setLength(2).setGetter(() -> mSecondaryMode) - .setSetter(val -> { - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer( - player, - "Can't change mode when running !"); - return; - } - - mSecondaryMode = val; - - if (!(player instanceof EntityPlayerMP)) return; - switch (mSecondaryMode) { - case 0: - GT_Utility.sendChatToPlayer( - player, - "Changed secondary mode to: Normal mode"); - break; - case 1: - GT_Utility.sendChatToPlayer( - player, - "Changed secondary mode to: Swarmer mode"); - break; - } - }).addTooltip(0, new Text("Normal").color(Color.GREEN.dark(3))) - .addTooltip(1, new Text("Swarmer").color(Color.YELLOW.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC - .withFixedSize(18, 18), - i == 0 ? new Text("Normal").color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Swarmer") - .color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("Secondary mode")) - .setEnabled(widget -> !getBaseMetaTileEntity().isActive()).setPos(10, 30)) - .widget( - new Column().widget(new TextWidget("Primary mode").setSize(100, 18)) - .widget(new TextWidget("Secondary mode").setSize(100, 18)) - .setEnabled(widget -> !getBaseMetaTileEntity().isActive()).setPos(80, 30)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS).setSize(18, 18) - .setPos(10, 30) - .addTooltip( - new Text("Can't change configuration when running !").color(Color.RED.dark(3))) - .setEnabled(widget -> getBaseMetaTileEntity().isActive())); + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setPos(5, 5) + .setSize(16, 16)) + .widget(new TextWidget("Configuration").setPos(25, 9)) + .widget( + ButtonWidget.closeWindowButton(true) + .setPos(185, 3)) + .widget( + new Column().widget( + new CycleButtonWidget().setLength(3) + .setGetter(() -> mPrimaryMode) + .setSetter(val -> { + if (this.mMaxProgresstime > 0) { + GT_Utility.sendChatToPlayer(player, "Can't change mode when running !"); + return; + } + mPrimaryMode = val; + + if (!(player instanceof EntityPlayerMP)) return; + switch (mPrimaryMode) { + case 0: + GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Input mode"); + break; + case 1: + GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Output mode"); + break; + case 2: + GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Operating mode"); + break; + } + }) + .addTooltip(0, new Text("Input").color(Color.YELLOW.dark(3))) + .addTooltip(1, new Text("Output").color(Color.YELLOW.dark(3))) + .addTooltip(2, new Text("Operating").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Input").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : i == 1 ? new Text("Output").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Operating").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("Primary mode")) + .widget( + new CycleButtonWidget().setLength(2) + .setGetter(() -> mSecondaryMode) + .setSetter(val -> { + if (this.mMaxProgresstime > 0) { + GT_Utility.sendChatToPlayer(player, "Can't change mode when running !"); + return; + } + + mSecondaryMode = val; + + if (!(player instanceof EntityPlayerMP)) return; + switch (mSecondaryMode) { + case 0: + GT_Utility.sendChatToPlayer(player, "Changed secondary mode to: Normal mode"); + break; + case 1: + GT_Utility.sendChatToPlayer(player, "Changed secondary mode to: Swarmer mode"); + break; + } + }) + .addTooltip(0, new Text("Normal").color(Color.GREEN.dark(3))) + .addTooltip(1, new Text("Swarmer").color(Color.YELLOW.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Normal").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Swarmer").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("Secondary mode")) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(10, 30)) + .widget( + new Column().widget(new TextWidget("Primary mode").setSize(100, 18)) + .widget(new TextWidget("Secondary mode").setSize(100, 18)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(80, 30)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS) + .setSize(18, 18) + .setPos(10, 30) + .addTooltip(new Text("Can't change configuration when running !").color(Color.RED.dark(3))) + .setEnabled(widget -> getBaseMetaTileEntity().isActive())); return builder.build(); } @Override protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { - screenElements.setSynced(false).setSpace(0).setPos(10, 7); + screenElements.setSynced(false) + .setSpace(0) + .setPos(10, 7); screenElements.widget( - new DynamicPositionedRow().setSynced(false) - .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) - .widget(new DynamicTextWidget(() -> { - if (flowersError) return new Text("No flowers !").color(Color.RED.dark(3)); - if (getBaseMetaTileEntity().isActive()) - return new Text("Working !").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().isAllowedToWork()) - return new Text("Enabled").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().wasShutdown()) - return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); - else return new Text("Disabled").color(Color.RED.dark(3)); - })).setEnabled(isFixed)); + new DynamicPositionedRow().setSynced(false) + .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) + .widget(new DynamicTextWidget(() -> { + if (flowersError) return new Text("No flowers !").color(Color.RED.dark(3)); + if (getBaseMetaTileEntity().isActive()) return new Text("Working !").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().isAllowedToWork()) + return new Text("Enabled").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().wasShutdown()) + return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); + else return new Text("Disabled").color(Color.RED.dark(3)); + })) + .setEnabled(isFixed)); screenElements - .widget( - new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + .widget( + new TextWidget(GT_Utility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mWrench)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("133", "Screws are loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + .widget( + new TextWidget(GT_Utility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mScrewdriver)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("134", "Something is stuck.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSoftHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("135", "Platings are dented.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mHardHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + .widget( + new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSolderingTool)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + .widget( + new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mCrowbar)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + .widget( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); } private static class BeeSimulator { @@ -971,15 +1033,18 @@ public class GT_MetaTileEntity_MegaIndustrialApiary int h = queen.getMaxHealth(); maxBeeCycles = (float) h / (1.f / mod); IBeeGenome genome = queen.getGenome(); - this.flowerType = genome.getFlowerProvider().getFlowerType(); + this.flowerType = genome.getFlowerProvider() + .getFlowerType(); IAlleleBeeSpecies primary = genome.getPrimary(); beeSpeed = genome.getSpeed() * beeModifier.getProductionModifier(null, 1.f); - genome.getPrimary().getProductChances() - .forEach((key, value) -> drops.add(new BeeDrop(key, value, beeSpeed, t))); - genome.getSecondary().getProductChances() - .forEach((key, value) -> drops.add(new BeeDrop(key, value / 2.f, beeSpeed, t))); + genome.getPrimary() + .getProductChances() + .forEach((key, value) -> drops.add(new BeeDrop(key, value, beeSpeed, t))); + genome.getSecondary() + .getProductChances() + .forEach((key, value) -> drops.add(new BeeDrop(key, value / 2.f, beeSpeed, t))); primary.getSpecialtyChances() - .forEach((key, value) -> specialDrops.add(new BeeDrop(key, value, beeSpeed, t))); + .forEach((key, value) -> specialDrops.add(new BeeDrop(key, value, beeSpeed, t))); } public BeeSimulator(NBTTagCompound tag) { @@ -997,7 +1062,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary else { IBee queen = beeRoot.getMember(this.queenStack); IBeeGenome genome = queen.getGenome(); - this.flowerType = genome.getFlowerProvider().getFlowerType(); + this.flowerType = genome.getFlowerProvider() + .getFlowerType(); } } @@ -1006,10 +1072,15 @@ public class GT_MetaTileEntity_MegaIndustrialApiary tag.setTag("queenStack", queenStack.writeToNBT(new NBTTagCompound())); tag.setBoolean("isValid", isValid); tag.setInteger("dropssize", drops.size()); - for (int i = 0; i < drops.size(); i++) tag.setTag("drops" + i, drops.get(i).toNBTTagCompound()); + for (int i = 0; i < drops.size(); i++) tag.setTag( + "drops" + i, + drops.get(i) + .toNBTTagCompound()); tag.setInteger("specialDropssize", specialDrops.size()); - for (int i = 0; i < specialDrops.size(); i++) - tag.setTag("specialDrops" + i, specialDrops.get(i).toNBTTagCompound()); + for (int i = 0; i < specialDrops.size(); i++) tag.setTag( + "specialDrops" + i, + specialDrops.get(i) + .toNBTTagCompound()); tag.setFloat("beeSpeed", beeSpeed); tag.setFloat("maxBeeCycles", maxBeeCycles); tag.setString("flowerType", flowerType); @@ -1022,15 +1093,18 @@ public class GT_MetaTileEntity_MegaIndustrialApiary drops.forEach(d -> dropProgress.merge(d, d.getAmount(timePassed / 550d), Double::sum)); specialDrops.forEach(d -> dropProgress.merge(d, d.getAmount(timePassed / 550d), Double::sum)); List<ItemStack> currentDrops = new ArrayList<>(); - dropProgress.entrySet().forEach(e -> { - double v = e.getValue(); - while (v > 1.f) { - int size = Math.min((int) v, 64); - currentDrops.add(e.getKey().get(size)); - v -= size; - e.setValue(v); - } - }); + dropProgress.entrySet() + .forEach(e -> { + double v = e.getValue(); + while (v > 1.f) { + int size = Math.min((int) v, 64); + currentDrops.add( + e.getKey() + .get(size)); + v -= size; + e.setValue(v); + } + }); return currentDrops; } |