diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2023-07-02 00:07:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-02 00:07:16 +0200 |
commit | 0509e018823bc68eed261619cfc9cb3a8685bb5e (patch) | |
tree | 9222d8cc2c49ddbe2f1f14cccca8ffcb49637ee7 /src/main/java | |
parent | cd4182ce3814d71e72b4d3796311add2c2c7e9fc (diff) | |
download | GT5-Unofficial-0509e018823bc68eed261619cfc9cb3a8685bb5e.tar.gz GT5-Unofficial-0509e018823bc68eed261619cfc9cb3a8685bb5e.tar.bz2 GT5-Unofficial-0509e018823bc68eed261619cfc9cb3a8685bb5e.zip |
Clean up and fixes (#84)
* Remove unused mixins
* Unused
* Unused
* Update MobHandlerLoader.java
* Fix EEC
* Spotless
* Update zh_CN.lang
* Update dependencies.gradle
Diffstat (limited to 'src/main/java')
12 files changed, 22 insertions, 288 deletions
diff --git a/src/main/java/kubatech/api/LoaderReference.java b/src/main/java/kubatech/api/LoaderReference.java index fc736536bc..7bbb1db1ac 100644 --- a/src/main/java/kubatech/api/LoaderReference.java +++ b/src/main/java/kubatech/api/LoaderReference.java @@ -14,11 +14,9 @@ public class LoaderReference { public static final boolean GTNHCoreMod = Loader.isModLoaded("dreamcraft"); public static final boolean GTPlusPlus = Loader.isModLoaded("miscutils"); public static final boolean HarvestCraft = Loader.isModLoaded("harvestcraft"); - public static final boolean TwilightForest = Loader.isModLoaded("TwilightForest"); public static final boolean Forestry = Loader.isModLoaded("Forestry"); public static final boolean DraconicEvolution = Loader.isModLoaded("DraconicEvolution"); public static final boolean Avaritia = Loader.isModLoaded("Avaritia"); public static final boolean ProjRedIllumination = Loader.isModLoaded("ProjRed|Illumination"); public static final boolean RandomThings = Loader.isModLoaded("RandomThings"); - public static final boolean BetterLoadingScreen = Loader.isModLoaded("betterloadingscreen"); } diff --git a/src/main/java/kubatech/api/helpers/ProgressBarWrapper.java b/src/main/java/kubatech/api/helpers/ProgressBarWrapper.java deleted file mode 100644 index 24758565e3..0000000000 --- a/src/main/java/kubatech/api/helpers/ProgressBarWrapper.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * spotless:off - * 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 <https://www.gnu.org/licenses/>. - * spotless:on - */ - -package kubatech.api.helpers; - -import static kubatech.api.utils.ModUtils.isClientSided; - -import java.io.IOException; - -import alexiil.mods.load.ProgressDisplayer; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.ProgressManager; -import kubatech.Tags; -import kubatech.api.LoaderReference; - -@SuppressWarnings("deprecation") -public class ProgressBarWrapper { - - ProgressManager.ProgressBar internalFMLBar; - boolean isFMLBar; - String name; - int maxSteps; - int steps = 0; - - public ProgressBarWrapper(String name, int steps) { - if (!isClientSided) return; - maxSteps = steps; - this.name = name; - if (!LoaderReference.BetterLoadingScreen) { - internalFMLBar = ProgressManager.push(name, steps); - isFMLBar = true; - return; - } - isFMLBar = false; - } - - public void step(String message) { - if (!isClientSided) return; - if (isFMLBar) internalFMLBar.step(message); - else { - steps++; - try { - ProgressDisplayer - .displayProgress(Tags.MODNAME + ": " + name + " -> " + message, (float) steps / (float) maxSteps); - } catch (IOException e) { - throw new RuntimeException(e); - } - // Prevent game freeze - FMLCommonHandler.instance() - .processWindowMessages(); - } - } - - public void end() { - if (!isClientSided) return; - if (isFMLBar) ProgressManager.pop(internalFMLBar); - } -} diff --git a/src/main/java/kubatech/api/utils/FastRandom.java b/src/main/java/kubatech/api/utils/FastRandom.java deleted file mode 100644 index dd40e92b55..0000000000 --- a/src/main/java/kubatech/api/utils/FastRandom.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * spotless:off - * 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 <https://www.gnu.org/licenses/>. - * spotless:on - */ - -package kubatech.api.utils; - -import java.util.Random; -import java.util.SplittableRandom; - -public class FastRandom extends Random { - - private SplittableRandom realRandom; - - public FastRandom() { - realRandom = new SplittableRandom(); - } - - public FastRandom(long seed) { - realRandom = new SplittableRandom(seed); - } - - @Override - public synchronized void setSeed(long seed) { - realRandom = new SplittableRandom(seed); - } - - @Override - protected int next(int bits) { - return (realRandom.nextInt() >>> (32 - bits)); - } -} diff --git a/src/main/java/kubatech/api/utils/GSONUtils.java b/src/main/java/kubatech/api/utils/GSONUtils.java deleted file mode 100644 index 01c186a44b..0000000000 --- a/src/main/java/kubatech/api/utils/GSONUtils.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * spotless:off - * 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 <https://www.gnu.org/licenses/>. - * spotless:on - */ - -package kubatech.api.utils; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import net.minecraft.nbt.JsonToNBT; -import net.minecraft.nbt.NBTException; -import net.minecraft.nbt.NBTTagCompound; - -import com.google.gson.ExclusionStrategy; -import com.google.gson.FieldAttributes; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializer; - -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; - } - - @Override - public boolean shouldSkipClass(Class<?> clazz) { - return false; - } - }; - - private static final JsonSerializer<NBTTagCompound> NBTTagCompoundSerializer = (src, typeOfSrc, - context) -> new JsonPrimitive(src.toString()); - - private static final JsonDeserializer<NBTTagCompound> NBTTagCompoundDeserializer = (json, typeOfT, context) -> { - try { - if (!(json instanceof JsonPrimitive)) return null; - if (!((JsonPrimitive) json).isString()) return null; - return (NBTTagCompound) JsonToNBT.func_150315_a(json.getAsString()); - } catch (NBTException e) { - throw new RuntimeException(e); - } - }; - - public static final GsonBuilder GSON_BUILDER = new GsonBuilder().addSerializationExclusionStrategy(GSONStrategy) - .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(); -} diff --git a/src/main/java/kubatech/loaders/MobHandlerLoader.java b/src/main/java/kubatech/loaders/MobHandlerLoader.java index 2ebff9afaf..72947c726d 100644 --- a/src/main/java/kubatech/loaders/MobHandlerLoader.java +++ b/src/main/java/kubatech/loaders/MobHandlerLoader.java @@ -1,3 +1,23 @@ +/* + * spotless:off + * 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 <https://www.gnu.org/licenses/>. + * spotless:on + */ + package kubatech.loaders; import static kubatech.tileentity.gregtech.multiblock.GT_MetaTileEntity_ExtremeExterminationChamber.DIAMOND_SPIKES_DAMAGE; diff --git a/src/main/java/kubatech/mixin/Mixin.java b/src/main/java/kubatech/mixin/Mixin.java index e94eca69bb..52f7671faa 100644 --- a/src/main/java/kubatech/mixin/Mixin.java +++ b/src/main/java/kubatech/mixin/Mixin.java @@ -12,11 +12,6 @@ public enum Mixin { // Minecraft WorldMixin("minecraft.WorldMixin", VANILLA), - EntityAccessor("minecraft.EntityAccessor", VANILLA), - EntityLivingAccessor("minecraft.EntityLivingAccessor", VANILLA), - EntityLivingBaseAccessor("minecraft.EntityLivingBaseAccessor", VANILLA), - EntitySlimeAccessor("minecraft.EntitySlimeAccessor", VANILLA), - RendererLivingEntityAccessor("minecraft.RendererLivingEntityAccessor", VANILLA), StringTranslateMixin("minecraft.StringTranslateMixin", VANILLA), LanguageRegistryMixin("minecraft.LanguageRegistryMixin", VANILLA), LocaleMixin("minecraft.LocaleMixin", Side.CLIENT, VANILLA), diff --git a/src/main/java/kubatech/mixin/mixins/minecraft/EntityAccessor.java b/src/main/java/kubatech/mixin/mixins/minecraft/EntityAccessor.java deleted file mode 100644 index 67e42acf6a..0000000000 --- a/src/main/java/kubatech/mixin/mixins/minecraft/EntityAccessor.java +++ /dev/null @@ -1,15 +0,0 @@ -package kubatech.mixin.mixins.minecraft; - -import java.util.Random; - -import net.minecraft.entity.Entity; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(value = Entity.class) -public interface EntityAccessor { - - @Accessor - void setRand(Random rand); -} diff --git a/src/main/java/kubatech/mixin/mixins/minecraft/EntityLivingAccessor.java b/src/main/java/kubatech/mixin/mixins/minecraft/EntityLivingAccessor.java deleted file mode 100644 index 59f8ea66d6..0000000000 --- a/src/main/java/kubatech/mixin/mixins/minecraft/EntityLivingAccessor.java +++ /dev/null @@ -1,16 +0,0 @@ -package kubatech.mixin.mixins.minecraft; - -import net.minecraft.entity.EntityLiving; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(value = EntityLiving.class) -public interface EntityLivingAccessor { - - @Invoker - void callAddRandomArmor(); - - @Invoker - void callEnchantEquipment(); -} diff --git a/src/main/java/kubatech/mixin/mixins/minecraft/EntityLivingBaseAccessor.java b/src/main/java/kubatech/mixin/mixins/minecraft/EntityLivingBaseAccessor.java deleted file mode 100644 index 95370b872b..0000000000 --- a/src/main/java/kubatech/mixin/mixins/minecraft/EntityLivingBaseAccessor.java +++ /dev/null @@ -1,16 +0,0 @@ -package kubatech.mixin.mixins.minecraft; - -import net.minecraft.entity.EntityLivingBase; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(value = EntityLivingBase.class) -public interface EntityLivingBaseAccessor { - - @Invoker - void callDropFewItems(boolean recentlyHit, int lootingLevel); - - @Invoker - void callDropRareDrop(int lootingLevel); -} diff --git a/src/main/java/kubatech/mixin/mixins/minecraft/EntitySlimeAccessor.java b/src/main/java/kubatech/mixin/mixins/minecraft/EntitySlimeAccessor.java deleted file mode 100644 index d7b4eaafb8..0000000000 --- a/src/main/java/kubatech/mixin/mixins/minecraft/EntitySlimeAccessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package kubatech.mixin.mixins.minecraft; - -import net.minecraft.entity.monster.EntitySlime; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(value = EntitySlime.class) -public interface EntitySlimeAccessor { - - @Invoker - void callSetSlimeSize(int size); -} diff --git a/src/main/java/kubatech/mixin/mixins/minecraft/RendererLivingEntityAccessor.java b/src/main/java/kubatech/mixin/mixins/minecraft/RendererLivingEntityAccessor.java deleted file mode 100644 index a2fe93954f..0000000000 --- a/src/main/java/kubatech/mixin/mixins/minecraft/RendererLivingEntityAccessor.java +++ /dev/null @@ -1,15 +0,0 @@ -package kubatech.mixin.mixins.minecraft; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.entity.RendererLivingEntity; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(value = RendererLivingEntity.class) -public interface RendererLivingEntityAccessor { - - @Accessor - ModelBase getMainModel(); - -} 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 bcd5a47a9f..2b94688ea8 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 @@ -92,6 +92,7 @@ import com.gtnewhorizons.modularui.common.widget.DynamicTextWidget; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; +import com.kuba6000.mobsinfo.api.utils.FastRandom; import com.kuba6000.mobsinfo.api.utils.ItemID; import com.mojang.authlib.GameProfile; @@ -124,7 +125,6 @@ import kubatech.api.LoaderReference; import kubatech.api.helpers.ReflectionHelper; import kubatech.api.implementations.KubaTechGTMultiBlockBase; import kubatech.api.tileentity.CustomTileEntityPacketHandler; -import kubatech.api.utils.FastRandom; import kubatech.client.effect.EntityRenderer; import kubatech.loaders.MobHandlerLoader; import kubatech.network.CustomTileEntityPacket; @@ -618,6 +618,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mGlassTier = 0; + mCasing = 0; if (!checkPiece(STRUCTURE_PIECE_MAIN, 2, 6, 0)) return false; if (mCasing < 35 || mMaintenanceHatches.size() != 1 || mEnergyHatches.size() == 0 |