From f51616bda220887fdd45c4bc951ff59e3398213a Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 28 Jan 2023 19:03:53 -0800 Subject: [ci skip] spotlessApply with the new settings --- src/main/java/kubatech/ClientProxy.java | 27 +- src/main/java/kubatech/CommonProxy.java | 29 +- src/main/java/kubatech/FMLEventHandler.java | 30 +- src/main/java/kubatech/Tags.java | 23 +- .../java/kubatech/api/ConstructableItemStack.java | 44 +- src/main/java/kubatech/api/LoaderReference.java | 1 + src/main/java/kubatech/api/Variables.java | 45 +- src/main/java/kubatech/api/enums/ItemList.java | 22 +- .../java/kubatech/api/helpers/EnderIOHelper.java | 28 +- src/main/java/kubatech/api/helpers/GTHelper.java | 2 +- .../java/kubatech/api/helpers/InfernalHelper.java | 34 +- .../kubatech/api/helpers/ReflectionHelper.java | 25 +- .../implementations/KubaTechGTMultiBlockBase.java | 34 +- src/main/java/kubatech/api/mobhandler/MobDrop.java | 43 +- .../api/network/CustomTileEntityPacket.java | 42 +- .../kubatech/api/network/LoadConfigPacket.java | 36 +- .../tileentity/CustomTileEntityPacketHandler.java | 24 +- src/main/java/kubatech/api/utils/FastRandom.java | 23 +- src/main/java/kubatech/api/utils/GSONUtils.java | 45 +- src/main/java/kubatech/api/utils/ItemID.java | 25 +- src/main/java/kubatech/api/utils/MobUtils.java | 33 +- src/main/java/kubatech/api/utils/ModUtils.java | 67 +-- src/main/java/kubatech/api/utils/StringUtils.java | 54 +- .../kubatech/client/effect/EntityRenderer.java | 54 +- .../client/effect/MegaApiaryBeesRenderer.java | 45 +- src/main/java/kubatech/commands/CommandBees.java | 40 +- src/main/java/kubatech/commands/CommandConfig.java | 30 +- .../java/kubatech/commands/CommandHandler.java | 41 +- src/main/java/kubatech/commands/CommandHelp.java | 35 +- src/main/java/kubatech/commands/CommandTea.java | 30 +- src/main/java/kubatech/config/Config.java | 93 ++- src/main/java/kubatech/config/OverridesConfig.java | 84 +-- src/main/java/kubatech/kubatech.java | 55 +- src/main/java/kubatech/loaders/BlockLoader.java | 27 +- src/main/java/kubatech/loaders/ItemLoader.java | 30 +- src/main/java/kubatech/loaders/MTLoader.java | 24 +- .../java/kubatech/loaders/MobRecipeLoader.java | 468 +++++++-------- src/main/java/kubatech/loaders/RecipeLoader.java | 219 ++++--- src/main/java/kubatech/loaders/TCLoader.java | 171 +++--- .../java/kubatech/loaders/block/BlockProxy.java | 28 +- .../loaders/block/IProxyTileEntityProvider.java | 1 + .../java/kubatech/loaders/block/KubaBlock.java | 124 ++-- .../java/kubatech/loaders/block/KubaItemBlock.java | 26 +- .../kubatech/loaders/block/blocks/TeaAcceptor.java | 25 +- .../java/kubatech/loaders/item/IItemProxyGUI.java | 4 +- src/main/java/kubatech/loaders/item/ItemProxy.java | 77 ++- src/main/java/kubatech/loaders/item/KubaItems.java | 48 +- src/main/java/kubatech/loaders/item/items/Tea.java | 26 +- .../kubatech/loaders/item/items/TeaCollection.java | 79 ++- .../kubatech/loaders/item/items/TeaIngredient.java | 26 +- .../kubatech/loaders/item/items/TeaUltimate.java | 221 ++++--- src/main/java/kubatech/mixin/Mixin.java | 9 +- src/main/java/kubatech/mixin/MixinPlugin.java | 11 +- src/main/java/kubatech/mixin/TargetedMod.java | 15 +- .../mixins/minecraft/EnchantmentHelperMixin.java | 8 +- .../mixin/mixins/minecraft/WorldMixin.java | 2 + src/main/java/kubatech/nei/IMCForNEI.java | 31 +- src/main/java/kubatech/nei/Mob_Handler.java | 151 ++--- src/main/java/kubatech/nei/NEI_Config.java | 26 +- src/main/java/kubatech/savedata/PlayerData.java | 24 +- .../java/kubatech/savedata/PlayerDataManager.java | 27 +- .../java/kubatech/tileentity/TeaAcceptorTile.java | 88 ++- ...MetaTileEntity_ExtremeExterminationChamber.java | 571 ++++++++---------- .../GT_MetaTileEntity_MegaIndustrialApiary.java | 664 +++++++++------------ 64 files changed, 1987 insertions(+), 2507 deletions(-) (limited to 'src/main/java/kubatech') diff --git a/src/main/java/kubatech/ClientProxy.java b/src/main/java/kubatech/ClientProxy.java index b9cfcf5e66..618518a016 100644 --- a/src/main/java/kubatech/ClientProxy.java +++ b/src/main/java/kubatech/ClientProxy.java @@ -1,30 +1,23 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech; -import cpw.mods.fml.common.event.*; import kubatech.api.utils.ModUtils; import kubatech.loaders.MobRecipeLoader; import kubatech.nei.IMCForNEI; + import net.minecraftforge.common.MinecraftForge; +import cpw.mods.fml.common.event.*; + @SuppressWarnings("unused") public class ClientProxy extends CommonProxy { diff --git a/src/main/java/kubatech/CommonProxy.java b/src/main/java/kubatech/CommonProxy.java index e8453d13eb..b8e063e5d8 100644 --- a/src/main/java/kubatech/CommonProxy.java +++ b/src/main/java/kubatech/CommonProxy.java @@ -1,20 +1,11 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech; @@ -22,8 +13,6 @@ package kubatech; import static kubatech.loaders.BlockLoader.registerBlocks; import static kubatech.loaders.ItemLoader.registerItems; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.event.*; import kubatech.api.LoaderReference; import kubatech.commands.CommandConfig; import kubatech.commands.CommandHandler; @@ -34,8 +23,12 @@ import kubatech.loaders.MTLoader; import kubatech.loaders.RecipeLoader; import kubatech.loaders.TCLoader; import kubatech.savedata.PlayerDataManager; + import net.minecraftforge.common.MinecraftForge; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.event.*; + public class CommonProxy { public void preInit(FMLPreInitializationEvent event) { diff --git a/src/main/java/kubatech/FMLEventHandler.java b/src/main/java/kubatech/FMLEventHandler.java index 26fe14e906..b096c7bb11 100644 --- a/src/main/java/kubatech/FMLEventHandler.java +++ b/src/main/java/kubatech/FMLEventHandler.java @@ -1,30 +1,24 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; import kubatech.api.network.LoadConfigPacket; + import net.minecraft.entity.player.EntityPlayerMP; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; + public class FMLEventHandler { + // Gets fired only server-sided @SubscribeEvent public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { diff --git a/src/main/java/kubatech/Tags.java b/src/main/java/kubatech/Tags.java index 9e027782a3..f25192bfa8 100644 --- a/src/main/java/kubatech/Tags.java +++ b/src/main/java/kubatech/Tags.java @@ -1,20 +1,11 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech; diff --git a/src/main/java/kubatech/api/ConstructableItemStack.java b/src/main/java/kubatech/api/ConstructableItemStack.java index 0d03fc5fd2..0d80076760 100644 --- a/src/main/java/kubatech/api/ConstructableItemStack.java +++ b/src/main/java/kubatech/api/ConstructableItemStack.java @@ -1,42 +1,36 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api; -import cpw.mods.fml.common.registry.GameRegistry; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import java.nio.charset.StandardCharsets; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTSizeTracker; import net.minecraft.nbt.NBTTagCompound; +import cpw.mods.fml.common.registry.GameRegistry; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + public class ConstructableItemStack { + public final GameRegistry.UniqueIdentifier itemIdentifier; public final int meta; public final int size; public final NBTTagCompound tagCompound; - private ConstructableItemStack( - GameRegistry.UniqueIdentifier itemIdentifier, int meta, int size, NBTTagCompound tagCompound) { + private ConstructableItemStack(GameRegistry.UniqueIdentifier itemIdentifier, int meta, int size, + NBTTagCompound tagCompound) { this.itemIdentifier = itemIdentifier; this.meta = meta; this.size = size; @@ -107,10 +101,12 @@ public class ConstructableItemStack { byteBuf.readBytes(bytes); try { nbtTagCompound = CompressedStreamTools.func_152457_a(bytes, new NBTSizeTracker(2097152L)); - } catch (Exception ignored) { - } + } 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/LoaderReference.java b/src/main/java/kubatech/api/LoaderReference.java index 3215fa1b21..5ae387ed63 100644 --- a/src/main/java/kubatech/api/LoaderReference.java +++ b/src/main/java/kubatech/api/LoaderReference.java @@ -3,6 +3,7 @@ package kubatech.api; import cpw.mods.fml.common.Loader; public class LoaderReference { + public static final boolean BloodMagic = Loader.isModLoaded("AWWayofTime"); public static final boolean EnderIO = Loader.isModLoaded("EnderIO"); public static final boolean ExtraUtilities = Loader.isModLoaded("ExtraUtilities"); diff --git a/src/main/java/kubatech/api/Variables.java b/src/main/java/kubatech/api/Variables.java index 0f07c48324..bc67003a68 100644 --- a/src/main/java/kubatech/api/Variables.java +++ b/src/main/java/kubatech/api/Variables.java @@ -1,30 +1,23 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api; import kubatech.api.utils.StringUtils; + import net.minecraft.util.EnumChatFormatting; public class Variables { - public static final String Author = - "Author: " + StringUtils.applyRainbow("kuba6000", 0, EnumChatFormatting.BOLD.toString()); + + public static final String Author = "Author: " + + StringUtils.applyRainbow("kuba6000", 0, EnumChatFormatting.BOLD.toString()); public static String buildAuthorList(String... authors) { if (authors.length == 0) return "Author: Unknown"; @@ -32,17 +25,19 @@ public class Variables { .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 + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" - + EnumChatFormatting.RESET + "" + EnumChatFormatting.GRAY + " Blueprint on the Controller!"; + public static final String StructureHologram = "To see the structure, use a " + EnumChatFormatting.BLUE + + "Tec" + + EnumChatFormatting.DARK_BLUE + + "Tech" + + EnumChatFormatting.RESET + + "" + + EnumChatFormatting.GRAY + + " Blueprint 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 b92dead10e..426cac0df5 100644 --- a/src/main/java/kubatech/api/enums/ItemList.java +++ b/src/main/java/kubatech/api/enums/ItemList.java @@ -3,17 +3,20 @@ package kubatech.api.enums; import static gregtech.api.enums.GT_Values.NI; import static gregtech.api.enums.GT_Values.W; +import java.util.Locale; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + import gregtech.api.interfaces.IItemContainer; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; -import java.util.Locale; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; public enum ItemList implements IItemContainer { + ExtremeExterminationChamber, ExtremeIndustrialApiary, LegendaryBlackTea, @@ -147,10 +150,8 @@ 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 @@ -197,9 +198,8 @@ public enum ItemList implements IItemContainer { } /** - * Returns the internal stack. - * This method is unsafe. It's here only for quick operations. - * DON'T CHANGE THE RETURNED VALUE! + * Returns the internal stack. This method is unsafe. It's here only for quick operations. DON'T CHANGE THE RETURNED + * VALUE! */ public ItemStack getInternalStack_unsafe() { return mStack; diff --git a/src/main/java/kubatech/api/helpers/EnderIOHelper.java b/src/main/java/kubatech/api/helpers/EnderIOHelper.java index c5bb281b7e..30158500c7 100644 --- a/src/main/java/kubatech/api/helpers/EnderIOHelper.java +++ b/src/main/java/kubatech/api/helpers/EnderIOHelper.java @@ -1,31 +1,25 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.helpers; -import crazypants.enderio.EnderIO; import kubatech.api.LoaderReference; + import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.boss.IBossDisplayData; +import crazypants.enderio.EnderIO; + public class EnderIOHelper { + public static boolean canEntityBeCapturedWithSoulVial(Entity entity, String entityID) { if (!LoaderReference.EnderIO) return true; if (ReflectionHelper.callMethod(EnderIO.itemSoulVessel, "isBlackListed", false, entityID)) diff --git a/src/main/java/kubatech/api/helpers/GTHelper.java b/src/main/java/kubatech/api/helpers/GTHelper.java index 782c697232..16abbe348c 100644 --- a/src/main/java/kubatech/api/helpers/GTHelper.java +++ b/src/main/java/kubatech/api/helpers/GTHelper.java @@ -3,9 +3,9 @@ package kubatech.api.helpers; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; import static kubatech.api.Variables.ln4; +import kubatech.api.implementations.KubaTechGTMultiBlockBase; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import kubatech.api.implementations.KubaTechGTMultiBlockBase; public class GTHelper { diff --git a/src/main/java/kubatech/api/helpers/InfernalHelper.java b/src/main/java/kubatech/api/helpers/InfernalHelper.java index dcfd87daad..a2842d66a7 100644 --- a/src/main/java/kubatech/api/helpers/InfernalHelper.java +++ b/src/main/java/kubatech/api/helpers/InfernalHelper.java @@ -1,34 +1,28 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.helpers; -import atomicstryker.infernalmobs.common.InfernalMobsCore; -import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; +import atomicstryker.infernalmobs.common.InfernalMobsCore; +import atomicstryker.infernalmobs.common.mods.api.ModifierLoader; + @SuppressWarnings("unchecked") public class InfernalHelper { + private static Method isClassAllowed = null; public static boolean isClassAllowed(EntityLivingBase e) { @@ -49,8 +43,8 @@ public class InfernalHelper { public static boolean checkEntityClassForced(EntityLivingBase e) { try { if (checkEntityClassForced == null) { - checkEntityClassForced = - InfernalMobsCore.class.getDeclaredMethod("checkEntityClassForced", EntityLivingBase.class); + checkEntityClassForced = InfernalMobsCore.class + .getDeclaredMethod("checkEntityClassForced", EntityLivingBase.class); checkEntityClassForced.setAccessible(true); } return (boolean) checkEntityClassForced.invoke(InfernalMobsCore.instance(), e); diff --git a/src/main/java/kubatech/api/helpers/ReflectionHelper.java b/src/main/java/kubatech/api/helpers/ReflectionHelper.java index 03fc9f45d9..404d1de5f9 100644 --- a/src/main/java/kubatech/api/helpers/ReflectionHelper.java +++ b/src/main/java/kubatech/api/helpers/ReflectionHelper.java @@ -1,20 +1,11 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.helpers; @@ -24,7 +15,9 @@ import java.lang.reflect.Method; import java.util.HashMap; public class ReflectionHelper { + private static class _FieldsMethods { + HashMap fields = new HashMap<>(); HashMap methods = new HashMap<>(); } diff --git a/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java b/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java index aa51834a10..0b31c27011 100644 --- a/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java +++ b/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java @@ -3,16 +3,19 @@ package kubatech.api.implementations; import static kubatech.api.Variables.ln2; import static kubatech.api.Variables.ln4; -import com.gtnewhorizons.modularui.api.drawable.IDrawable; -import com.gtnewhorizons.modularui.api.widget.Widget; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; import java.util.ArrayList; import java.util.Arrays; import java.util.function.Function; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import com.gtnewhorizons.modularui.api.drawable.IDrawable; +import com.gtnewhorizons.modularui.api.widget.Widget; + +import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; + public abstract class KubaTechGTMultiBlockBase> extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase { @@ -25,8 +28,9 @@ public abstract class KubaTechGTMultiBlockBase tiers) durationTiers = tiers; if (!isOverclockingInfinite()) { @@ -135,7 +139,7 @@ public abstract class KubaTechGTMultiBlockBase isFixed = widget -> getIdealStatus() == getRepairStatus() && mMachine; protected static final Function toggleButtonBackgroundGetter = val -> { - if (val == 0) return new IDrawable[] {GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CROSS}; - else return new IDrawable[] {GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CHECKMARK}; + if (val == 0) return new IDrawable[] { GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CROSS }; + else return new IDrawable[] { GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CHECKMARK }; }; } diff --git a/src/main/java/kubatech/api/mobhandler/MobDrop.java b/src/main/java/kubatech/api/mobhandler/MobDrop.java index 1a5f73ae49..554e36bd6a 100644 --- a/src/main/java/kubatech/api/mobhandler/MobDrop.java +++ b/src/main/java/kubatech/api/mobhandler/MobDrop.java @@ -1,37 +1,34 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.mobhandler; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import java.util.HashMap; + import kubatech.api.ConstructableItemStack; import kubatech.api.utils.GSONUtils; + import net.minecraft.item.ItemStack; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + public class MobDrop { + public enum DropType { + Normal, Rare, Additional, Infernal; + private static final DropType[] values = values(); public static DropType get(int ordinal) { @@ -52,14 +49,8 @@ public class MobDrop { private MobDrop() {} - public MobDrop( - ItemStack stack, - DropType type, - int chance, - Integer enchantable, - HashMap damages, - boolean lootable, - boolean playerOnly) { + public MobDrop(ItemStack stack, DropType type, int chance, Integer enchantable, HashMap damages, + boolean lootable, boolean playerOnly) { this.stack = stack; this.reconstructableStack = new ConstructableItemStack(stack); this.type = type; diff --git a/src/main/java/kubatech/api/network/CustomTileEntityPacket.java b/src/main/java/kubatech/api/network/CustomTileEntityPacket.java index 334ff091aa..551110a107 100644 --- a/src/main/java/kubatech/api/network/CustomTileEntityPacket.java +++ b/src/main/java/kubatech/api/network/CustomTileEntityPacket.java @@ -1,24 +1,25 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.network; +import java.nio.charset.StandardCharsets; + +import kubatech.api.tileentity.CustomTileEntityPacketHandler; +import kubatech.api.utils.ModUtils; +import kubatech.kubatech; + +import net.minecraft.client.Minecraft; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -27,15 +28,9 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import java.nio.charset.StandardCharsets; -import kubatech.api.tileentity.CustomTileEntityPacketHandler; -import kubatech.api.utils.ModUtils; -import kubatech.kubatech; -import net.minecraft.client.Minecraft; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; public class CustomTileEntityPacket implements IMessage { + public int w, x, y, z; public final ByteBuf customdata = Unpooled.buffer(); @@ -125,6 +120,7 @@ public class CustomTileEntityPacket implements IMessage { } public static class Handler implements IMessageHandler { + @Override public IMessage onMessage(CustomTileEntityPacket message, MessageContext ctx) { if (!ModUtils.isClientSided) return null; diff --git a/src/main/java/kubatech/api/network/LoadConfigPacket.java b/src/main/java/kubatech/api/network/LoadConfigPacket.java index 0c9015de12..04a8f68770 100644 --- a/src/main/java/kubatech/api/network/LoadConfigPacket.java +++ b/src/main/java/kubatech/api/network/LoadConfigPacket.java @@ -1,35 +1,27 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.network; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import io.netty.buffer.ByteBuf; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.HashSet; + import kubatech.config.Config; import kubatech.config.OverridesConfig; import kubatech.kubatech; import kubatech.loaders.MobRecipeLoader; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; public class LoadConfigPacket implements IMessage { @@ -54,7 +46,8 @@ public class LoadConfigPacket implements IMessage { byte[] sbytes = new byte[buf.readInt()]; buf.readBytes(sbytes); mobsOverrides.put( - new String(sbytes, StandardCharsets.UTF_8), OverridesConfig.MobOverride.readFromByteBuf(buf)); + new String(sbytes, StandardCharsets.UTF_8), + OverridesConfig.MobOverride.readFromByteBuf(buf)); } } } @@ -81,6 +74,7 @@ public class LoadConfigPacket implements IMessage { } public static class Handler implements IMessageHandler { + @Override public IMessage onMessage(LoadConfigPacket message, MessageContext ctx) { kubatech.info("Received Mob Handler config, parsing"); diff --git a/src/main/java/kubatech/api/tileentity/CustomTileEntityPacketHandler.java b/src/main/java/kubatech/api/tileentity/CustomTileEntityPacketHandler.java index 3a1fa78d15..039b545890 100644 --- a/src/main/java/kubatech/api/tileentity/CustomTileEntityPacketHandler.java +++ b/src/main/java/kubatech/api/tileentity/CustomTileEntityPacketHandler.java @@ -1,20 +1,11 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.tileentity; @@ -22,5 +13,6 @@ package kubatech.api.tileentity; import kubatech.api.network.CustomTileEntityPacket; public interface CustomTileEntityPacketHandler { + void HandleCustomPacket(CustomTileEntityPacket customdata); } diff --git a/src/main/java/kubatech/api/utils/FastRandom.java b/src/main/java/kubatech/api/utils/FastRandom.java index 03699d2b62..33d157a1aa 100644 --- a/src/main/java/kubatech/api/utils/FastRandom.java +++ b/src/main/java/kubatech/api/utils/FastRandom.java @@ -1,20 +1,11 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.utils; diff --git a/src/main/java/kubatech/api/utils/GSONUtils.java b/src/main/java/kubatech/api/utils/GSONUtils.java index 1882a1e346..99580ad803 100644 --- a/src/main/java/kubatech/api/utils/GSONUtils.java +++ b/src/main/java/kubatech/api/utils/GSONUtils.java @@ -1,40 +1,35 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.utils; -import com.google.gson.*; import java.io.IOException; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; + import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTSizeTracker; import net.minecraft.nbt.NBTTagCompound; +import com.google.gson.*; + public class GSONUtils { + @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface SkipGSON {} private static final ExclusionStrategy GSONStrategy = new ExclusionStrategy() { + @Override public boolean shouldSkipField(FieldAttributes f) { return f.getAnnotation(SkipGSON.class) != null; @@ -62,25 +57,19 @@ 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); } }; - public static final GsonBuilder GSON_BUILDER = new GsonBuilder() - .addSerializationExclusionStrategy(GSONStrategy) + public static final GsonBuilder GSON_BUILDER = new GsonBuilder().addSerializationExclusionStrategy(GSONStrategy) .addDeserializationExclusionStrategy(GSONStrategy) .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundDeserializer) - .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundSerializer) - .serializeNulls(); + .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundSerializer).serializeNulls(); public static final GsonBuilder GSON_BUILDER_PRETTY = new GsonBuilder() - .addSerializationExclusionStrategy(GSONStrategy) - .addDeserializationExclusionStrategy(GSONStrategy) + .addSerializationExclusionStrategy(GSONStrategy).addDeserializationExclusionStrategy(GSONStrategy) .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundDeserializer) - .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundSerializer) - .serializeNulls() - .setPrettyPrinting(); + .registerTypeAdapter(NBTTagCompound.class, NBTTagCompoundSerializer).serializeNulls().setPrettyPrinting(); } diff --git a/src/main/java/kubatech/api/utils/ItemID.java b/src/main/java/kubatech/api/utils/ItemID.java index d296c7d80d..c2060e59bc 100644 --- a/src/main/java/kubatech/api/utils/ItemID.java +++ b/src/main/java/kubatech/api/utils/ItemID.java @@ -1,30 +1,23 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.utils; import java.util.Objects; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class ItemID { + private final Item item; private final int count; private final int meta; diff --git a/src/main/java/kubatech/api/utils/MobUtils.java b/src/main/java/kubatech/api/utils/MobUtils.java index 76bec7b988..0a6881edeb 100644 --- a/src/main/java/kubatech/api/utils/MobUtils.java +++ b/src/main/java/kubatech/api/utils/MobUtils.java @@ -1,27 +1,17 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.utils; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.lang.reflect.Field; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBox; import net.minecraft.client.model.ModelRenderer; @@ -30,6 +20,9 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.entity.EntityLiving; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class MobUtils { private static Field mainmodelfield = null; @@ -48,8 +41,8 @@ public class MobUtils { public static float getMobHeight(EntityLiving e) { try { if (mainmodelfield == null) { - mainmodelfield = RendererLivingEntity.class.getDeclaredField( - ModUtils.isDeobfuscatedEnvironment ? "mainModel" : "field_77045_g"); + mainmodelfield = RendererLivingEntity.class + .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 6870a8801d..a09b3b68ee 100644 --- a/src/main/java/kubatech/api/utils/ModUtils.java +++ b/src/main/java/kubatech/api/utils/ModUtils.java @@ -1,35 +1,30 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.api.utils; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.util.*; + import javax.xml.bind.DatatypeConverter; + import net.minecraft.launchwrapper.Launch; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.ModContainer; + public class ModUtils { - public static final boolean isDeobfuscatedEnvironment = - (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); + + public static final boolean isDeobfuscatedEnvironment = (boolean) Launch.blackboard + .get("fml.deobfuscatedEnvironment"); public static boolean isClientSided = false; private static final HashMap classNamesToModIDs = new HashMap<>(); private static final Map.Entry emptyEntry = new AbstractMap.SimpleEntry<>("", ""); @@ -39,15 +34,11 @@ public class ModUtils { classNamesToModIDs.put("net.minecraft", "Minecraft"); Loader.instance().getActiveModList().forEach(m -> { Object Mod = m.getMod(); - if (Mod != null) - classNamesToModIDs.put(Mod.getClass().getPackage().getName(), m.getName()); + if (Mod != null) classNamesToModIDs.put(Mod.getClass().getPackage().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; @@ -55,10 +46,9 @@ public class ModUtils { public static String getModListVersion() { if (modListVersion != null) return modListVersion; @SuppressWarnings("unchecked") - ArrayList modlist = (ArrayList) - ((ArrayList) Loader.instance().getActiveModList()).clone(); - String sortedList = modlist.stream() - .filter(m -> m.getMod() != null) + ArrayList modlist = (ArrayList) ((ArrayList) Loader.instance() + .getActiveModList()).clone(); + String sortedList = modlist.stream().filter(m -> m.getMod() != null) .sorted(Comparator.comparing(ModContainer::getModId)) .collect( StringBuilder::new, @@ -81,19 +71,16 @@ public class ModUtils { public static String getModListVersionIgnoringModVersions() { if (modListVersionIgnoringModVersions != null) return modListVersionIgnoringModVersions; @SuppressWarnings("unchecked") - ArrayList modlist = (ArrayList) - ((ArrayList) Loader.instance().getActiveModList()).clone(); - String sortedList = modlist.stream() - .filter(m -> m.getMod() != null) + ArrayList modlist = (ArrayList) ((ArrayList) 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)) + .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(); + modListVersionIgnoringModVersions = DatatypeConverter + .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 f7bbdcf9b7..066fa69d4f 100644 --- a/src/main/java/kubatech/api/utils/StringUtils.jav