aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkuba6000 <kuba.123123.6000@gmail.com>2022-09-13 00:29:27 +0200
committerkuba6000 <kuba.123123.6000@gmail.com>2022-09-13 00:29:27 +0200
commitdd42cfa23bbc1ff1db6a4af68483d77c29cb2aba (patch)
tree6661227959c6630aa8d3f11708e7ed03a92b6a07 /src
parente90ac394115b9db02ee598bfeedf0f23b2859135 (diff)
downloadGT5-Unofficial-dd42cfa23bbc1ff1db6a4af68483d77c29cb2aba.tar.gz
GT5-Unofficial-dd42cfa23bbc1ff1db6a4af68483d77c29cb2aba.tar.bz2
GT5-Unofficial-dd42cfa23bbc1ff1db6a4af68483d77c29cb2aba.zip
Stone sword
Diffstat (limited to 'src')
-rw-r--r--src/main/java/kubatech/loaders/MobRecipeLoader.java170
1 files changed, 90 insertions, 80 deletions
diff --git a/src/main/java/kubatech/loaders/MobRecipeLoader.java b/src/main/java/kubatech/loaders/MobRecipeLoader.java
index cacc2d4e42..ed1e55e05b 100644
--- a/src/main/java/kubatech/loaders/MobRecipeLoader.java
+++ b/src/main/java/kubatech/loaders/MobRecipeLoader.java
@@ -880,92 +880,102 @@ public class MobRecipeLoader {
frand.newRound();
collector.newRound();
- 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();
+ if (registeringWitherSkeleton && e instanceof EntitySkeleton && k.equals("witherSkeleton")) {
+ dropinstance i = new dropinstance(new ItemStack(Items.stone_sword), additionaldrops);
+ i.isDamageRandomized = true;
+ int maxdamage = i.stack.getMaxDamage();
+ 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;
}
- } 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;
- int maxdamage = i.stack.getMaxDamage();
- int max = Math.max(maxdamage - 25, 1);
- for (int d = Math.min(max, 25); d <= max; d++) i.damagesPossible.put(d, 1);
- }
- if (!i.isEnchatmentRandomized && randomenchant != -1) {
- i.isEnchatmentRandomized = true;
- i.enchantmentLevel = randomenchant;
- }
- if (usingVanillaEnchantingMethod) {
- if (!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
- stack.stackTagCompound.setInteger(randomEnchantmentDetectedString, 14);
- dropinstance newdrop = additionaldrops.add(
+ 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 * (j == 0 ? 0.25d : 0.5d));
- newdrop.isEnchatmentRandomized = true;
- newdrop.enchantmentLevel = 14;
- newdrop.isDamageRandomized = i.isDamageRandomized;
- newdrop.damagesPossible = (HashMap<Integer, Integer>) i.damagesPossible.clone();
+ frand.chance
+ * chanceModifierLocal
+ * (usingVanillaEnchantingMethod ? (j == 0 ? 0.75d : 0.5d) : 1d));
+ if (!i.isDamageRandomized && i.stack.isItemStackDamageable()) {
+ i.isDamageRandomized = true;
+ int maxdamage = i.stack.getMaxDamage();
+ int max = Math.max(maxdamage - 25, 1);
+ for (int d = Math.min(max, 25); d <= max; d++) i.damagesPossible.put(d, 1);
+ }
+ if (!i.isEnchatmentRandomized && randomenchant != -1) {
+ i.isEnchatmentRandomized = true;
+ i.enchantmentLevel = randomenchant;
+ }
+ if (usingVanillaEnchantingMethod) {
+ if (!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
+ stack.stackTagCompound.setInteger(randomEnchantmentDetectedString, 14);
+ dropinstance newdrop = additionaldrops.add(
+ new dropinstance(stack.copy(), additionaldrops),
+ frand.chance * chanceModifierLocal * (j == 0 ? 0.25d : 0.5d));
+ newdrop.isEnchatmentRandomized = true;
+ newdrop.enchantmentLevel = 14;
+ newdrop.isDamageRandomized = i.isDamageRandomized;
+ newdrop.damagesPossible = (HashMap<Integer, Integer>) i.damagesPossible.clone();
+ }
}
}
- }
- Arrays.fill(e.getLastActiveItems(), null);
+ Arrays.fill(e.getLastActiveItems(), null);
- if (second && frand.chance < 0.0000001d) {
- LOG.warn("Skipping " + k + " additional dropmap because it's too randomized");
- break;
- }
- second = true;
+ if (second && frand.chance < 0.0000001d) {
+ LOG.warn("Skipping " + k + " additional dropmap because it's too randomized");
+ break;
+ }
+ second = true;
- } while (frand.nextRound());
- } catch (Exception ignored) {
- }
+ } while (frand.nextRound());
+ } catch (Exception ignored) {
+ }
frand.newRound();
collector.newRound();