aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kubatech/loaders
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-28 19:03:53 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-28 19:03:53 -0800
commitf51616bda220887fdd45c4bc951ff59e3398213a (patch)
tree35fdbb15b4c7ea0282773a388eff517a1d09d941 /src/main/java/kubatech/loaders
parent11216d666cbc30fc1e1dfc84e1e0c2f4252b1fc2 (diff)
downloadGT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.tar.gz
GT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.tar.bz2
GT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/kubatech/loaders')
-rw-r--r--src/main/java/kubatech/loaders/BlockLoader.java27
-rw-r--r--src/main/java/kubatech/loaders/ItemLoader.java30
-rw-r--r--src/main/java/kubatech/loaders/MTLoader.java24
-rw-r--r--src/main/java/kubatech/loaders/MobRecipeLoader.java468
-rw-r--r--src/main/java/kubatech/loaders/RecipeLoader.java219
-rw-r--r--src/main/java/kubatech/loaders/TCLoader.java171
-rw-r--r--src/main/java/kubatech/loaders/block/BlockProxy.java28
-rw-r--r--src/main/java/kubatech/loaders/block/IProxyTileEntityProvider.java1
-rw-r--r--src/main/java/kubatech/loaders/block/KubaBlock.java124
-rw-r--r--src/main/java/kubatech/loaders/block/KubaItemBlock.java26
-rw-r--r--src/main/java/kubatech/loaders/block/blocks/TeaAcceptor.java25
-rw-r--r--src/main/java/kubatech/loaders/item/IItemProxyGUI.java4
-rw-r--r--src/main/java/kubatech/loaders/item/ItemProxy.java77
-rw-r--r--src/main/java/kubatech/loaders/item/KubaItems.java48
-rw-r--r--src/main/java/kubatech/loaders/item/items/Tea.java26
-rw-r--r--src/main/java/kubatech/loaders/item/items/TeaCollection.java79
-rw-r--r--src/main/java/kubatech/loaders/item/items/TeaIngredient.java26
-rw-r--r--src/main/java/kubatech/loaders/item/items/TeaUltimate.java221
18 files changed, 750 insertions, 874 deletions
diff --git a/src/main/java/kubatech/loaders/BlockLoader.java b/src/main/java/kubatech/loaders/BlockLoader.java
index 10efcb018f..feed715fa7 100644
--- a/src/main/java/kubatech/loaders/BlockLoader.java
+++ b/src/main/java/kubatech/loaders/BlockLoader.java
@@ -1,33 +1,26 @@
/*
- * 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/>.
- *
+ * 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/>.
*/
package kubatech.loaders;
-import cpw.mods.fml.common.registry.GameRegistry;
import kubatech.api.enums.ItemList;
import kubatech.loaders.block.KubaBlock;
import kubatech.loaders.block.KubaItemBlock;
import kubatech.loaders.block.blocks.TeaAcceptor;
import kubatech.tileentity.TeaAcceptorTile;
+
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemBlock;
+import cpw.mods.fml.common.registry.GameRegistry;
+
public class BlockLoader {
public static final KubaBlock kubaBlock = new KubaBlock(Material.anvil);
diff --git a/src/main/java/kubatech/loaders/ItemLoader.java b/src/main/java/kubatech/loaders/ItemLoader.java
index 31bf042794..a0f28dc391 100644
--- a/src/main/java/kubatech/loaders/ItemLoader.java
+++ b/src/main/java/kubatech/loaders/ItemLoader.java
@@ -1,32 +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 <https://www.gnu.org/licenses/>.
- *
+ * 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/>.
*/
package kubatech.loaders;
import static kubatech.api.enums.ItemList.*;
-import cpw.mods.fml.common.registry.GameRegistry;
import kubatech.loaders.item.ItemProxy;
import kubatech.loaders.item.KubaItems;
import kubatech.loaders.item.items.*;
+import cpw.mods.fml.common.registry.GameRegistry;
public class ItemLoader {
+
public static final KubaItems kubaitems = new KubaItems();
public static void registerItems() {
@@ -74,8 +66,8 @@ public class ItemLoader {
BruisedTeaLeaf.set(kubaitems.registerProxyItem(new TeaIngredient("bruised_tea_leaf")));
PartiallyOxidizedTeaLeaf.set(kubaitems.registerProxyItem(new TeaIngredient("partially_oxidized_tea_leaf")));
- TeaAcceptorResearchNote.set(
- kubaitems.registerProxyItem(new ItemProxy("tea_acceptor_research_note", "research_note")));
+ TeaAcceptorResearchNote
+ .set(kubaitems.registerProxyItem(new ItemProxy("tea_acceptor_research_note", "research_note")));
Beeeeee.set(kubaitems.registerProxyItem(new ItemProxy("beeeeee", "beeeeee")));
}
}
diff --git a/src/main/java/kubatech/loaders/MTLoader.java b/src/main/java/kubatech/loaders/MTLoader.java
index cf0b0b1fd4..d223e83951 100644
--- a/src/main/java/kubatech/loaders/MTLoader.java
+++ b/src/main/java/kubatech/loaders/MTLoader.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 <https://www.gnu.org/licenses/>.
- *
+ * 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/>.
*/
package kubatech.loaders;
@@ -22,6 +13,7 @@ package kubatech.loaders;
import kubatech.Tags;
import kubatech.api.LoaderReference;
import minetweaker.MineTweakerImplementationAPI;
+
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/src/main/java/kubatech/loaders/MobRecipeLoader.java b/src/main/java/kubatech/loaders/MobRecipeLoader.java
index 43fefc2a97..f530b8921b 100644
--- a/src/main/java/kubatech/loaders/MobRecipeLoader.java
+++ b/src/main/java/kubatech/loaders/MobRecipeLoader.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 <https://www.gnu.org/licenses/>.
- *
+ * 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/>.
*/
package kubatech.loaders;
@@ -23,16 +14,6 @@ import static kubatech.api.utils.ModUtils.isClientSided;
import static kubatech.api.utils.ModUtils.isDeobfuscatedEnvironment;
import static kubatech.tileentity.gregtech.multiblock.GT_MetaTileEntity_ExtremeExterminationChamber.*;
-import atomicstryker.infernalmobs.common.InfernalMobsCore;
-import atomicstryker.infernalmobs.common.MobModifier;
-import atomicstryker.infernalmobs.common.mods.api.ModifierLoader;
-import com.google.common.io.Files;
-import com.google.gson.Gson;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.GT_DummyWorld;
import java.io.File;
import java.io.Reader;
import java.io.Writer;
@@ -42,6 +23,7 @@ import java.lang.reflect.Modifier;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
+
import kubatech.Tags;
import kubatech.api.LoaderReference;
import kubatech.api.helpers.EnderIOHelper;
@@ -58,6 +40,7 @@ import minetweaker.MineTweakerAPI;
import minetweaker.api.entity.IEntityDefinition;
import minetweaker.api.item.IItemStack;
import minetweaker.mc1710.item.MCItemStack;
+
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -78,10 +61,24 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.common.MinecraftForge;
+
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+
import stanhebben.zenscript.value.IntRange;
import thaumcraft.common.items.wands.ItemWandCasting;
+import atomicstryker.infernalmobs.common.InfernalMobsCore;
+import atomicstryker.infernalmobs.common.MobModifier;
+import atomicstryker.infernalmobs.common.mods.api.ModifierLoader;
+
+import com.google.common.io.Files;
+import com.google.gson.Gson;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_DummyWorld;
public class MobRecipeLoader {
@@ -108,6 +105,7 @@ public class MobRecipeLoader {
public static final String randomEnchantmentDetectedString = "RandomEnchantmentDetected";
public static class MobRecipe {
+
public final ArrayList<MobDrop> mOutputs;
public final int mEUt = 2000;
public final int mDuration;
@@ -134,15 +132,8 @@ public class MobRecipeLoader {
isUsable);
}
- private MobRecipe(
- ArrayList<MobDrop> mOutputs,
- int mDuration,
- int mMaxDamageChance,
- boolean infernalityAllowed,
- boolean alwaysinfernal,
- boolean isPeacefulAllowed,
- EntityLiving entity,
- float maxEntityHealth,
+ private MobRecipe(ArrayList<MobDrop> mOutputs, int mDuration, int mMaxDamageChance, boolean infernalityAllowed,
+ boolean alwaysinfernal, boolean isPeacefulAllowed, EntityLiving entity, float maxEntityHealth,
boolean isUsable) {
this.mOutputs = mOutputs;
this.mDuration = mDuration;
@@ -164,39 +155,38 @@ public class MobRecipeLoader {
if (infernaldrops == null && LoaderReference.InfernalMobs) {
infernaldrops = new droplist();
LOG.info("Generating Infernal drops");
- ArrayList<ModifierLoader<?>> modifierLoaders = (ArrayList<ModifierLoader<?>>)
- InfernalHelper.getModifierLoaders().clone();
+ ArrayList<ModifierLoader<?>> modifierLoaders = (ArrayList<ModifierLoader<?>>) InfernalHelper
+ .getModifierLoaders().clone();
int i = 0;
for (ModifierLoader<?> modifierLoader : modifierLoaders) {
MobModifier nextMod = modifierLoader.make(null);
- if (nextMod.getBlackListMobClasses() != null)
- for (Class<?> cl : nextMod.getBlackListMobClasses())
- if (e.getClass().isAssignableFrom(cl)) break;
+ if (nextMod.getBlackListMobClasses() != null) for (Class<?> cl : nextMod.getBlackListMobClasses())
+ if (e.getClass().isAssignableFrom(cl)) break;
i++;
}
if (i > 0) {
- double chance =
- InfernalHelper.checkEntityClassForced(e) ? 1d : (1d / InfernalHelper.getEliteRarity());
+ double chance = InfernalHelper.checkEntityClassForced(e) ? 1d
+ : (1d / InfernalHelper.getEliteRarity());
ArrayList<ItemStack> elitelist = InfernalHelper.getDropIdListElite();
for (ItemStack stack : elitelist) {
- dropinstance instance = infernaldrops.add(
- new dropinstance(stack.copy(), infernaldrops), chance / elitelist.size());
+ dropinstance instance = infernaldrops
+ .add(new dropinstance(stack.copy(), infernaldrops), chance / elitelist.size());
instance.isEnchatmentRandomized = true;
instance.enchantmentLevel = stack.getItem().getItemEnchantability();
}
ArrayList<ItemStack> ultralist = InfernalHelper.getDropIdListUltra();
chance *= 1d / InfernalHelper.getUltraRarity();
for (ItemStack stack : ultralist) {
- dropinstance instance = infernaldrops.add(
- new dropinstance(stack.copy(), infernaldrops), chance / ultralist.size());
+ dropinstance instance = infernaldrops
+ .add(new dropinstance(stack.copy(), infernaldrops), chance / ultralist.size());
instance.isEnchatmentRandomized = true;
instance.enchantmentLevel = stack.getItem().getItemEnchantability();
}
ArrayList<ItemStack> infernallist = InfernalHelper.getDropIdListInfernal();
chance *= 1d / InfernalHelper.getInfernoRarity();
for (ItemStack stack : infernallist) {
- dropinstance instance = infernaldrops.add(
- new dropinstance(stack.copy(), infernaldrops), chance / infernallist.size());
+ dropinstance instance = infernaldrops
+ .add(new dropinstance(stack.copy(), infernaldrops), chance / infernallist.size());
instance.isEnchatmentRandomized = true;
instance.enchantmentLevel = stack.getItem().getItemEnchantability();
}
@@ -223,12 +213,8 @@ public class MobRecipeLoader {
mMaxDamageChance = maxdamagechance;
}
- public ItemStack[] generateOutputs(
- Random rnd,
- GT_MetaTileEntity_ExtremeExterminationChamber MTE,
- double attackDamage,
- int lootinglevel,
- boolean preferInfernalDrops) {
+ public ItemStack[] generateOutputs(Random rnd, GT_MetaTileEntity_ExtremeExterminationChamber MTE,
+ double attackDamage, int lootinglevel, boolean preferInfernalDrops) {
MTE.lEUt = mEUt;
MTE.mMaxProgresstime = Math.max(MOB_SPAWN_INTERVAL, (int) ((maxEntityHealth / attackDamage) * 10d));
ArrayList<ItemStack> stacks = new ArrayList<>(mOutputs.size());
@@ -266,8 +252,7 @@ public class MobRecipeLoader {
}
}
- if (infernalityAllowed
- && mEUt * 8 < MTE.getMaxInputVoltage()
+ if (infernalityAllowed && mEUt * 8 < MTE.getMaxInputVoltage()
&& !InfernalHelper.getDimensionBlackList()
.contains(MTE.getBaseMetaTileEntity().getWorld().provider.dimensionId)) {
int p = 0;
@@ -280,23 +265,20 @@ public class MobRecipeLoader {
}
}
ArrayList<ItemStack> infernalstacks = null;
- if (p > 0)
- if (p == 1) {
- infernalstacks = InfernalHelper.getDropIdListElite();
- mods = InfernalHelper.getMinEliteModifiers();
- } else if (p == 2) {
- infernalstacks = InfernalHelper.getDropIdListUltra();
- mods = InfernalHelper.getMinUltraModifiers();
- } else if (p == 3) {
- infernalstacks = InfernalHelper.getDropIdListInfernal();
- mods = InfernalHelper.getMinInfernoModifiers();
- }
+ if (p > 0) if (p == 1) {
+ infernalstacks = InfernalHelper.getDropIdListElite();
+ mods = InfernalHelper.getMinEliteModifiers();
+ } else if (p == 2) {
+ infernalstacks = InfernalHelper.getDropIdListUltra();
+ mods = InfernalHelper.getMinUltraModifiers();
+ } else if (p == 3) {
+ infernalstacks = InfernalHelper.getDropIdListInfernal();
+ mods = InfernalHelper.getMinInfernoModifiers();
+ }
if (infernalstacks != null) {
- ItemStack infernalstack = infernalstacks
- .get(rnd.nextInt(infernalstacks.size()))
- .copy();
- EnchantmentHelper.addRandomEnchantment(
- rnd, infernalstack, infernalstack.getItem().getItemEnchantability());
+ ItemStack infernalstack = infernalstacks.get(rnd.nextInt(infernalstacks.size())).copy();
+ EnchantmentHelper
+ .addRandomEnchantment(rnd, infernalstack, infernalstack.getItem().getItemEnchantability());
stacks.add(infernalstack);
MTE.mEUt *= 8L;
MTE.mMaxProgresstime *= mods * InfernalMobsCore.instance().getMobModHealthFactor();
@@ -308,7 +290,9 @@ public class MobRecipeLoader {
}
public static class fakeRand extends Random {
+
private static class nexter {
+
private final int type;
private final int bound;
private int next;
@@ -413,6 +397,7 @@ public class MobRecipeLoader {
}
private static class dropinstance {
+
public boolean isDamageRandomized = false;
public HashMap<Integer, Integer> damagesPossible = new HashMap<>();
public boolean isEnchatmentRandomized = false;
@@ -441,6 +426,7 @@ public class MobRecipeLoader {
}
public static class droplist {
+
private final ArrayList<dropinstance> drops = new ArrayList<>();
private final HashMap<GT_Utility.ItemId, Integer> dropschecker = new HashMap<>();
@@ -492,6 +478,7 @@ public class MobRecipeLoader {
}
private static class dropCollector {
+
final HashMap<GT_Utility.ItemId, Integer> damagableChecker = new HashMap<>();
private boolean booksAlwaysRandomlyEnchanted = false;
@@ -500,8 +487,8 @@ public class MobRecipeLoader {
ItemStack ostack = entityItem.getEntityItem();
if (ostack == null) continue;
dropinstance drop;
- boolean randomchomenchantdetected =
- ostack.hasTagCompound() && ostack.stackTagCompound.hasKey(randomEnchantmentDetectedString);
+ boolean randomchomenchantdetected = ostack.hasTagCompound()
+ && ostack.stackTagCompound.hasKey(randomEnchantmentDetectedString);
int randomenchantmentlevel = 0;
if (randomchomenchantdetected) {
randomenchantmentlevel = ostack.stackTagCompound.getInteger(randomEnchantmentDetectedString);
@@ -559,6 +546,7 @@ public class MobRecipeLoader {
}
public static class GeneralMappedMob {
+
public final EntityLiving mob;
public final MobRecipe recipe;
public final ArrayList<MobDrop> drops;
@@ -573,11 +561,12 @@ public class MobRecipeLoader {
public static final HashMap<String, GeneralMappedMob> GeneralMobList = new HashMap<>();
private static class MobRecipeLoaderCacheStructure {
+
String version;
Map<String, ArrayList<MobDrop>> moblist;
}
- @SuppressWarnings({"unchecked", "UnstableApiUsage"})
+ @SuppressWarnings({ "unchecked", "UnstableApiUsage" })
public static void generateMobRecipeMap() {
if (alreadyGenerated) return;
@@ -585,6 +574,7 @@ public class MobRecipeLoader {
if (!Config.MobHandler.mobHandlerEnabled) return;
World f = new GT_DummyWorld() {
+
@Override
public boolean blockExists(int p_72899_1_, int p_72899_2_, int p_72899_3_) {
return false;
@@ -598,11 +588,8 @@ public class MobRecipeLoader {
@Override
public Block getBlock(int aX, int aY, int aZ) {
- if (LoaderReference.TwilightForest
- && new Throwable()
- .getStackTrace()[1]
- .getClassName()
- .equals("twilightforest.client.renderer.entity.RenderTFSnowQueenIceShield"))
+ if (LoaderReference.TwilightForest && new Throwable().getStackTrace()[1].getClassName()
+ .equals("twilightforest.client.renderer.entity.RenderTFSnowQueenIceShield"))
return Blocks.packed_ice;
return super.getBlock(aX, aY, aZ);
}
@@ -637,17 +624,14 @@ public class MobRecipeLoader {
&& !EntityList.stringToClassMapping.containsKey("witherSkeleton")) {
e = new EntitySkeleton(f);
((EntitySkeleton) e).setSkeletonType(1);
- } else
- e = (EntityLiving) ((Class<?>) EntityList.stringToClassMapping.get(mobName))
- .getConstructor(new Class[] {World.class})
- .newInstance(new Object[] {f});
+ } else e = (EntityLiving) ((Class<?>) EntityList.stringToClassMapping.get(mobName))
+ .getConstructor(new Class[] { World.class }).newInstance(new Object[] { f });
ArrayList<MobDrop> drops = entry.getValue();
drops.forEach(MobDrop::reconstructStack);
GeneralMobList.put(
mobName,
new GeneralMappedMob(e, MobRecipe.generateMobRecipe(e, mobName, drops), drops));
- } catch (Exception ignored) {
- }
+ } catch (Exception ignored) {}
}
LOG.info("Parsed cached map, skipping generation");
return;
@@ -657,11 +641,9 @@ public class MobRecipeLoader {
} catch (Exception ignored) {
LOG.warn("There was an exception while parsing cached map, generating a new one");
} finally {
- if (reader != null)
- try {
- reader.close();
- } catch (Exception ignored) {
- }
+ if (reader != null) try {
+ reader.close();
+ } catch (Exception ignored) {}
}
} else {
LOG.info("Cached map doesn't exist or config option forced, generating a new one");
@@ -702,8 +684,7 @@ public class MobRecipeLoader {
dropCollector collector = new dropCollector();
// Stupid MC code, I need to cast myself
- Map<String, Class<? extends Entity>> stringToClassMapping =
- (Map<String, Class<? extends Entity>>) EntityList.stringToClassMapping;
+ Map<String, Class<? extends Entity>> stringToClassMapping = (Map<String, Class<? extends Entity>>) EntityList.stringToClassMapping;
boolean registeringWitherSkeleton = !stringToClassMapping.containsKey("witherSkeleton");
if (registeringWitherSkeleton) stringToClassMapping.put("witherSkeleton", EntitySkeleton.class);
@@ -717,7 +698,7 @@ public class MobRecipeLoader {
EntityLiving e;
try {
- e = (EntityLiving) v.getConstructor(new Class[] {World.class}).newInstance(new Object[] {f});
+ e = (EntityLiving) v.getConstructor(new Class[] { World.class }).newInstance(new Object[] { f });
} catch (ClassCastException ex) {
// not a EntityLiving
LOG.info("Entity " + k + " is not a LivingEntity, skipping");
@@ -746,13 +727,12 @@ public class MobRecipeLoader {
// POWERFULL GENERATION
- if (e instanceof EntitySlime)
- try {
- setSlimeSize.invoke(e, 1);
- } catch (Exception ex) {
- ex.printStackTrace();
- return;
- }
+ if (e instanceof EntitySlime) try {
+ setSlimeSize.invoke(e, 1);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ return;
+ }
try {
rand.set(e, frand);
@@ -909,95 +889,94 @@ public class MobRecipeLoader {
int max = Math.max(maxdamage - 25, 1);
for (int d = Math.min(max, 25); d <= max; d++) i.damagesPossible.put(d, 1);
additionaldrops.add(i, 1d);
- } else
- try {
- Class<?> cl = e.getClass();
- boolean detectedException;
- do {
- detectedException = false;
- try {
- cl.getDeclaredMethod(addRandomArmorName);
- } catch (Exception ex) {
- detectedException = true;
- cl = cl.getSuperclass();
- }
- } while (detectedException && !cl.equals(Entity.class));
- if (cl.equals(EntityLiving.class) || cl.equals(Entity.class)) throw new Exception();
- cl = e.getClass();
- do {
- detectedException = false;
- try {
- cl.getDeclaredMethod(enchantEquipmentName);
- } catch (Exception ex) {
- detectedException = true;
- cl = cl.getSuperclass();
- }
- } while (detectedException && !cl.equals(EntityLiving.class));
- boolean usingVanillaEnchantingMethod = cl.equals(EntityLiving.class);
- double chanceModifierLocal = 1f;
- if (v.getName().startsWith("twilightforest.entity")) {
- frand.forceFloatValue = 0f;
- chanceModifierLocal = 0.25f;
+ } else try {
+ Class<?> cl = e.getClass();
+ boolean detectedException;
+ do {
+ detectedException = false;
+ try {
+ cl.getDeclaredMethod(addRandomArmorName);
+ } catch (Exception ex) {
+ detectedException = true;
+ cl = cl.getSuperclass();
+ }
+ } while (detectedException && !cl.equals(Entity.class));
+ if (cl.equals(EntityLiving.class) || cl.equals(Entity.class)) throw new Exception();
+ cl = e.getClass();
+ do {
+ detectedException = false;
+ try {
+ cl.getDeclaredMethod(enchantEquipmentName);
+ } catch (Exception ex) {
+ detectedException = true;
+ cl = cl.getSuperclass();
}
- second = false;
- do {
- addRandomArmor.invoke(e);
- if (!usingVanillaEnchantingMethod) enchantEquipment.invoke(e);
- ItemStack[] lastActiveItems = e.getLastActiveItems();
- for (int j = 0, lastActiveItemsLength = lastActiveItems.length;
- j < lastActiveItemsLength;
- j++) {
- ItemStack stack = lastActiveItems[j];
- if (stack != null) {
- if (LoaderReference.Thaumcraft)
- if (stack.getItem() instanceof ItemWandCasting)
- continue; // crashes the game when rendering in GUI
-
- int randomenchant = -1;
- if (stack.hasTagCompound()
- && stack.stackTagCompound.hasKey(randomEnchantmentDetectedString)) {
- randomenchant = stack.stackTagCompound.getInteger(randomEnchantmentDetectedString);
- stack.stackTagCompound.removeTag("ench");
- }
- dropinstance i = additionaldrops.add(
+ } while (detectedException && !cl.equals(EntityLiving.class));
+ boolean usingVanillaEnchantingMethod = cl.equals(EntityLiving.class);
+ double chanceModifierLocal = 1f;
+ if (v.getName().startsWith("twilightforest.entity")) {
+ frand.forceFloatValue = 0f;
+ chanceModifierLocal = 0.25f;
+ }
+ second = false;
+ do {
+ addRandomArmor.invoke(e);
+ if (!usingVanillaEnchantingMethod) enchantEquipment.invoke(e);
+ ItemStack[] lastActiveItems = e.getLastActiveItems();
+ for (int j = 0, lastActiveItemsLength = lastActiveItems.length; j < lastActiveItemsLength; j++) {
+ ItemStack stack = lastActiveItems[j];
+ if (stack != null) {
+ if (LoaderReference.Thaumcraft) if (stack.getItem() instanceof ItemWandCasting) continue; // crashes
+ // the
+ // game
+ // when
+ // rendering
+ // in
+ // GUI
+
+ int randomenchant = -1;
+ if (stack.hasTagCompound()
+ && stack.stackTagCompound.hasKey(randomEnchantmentDetectedString)) {
+ randomenchant = stack.stackTagCompound.getInteger(randomEnchantmentDetectedString);
+ stack.stackTagCompound.removeTag("ench");
+ }
+ dropinstance i = additionaldrops.add(
+ new dropinstance(stack.copy(), additionaldrops),
+ frand.chance * chanceModifierLocal
+ * (usingVanillaEnchantingMethod ? (j == 0 ? 0.75d : 0.5d) : 1d));
+ if (!i.isDamageRandomized && i.stack.isItemStackDamageable()) {
+ i.isDamageRandomized = true;
+