diff options
author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-10-18 17:03:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 18:03:23 +0200 |
commit | fbdbb388c369fae549cfde3eed38b536f7461d90 (patch) | |
tree | b46f7fc949d7e4c6e3be910b81ed725e6dc1648e /src/main/java/gtPlusPlus/core/common | |
parent | b670446fdf49991093b485f0aa14050039632775 (diff) | |
download | GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.gz GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.bz2 GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.zip |
Cleaning up (#767)
* Kill playerAPI
* Gut more events and compat that is now obsolete
* Remove commented out code
* Remove final modifier from methods
* Make more stuff final
* Remove slow building ring
* Protected -> private in final classes
* More cleaning
* More cleaning v2
* Purging
* Clean DevHelper
* Clean DevHelper 2
* delete DevHelper
* remove useless IFMLLoadingPlugin.MCVersion annotation from @Mod files
* check for obfuscation only once in the IFMLloadingPlugin.injectData
* don't instantiate the static class ASMConfig
* delete unused and empty implementation of IFMLCallHook
* delete empty class
* delete ClassesToTransform class that just holds the class names constants
* delete unused methods and unsless logging in dummymod container
* delete unused transformer ClassTransformer_TT_ThaumicRestorer
* spotless
* Clean
* Clean utils
* Build checkpoint
* Purge
* Stage 2
* Stage 3
* Stage 4
* Stage 5
* Stage 6
* Spotless
* Imports
* Stage idk
* Stage 1
* Fix issue
* Spotless
* Format numbers
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Diffstat (limited to 'src/main/java/gtPlusPlus/core/common')
9 files changed, 9 insertions, 323 deletions
diff --git a/src/main/java/gtPlusPlus/core/common/BasePlayer.java b/src/main/java/gtPlusPlus/core/common/BasePlayer.java deleted file mode 100644 index d119ca2015..0000000000 --- a/src/main/java/gtPlusPlus/core/common/BasePlayer.java +++ /dev/null @@ -1,211 +0,0 @@ -package gtPlusPlus.core.common; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.potion.Potion; -import net.minecraft.util.MovementInputFromOptions; - -import api.player.client.ClientPlayerAPI; -import api.player.client.ClientPlayerBase; -import gtPlusPlus.core.handler.events.CustomMovementHandler; -import gtPlusPlus.core.handler.events.SneakManager; - -public class BasePlayer extends ClientPlayerBase { - - private final Minecraft mc = Minecraft.getMinecraft(); - private final CustomMovementHandler customMovementInput = new CustomMovementHandler(); - private final GameSettings settings = this.mc.gameSettings; - - public BasePlayer(final ClientPlayerAPI api) { - super(api); - } - - /* - * EntityPlayerSP.onLivingUpdate() - Adapted to PlayerAPI - */ - @Override - public void onLivingUpdate() { - - super.onLivingUpdate(); - EntityPlayer aPlayer = this.player; - if (aPlayer != null) { - SneakManager aSneak = SneakManager.get(aPlayer); - if (!aSneak.isWearingRing()) { - return; - } - } - - if (this.player.sprintingTicksLeft > 0) { - --this.player.sprintingTicksLeft; - if (this.player.sprintingTicksLeft == 0) { - this.player.setSprinting(false); - } - } - - if (this.playerAPI.getSprintToggleTimerField() > 0) { - this.playerAPI.setSprintToggleTimerField(this.playerAPI.getSprintToggleTimerField() - 1); - } - - if (this.mc.playerController.enableEverythingIsScrewedUpMode()) { - this.player.posX = this.player.posZ = 0.5D; - this.player.posX = 0.0D; - this.player.posZ = 0.0D; - this.player.rotationYaw = this.player.ticksExisted / 12.0F; - this.player.rotationPitch = 10.0F; - this.player.posY = 68.5D; - } else { - - final boolean isJumping = this.player.movementInput.jump; - - final float minSpeed = 0.8F; - final boolean isMovingForward = this.player.movementInput.moveForward >= minSpeed; - this.customMovementInput.update(this.mc, (MovementInputFromOptions) this.player.movementInput, this.player); - - /* - * Begin ToggleSneak Changes - ToggleSprint - */ - SneakManager aSneak = SneakManager.get(this.player); - - final boolean isSprintDisabled = false; - final boolean canDoubleTap = aSneak.optionDoubleTap; - - // Detect when ToggleSprint was disabled in the in-game options menu - if (aSneak.wasSprintDisabled) { - this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false, aSneak); - aSneak.wasSprintDisabled = false; - } - - // Default Sprint routine converted to PlayerAPI, use if ToggleSprint is disabled - TODO - Disable sprinting - // as a whole - if (isSprintDisabled) { - // Utils.LOG_INFO("Sprint pressed"); - if (aSneak.optionDoubleTap && this.player.onGround - && !isMovingForward - && (this.player.movementInput.moveForward >= minSpeed) - && !this.player.isSprinting() - && !this.player.isUsingItem() - && !this.player.isPotionActive(Potion.blindness)) { - if ((this.playerAPI.getSprintToggleTimerField() <= 0) - && !this.settings.keyBindSprint.getIsKeyPressed()) { - this.playerAPI.setSprintToggleTimerField(7); - } else { - if (aSneak.Sprinting()) { - this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, false, aSneak); - } else { - this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false, aSneak); - } - } - } - - if (!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) - && !this.player.isUsingItem() - && !this.player.isPotionActive(Potion.blindness) - && this.settings.keyBindSprint.getIsKeyPressed()) { - if (aSneak.Sprinting()) { - this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, false, aSneak); - } else { - this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false, aSneak); - } - } - } else { - final boolean state = this.customMovementInput.sprint; - - // Only handle changes in state under the following conditions: - // On ground, not hungry, not eating/using item, not blind, and not Vanilla - // - // 5/6/14 - onGround check removed to match vanilla's 'start sprint while jumping' behavior. - // if(this.player.onGround && enoughHunger && !this.player.isUsingItem() && - // !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) - - if (!this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) - && !this.customMovementInput.sprintHeldAndReleased) { - if ((canDoubleTap && !this.player.isSprinting()) || !canDoubleTap) { - if (aSneak.Sprinting()) { - this.player.setSprinting(state); - } else { - this.player.setSprinting(false); - } - } - } - - if (canDoubleTap && !state - && this.player.onGround - && !isMovingForward - && (this.player.movementInput.moveForward >= minSpeed) - && !this.player.isSprinting() - && !this.player.isUsingItem() - && !this.player.isPotionActive(Potion.blindness)) { - if (this.playerAPI.getSprintToggleTimerField() == 0) { - this.playerAPI.setSprintToggleTimerField(7); - } else { - if (aSneak.Sprinting()) { - this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, true, aSneak); - this.playerAPI.setSprintToggleTimerField(0); - } - } - } - } - - // If sprinting, break the sprint in appropriate circumstances: - // Player stops moving forward, runs into something, or gets too hungry - if (this.player.isSprinting() - && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally)) { - this.player.setSprinting(false); - - // Undo toggle if we resumed vanilla operation due to Hold&Release, DoubleTap, Fly, Ride - if ((this.customMovementInput.sprintHeldAndReleased == true) || isSprintDisabled - || this.customMovementInput.sprintDoubleTapped - || this.player.capabilities.isFlying - || this.player.isRiding()) { - this.customMovementInput.UpdateSprint(false, false, aSneak); - } - } - - /* - * End ToggleSneak Changes - ToggleSprint - */ - - // // - // // Debug Framework - Added 5/7/2014 - // // - // if (this.showDebug && this.settings.keyBindPickBlock.getIsKeyPressed() && !this.handledDebugPress) - // { - // this.player.addChatMessage(new ChatComponentText("+--------------------------------------+")); - // this.player.addChatMessage(new ChatComponentText("| ToggleSneak Debug Info |")); - // this.player.addChatMessage(new ChatComponentText("+--------------------------------------+")); - // this.player.addChatMessage(new ChatComponentText(" ")); - // this.player.addChatMessage(new ChatComponentText("isFlying - " + - // (this.player.capabilities.isFlying == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("isCreative - " + - // (this.player.capabilities.isCreativeMode == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("enableFlyBoost - " + - // (SneakManager.optionEnableFlyBoost == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("flyBoostAmount - " + - // SneakManager.optionFlyBoostAmount)); - // this.player.addChatMessage(new ChatComponentText(" ")); - // this.player.addChatMessage(new ChatComponentText("keybindSprint - " + - // (this.settings.keyBindSprint.getIsKeyPressed() == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("keybindSneak - " + - // (this.settings.keyBindSneak.getIsKeyPressed() == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("keybindJump - " + - // (this.settings.keyBindJump.getIsKeyPressed() == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText(" ")); - // this.player.addChatMessage(new ChatComponentText(" ")); - // - // this.handledDebugPress = true; - // } - // else if (this.showDebug && !this.settings.keyBindPickBlock.getIsKeyPressed() && this.handledDebugPress) - // { - // this.handledDebugPress = false; - // } - - } - } -} diff --git a/src/main/java/gtPlusPlus/core/common/CommonProxy.java b/src/main/java/gtPlusPlus/core/common/CommonProxy.java index ee624b3f24..ab7090351b 100644 --- a/src/main/java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/main/java/gtPlusPlus/core/common/CommonProxy.java @@ -1,9 +1,6 @@ package gtPlusPlus.core.common; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityBlaze; -import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -17,7 +14,6 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; @@ -32,11 +28,9 @@ import gtPlusPlus.core.handler.GuiHandler; import gtPlusPlus.core.handler.events.EnderDragonDeathHandler; import gtPlusPlus.core.handler.events.EntityDeathHandler; import gtPlusPlus.core.handler.events.GeneralTooltipEventHandler; -import gtPlusPlus.core.handler.events.PickaxeBlockBreakEventHandler; import gtPlusPlus.core.handler.events.PlayerSleepEventHandler; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.tileentities.ModTileEntities; import gtPlusPlus.core.util.Utils; @@ -71,36 +65,24 @@ public class CommonProxy { AddToCreativeTab.initialiseTabs(); CustomInternalName.init(); - // Moved from Init after Debug Loading. - // 29/01/18 - Alkalus - // Moved earlier into PreInit, so that Items exist before they're called upon in - // recipes. - // 20/03/18 - Alkalus ModItems.init(); ModBlocks.init(); CI.preInit(); COMPAT_IntermodStaging.preInit(e); BookHandler.run(); // Registration of entities and renderers - Logger.INFO("[Proxy] Calling Entity registrator."); + Logger.INFO("[Proxy] Calling Entity registration."); registerEntities(); - Logger.INFO("[Proxy] Calling Tile Entity registrator."); + Logger.INFO("[Proxy] Calling Tile Entity registration."); registerTileEntities(); - Logger.INFO("[Proxy] Calling Render registrator."); + Logger.INFO("[Proxy] Calling Render registration."); registerRenderThings(); } public void init(final FMLInitializationEvent e) { CI.init(); - /** - * Register the Event Handlers. - */ - - // Prevents my Safes being destroyed. - Utils.registerEvent(new PickaxeBlockBreakEventHandler()); - // Block Handler for all events. Utils.registerEvent(new GeneralTooltipEventHandler()); // Handles Tooltips for items giving custom multiblock behaviour Utils.registerEvent(new SpecialBehaviourTooltipHandler()); @@ -112,10 +94,6 @@ public class CommonProxy { Utils.registerEvent(new EnderDragonDeathHandler()); Utils.registerEvent(new EntityDeathHandler()); - /** - * End of Subscribe Event registration. - */ - // Compat Handling COMPAT_HANDLER.registerMyModsOreDictEntries(); COMPAT_HANDLER.intermodOreDictionarySupport(); @@ -145,8 +123,6 @@ public class CommonProxy { Logger.INFO("Registering custom mob drops."); registerCustomMobDrops(); - // Moved last in postInit(). - // 12/12/19 - Alkalus // Moved last, to prevent recipes being generated post initialisation. Logger.INFO("Loading Gregtech API recipes."); COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); @@ -179,15 +155,8 @@ public class CommonProxy { return 0; } - public void generateMysteriousParticles(final Entity entity) {} - public void registerCustomMobDrops() { - // Zombie - EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemBomb), 2, 10); - EntityUtils.registerDropsForMob(EntityZombie.class, ALLOY.TUMBAGA.getTinyDust(1), 1, 10); - EntityUtils.registerDropsForMob(EntityZombie.class, ALLOY.POTIN.getTinyDust(1), 1, 10); - // Blazes if (ItemUtils.doesOreDictHaveEntryFor("dustPyrotheum")) { EntityUtils.registerDropsForMob( @@ -202,22 +171,6 @@ public class CommonProxy { 10); } - // Special mobs Support - if (ReflectionUtils.doesClassExist("toast.specialMobs.entity.zombie.EntityBrutishZombie")) { - Class<?> aBrutishZombie = ReflectionUtils.getClass("toast.specialMobs.entity.zombie.EntityBrutishZombie"); - ItemStack aFortune1 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); - ItemStack aFortune2 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); - ItemStack aFortune3 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); - EntityUtils.registerDropsForMob(aBrutishZombie, aFortune1, 1, 100); - EntityUtils.registerDropsForMob(aBrutishZombie, aFortune2, 1, 50); - EntityUtils.registerDropsForMob(aBrutishZombie, aFortune3, 1, 1); - EntityUtils.registerDropsForMob( - aBrutishZombie, - ItemUtils.getItemStackOfAmountFromOreDict("ingotRedAlloy", 1), - 3, - 200); - } - // GalaxySpace Support if (ReflectionUtils.doesClassExist("galaxyspace.core.entity.mob.EntityEvolvedColdBlaze")) { Class<?> aColdBlaze = ReflectionUtils.getClass("galaxyspace.core.entity.mob.EntityEvolvedColdBlaze"); @@ -246,19 +199,7 @@ public class CommonProxy { } } - protected final AutoMap<Pair<Item, IItemRenderer>> mItemRenderMappings = new AutoMap<Pair<Item, IItemRenderer>>(); - - public static void registerItemRendererGlobal(Item aItem, IItemRenderer aRenderer) { - GTplusplus.proxy.registerItemRenderer(aItem, aRenderer); - } - - public void registerItemRenderer(Item aItem, IItemRenderer aRenderer) { - if (Utils.isServer()) { - return; - } else { - mItemRenderMappings.add(new Pair<Item, IItemRenderer>(aItem, aRenderer)); - } - } + protected final AutoMap<Pair<Item, IItemRenderer>> mItemRenderMappings = new AutoMap<>(); public World getClientWorld() { return null; diff --git a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java index be35a360d1..e90596c876 100644 --- a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java +++ b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java @@ -1,7 +1,6 @@ package gtPlusPlus.core.common.compat; import static gregtech.api.enums.Mods.Baubles; -import static gregtech.api.enums.Mods.PlayerAPI; import static gregtech.client.GT_TooltipHandler.Tier.EV; import static gregtech.client.GT_TooltipHandler.Tier.HV; import static gregtech.client.GT_TooltipHandler.Tier.IV; @@ -22,7 +21,6 @@ import gtPlusPlus.core.item.bauble.BatteryPackBaseBauble; import gtPlusPlus.core.item.bauble.FireProtectionBauble; import gtPlusPlus.core.item.general.ItemCloakingDevice; import gtPlusPlus.core.item.general.ItemHealingDevice; -import gtPlusPlus.core.item.general.ItemSlowBuildingRing; public class COMPAT_Baubles { @@ -56,9 +54,5 @@ public class COMPAT_Baubles { registerTieredTooltip(new ItemStack(ModItems.itemChargePack_High_3, 1, OreDictionary.WILDCARD_VALUE), UV); ModItems.itemChargePack_High_4 = new BatteryPackBaseBauble(9); registerTieredTooltip(new ItemStack(ModItems.itemChargePack_High_4, 1, OreDictionary.WILDCARD_VALUE), UHV); - - if (PlayerAPI.isModLoaded()) { - ModItems.itemSlowBuildingRing = new ItemSlowBuildingRing(); - } } } diff --git a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java index e17bccb60a..907e6a0c42 100644 --- a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java +++ b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java @@ -14,7 +14,7 @@ public class COMPAT_ExtraUtils { run(); } - private static final void run() { + private static void run() { ItemUtils.getItemForOreDict("ExtraUtilities:bedrockiumIngot", "ingotBedrockium", "Bedrockium Ingot", 0); // GT_OreDictUnificator.registerOre("plateBedrockium", new ItemStack(ModItems.itemPlateBedrockium)); diff --git a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_HarvestCraft.java b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_HarvestCraft.java index f3c83785c4..9a9557e418 100644 --- a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_HarvestCraft.java +++ b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_HarvestCraft.java @@ -8,7 +8,7 @@ public class COMPAT_HarvestCraft { run(); } - private static final void run() { + private static void run() { FishTrapHandler.pamsHarvestCraftCompat(); } } diff --git a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_IC2.java b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_IC2.java index 92da90184f..d2b53c701d 100644 --- a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_IC2.java +++ b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_IC2.java @@ -40,7 +40,7 @@ public class COMPAT_IC2 { run(); } - private static final void run() { + private static void run() { if (ConfigSwitches.disableIC2Recipes) { diff --git a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java deleted file mode 100644 index 286de43fcb..0000000000 --- a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java +++ /dev/null @@ -1,38 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import api.player.client.ClientPlayerAPI; -import gtPlusPlus.core.common.BasePlayer; - -public class COMPAT_PlayerAPI { - - public static class commonProxy { - - public static void initPre() {} - - public static void Init() {} - - public static void initPost() {} - } - - public static class clientProxy { - - public static void initPre() { - // Utils.registerEvent(SneakManager.instance); - } - - public static void Init() { - ClientPlayerAPI.register("SneakManager", BasePlayer.class); - } - - public static void initPost() {} - } - - public static class serverProxy { - - public static void initPre() {} - - public static void Init() {} - - public static void initPost() {} - } -} diff --git a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java index fd760af771..768414b9f0 100644 --- a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java +++ b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java @@ -15,7 +15,7 @@ public class COMPAT_Thaumcraft { } } - private static final void run() { + private static void run() { for (int i = 0; i <= 6; i++) { ItemUtils.getItemForOreDict("Thaumcraft:ItemShard", "shardAny", "TC Shard " + i, i); diff --git a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java index f746042c2d..726aa897df 100644 --- a/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java +++ b/src/main/java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java @@ -13,7 +13,7 @@ public class COMPAT_Witchery { run(); } - private static final void run() { + private static void run() { // Koboldite ItemStack aKobolditeDust = ItemUtils .getItemStackWithMeta(Witchery.isModLoaded(), "witchery:ingredient", "Koboldite Dust", 148, 1); |