diff --git a/.gitignore b/.gitignore index 0501d83e5b..f6cd8e8a4d 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ # Mac OS X .DS_Store +builds +fb diff --git a/build.gradle b/build.gradle index 671ea9cea4..fc480e0037 100644 --- a/build.gradle +++ b/build.gradle @@ -21,8 +21,11 @@ version = "2.3.8dev" group= "twilightforest" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "twilightforest-1.7.10" +sourceCompatibility = 7 +targetCompatibility = 7 + minecraft { - version = "1.7.10-10.13.4.1558-1.7.10" + version = "1.7.10-10.13.4.1614-1.7.10" runDir = "eclipse" } @@ -63,3 +66,21 @@ processResources exclude 'mcmod.info' } } + +task sourceJar(type: Jar) { + from sourceSets.main.allSource + classifier = 'sources' +} + +task devJar(type: Jar) { + from sourceSets.main.output + classifier = 'dev' + manifest { + //attributes 'FMLCorePlugin': 'WhateverLoaderClass' + //attributes 'FMLCorePluginContainsFMLMod': 'true' + } +} + +artifacts { + archives devJar +} diff --git a/src/main/java/org/bogdang/modifications/math/MathHelperLite.java b/src/main/java/org/bogdang/modifications/math/MathHelperLite.java new file mode 100644 index 0000000000..8c327f5c24 --- /dev/null +++ b/src/main/java/org/bogdang/modifications/math/MathHelperLite.java @@ -0,0 +1,434 @@ +package org.bogdang.modifications.math; + +/* Author: Bogdan-G + * 15.08.2016 version 0.2.0 + * modifer MC MathHelper + * return cache value, integer values (no fractional) + * enter float or double type and return + */ +public final class MathHelperLite +{ + private static float[] SIN_TABLE = new float[361]; + private static float[] COS_TABLE = new float[361]; + private static float[] TG_TABLE = new float[361]; + private static float[] CTG_TABLE = new float[361]; + + /* + * Float func + */ + + public static final float sin(final float value) + { + //temp - crutch + final int temp; + if (value > 0) + { + if ((int)value > 360f) + { + if ((temp=((int)value-((int)(value / 360f))*360)) != 0) + { + return SIN_TABLE[temp]; + } + else + { + return SIN_TABLE[360]; + } + } + else + { + return SIN_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360f) + { + if ((temp=(-((int)value-((int)(value / 360f))*360))) != 0) + { + return SIN_TABLE[temp]; + } + else + { + return SIN_TABLE[360]; + } + } + else + { + return SIN_TABLE[-(int)(value)]; + } + //return SIN_TABLE[(int)(value)];//? + } + + public static final float cos(final float value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360f) + { + if ((temp=((int)value-((int)(value / 360f))*360)) != 0) + { + return COS_TABLE[temp]; + } + else + { + return COS_TABLE[360]; + } + } + else + { + return COS_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360f) + { + if ((temp=(-((int)value-((int)(value / 360f))*360))) != 0) + { + return COS_TABLE[temp]; + } + else + { + return COS_TABLE[360]; + } + } + else + { + return COS_TABLE[-(int)(value)]; + } + //return COS_TABLE[(int)(value)]; + } + + public static final float tg(final float value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360f) + { + if ((temp=((int)value-((int)(value / 360f))*360)) != 0) + { + return TG_TABLE[temp]; + } + else + { + return TG_TABLE[360]; + } + } + else + { + return TG_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360f) + { + if ((temp=(-((int)value-((int)(value / 360f))*360))) != 0) + { + return TG_TABLE[temp]; + } + else + { + return TG_TABLE[360]; + } + } + else + { + return TG_TABLE[-(int)(value)]; + } + //return TG_TABLE[(int)(value)]; + } + + public static final float tan(final float value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360f) + { + if ((temp=((int)value-((int)(value / 360f))*360)) != 0) + { + return TG_TABLE[temp]; + } + else + { + return TG_TABLE[360]; + } + } + else + { + return TG_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360f) + { + if ((temp=(-((int)value-((int)(value / 360f))*360))) != 0) + { + return TG_TABLE[temp]; + } + else + { + return TG_TABLE[360]; + } + } + else + { + return TG_TABLE[-(int)(value)]; + } + //return TG_TABLE[(int)(value)]; + } + + public static final float ctg(final float value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360f) + { + if ((temp=((int)value-((int)(value / 360f))*360)) != 0) + { + return CTG_TABLE[temp]; + } + else + { + return CTG_TABLE[360]; + } + } + else + { + return CTG_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360f) + { + if ((temp=(-((int)value-((int)(value / 360f))*360))) != 0) + { + return CTG_TABLE[temp]; + } + else + { + return CTG_TABLE[360]; + } + } + else + { + return CTG_TABLE[-(int)(value)]; + } + //return CTG_TABLE[(int)(value)]; + } + + /* + * Double func + */ + + public static final double sin(final double value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360d) + { + if ((temp=((int)value-((int)(value / 360d))*360)) != 0) + { + return (double)SIN_TABLE[temp]; + } + else + { + return (double)SIN_TABLE[360]; + } + } + else + { + return (double)SIN_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360d) + { + if ((temp=(-((int)value-((int)(value / 360d))*360))) != 0) + { + return (double)SIN_TABLE[temp]; + } + else + { + return (double)SIN_TABLE[360]; + } + } + else + { + return (double)SIN_TABLE[-(int)(value)]; + } + //return (double)SIN_TABLE[(int)(value)]; + } + + public static final double cos(final double value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360d) + { + if ((temp=((int)value-((int)(value / 360d))*360)) != 0) + { + return (double)COS_TABLE[temp]; + } + else + { + return (double)COS_TABLE[360]; + } + } + else + { + return (double)COS_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360d) + { + if ((temp=(-((int)value-((int)(value / 360d))*360))) != 0) + { + return (double)COS_TABLE[temp]; + } + else + { + return (double)COS_TABLE[360]; + } + } + else + { + return (double)COS_TABLE[-(int)(value)]; + } + //return (double)COS_TABLE[(int)(value)]; + } + + public static final double tg(final double value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360d) + { + if ((temp=((int)value-((int)(value / 360d))*360)) != 0) + { + return (double)TG_TABLE[temp]; + } + else + { + return (double)TG_TABLE[360]; + } + } + else + { + return (double)TG_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360d) + { + if ((temp=(-((int)value-((int)(value / 360d))*360))) != 0) + { + return (double)TG_TABLE[temp]; + } + else + { + return (double)TG_TABLE[360]; + } + } + else + { + return (double)TG_TABLE[-(int)(value)]; + } + //return (double)TG_TABLE[(int)(value)]; + } + + public static final double tan(final double value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360d) + { + if ((temp=((int)value-((int)(value / 360d))*360)) != 0) + { + return (double)TG_TABLE[temp]; + } + else + { + return (double)TG_TABLE[360]; + } + } + else + { + return (double)TG_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360d) + { + if ((temp=(-((int)value-((int)(value / 360d))*360))) != 0) + { + return (double)TG_TABLE[temp]; + } + else + { + return (double)TG_TABLE[360]; + } + } + else + { + return (double)TG_TABLE[-(int)(value)]; + } + //return (double)TG_TABLE[(int)(value)]; + } + + public static final double ctg(final double value) + { + final int temp; + if (value > 0) + { + if ((int)value > 360d) + { + if ((temp=((int)value-((int)(value / 360d))*360)) != 0) + { + return (double)CTG_TABLE[temp]; + } + else + { + return (double)CTG_TABLE[360]; + } + } + else + { + return (double)CTG_TABLE[(int)(value)]; + } + } + else if ((-(int)value) > 360d) + { + if ((temp=(-((int)value-((int)(value / 360d))*360))) != 0) + { + return (double)CTG_TABLE[temp]; + } + else + { + return (double)CTG_TABLE[360]; + } + } + else + { + return (double)CTG_TABLE[-(int)(value)]; + } + //return (double)CTG_TABLE[(int)(value)]; + } + + static + { + for (int i = 0; i < 361; i++) + { + SIN_TABLE[i] = (float)Math.sin((double)i); + } + for (int i = 0; i < 361; i++) + { + COS_TABLE[i] = (float)Math.cos((double)i); + } + for (int i = 0; i < 361; i++) + { + TG_TABLE[i] = (float)Math.tan((double)i); + } + for (int i = 0; i < 361; i++) + { + CTG_TABLE[i] = 1f/((float)Math.tan((double)i)); + } + } +} \ No newline at end of file diff --git a/src/main/java/org/bogdang/modifications/math/TrigMath2.java b/src/main/java/org/bogdang/modifications/math/TrigMath2.java new file mode 100644 index 0000000000..96ac5d1b6e --- /dev/null +++ b/src/main/java/org/bogdang/modifications/math/TrigMath2.java @@ -0,0 +1,110 @@ +package org.bogdang.modifications.math; + +/** + * Credits for this class goes to user aioobe on stackoverflow.com + * Source: http://stackoverflow.com/questions/4454630/j2me-calculate-the-the-distance-between-2-latitude-and-longitude + * J2ME? wut? + * Modified by Bogdan-G, 29.11.2016, ver mod 0.2 + */ +public class TrigMath2 { + + static final double sq2p1 = 2.414213562373095048802e0; + static final double sq2m1 = .414213562373095048802e0; + static final double p4 = .161536412982230228262e2; + static final double p3 = .26842548195503973794141e3; + static final double p2 = .11530293515404850115428136e4; + static final double p1 = .178040631643319697105464587e4; + static final double p0 = .89678597403663861959987488e3; + static final double q4 = .5895697050844462222791e2; + static final double q3 = .536265374031215315104235e3; + static final double q2 = .16667838148816337184521798e4; + static final double q1 = .207933497444540981287275926e4; + static final double q0 = .89678597403663861962481162e3; + static final double PIO2 = 1.5707963267948966135E0; + + static final float sq2p1f = 2.414213562373095048802e0f; + static final float sq2m1f = .414213562373095048802e0f; + static final float p4f = .161536412982230228262e2f; + static final float p3f = .26842548195503973794141e3f; + static final float p2f = .11530293515404850115428136e4f; + static final float p1f = .178040631643319697105464587e4f; + static final float p0f = .89678597403663861959987488e3f; + static final float q4f = .5895697050844462222791e2f; + static final float q3f = .536265374031215315104235e3f; + static final float q2f = .16667838148816337184521798e4f; + static final float q1f = .207933497444540981287275926e4f; + static final float q0f = .89678597403663861962481162e3f; + static final float PIO2f = 1.5707963267948966135E0f; + + private static double mxatan(double arg) { + double argsq = arg * arg, value; + + value = ((((p4 * argsq + p3) * argsq + p2) * argsq + p1) * argsq + p0); + value = value / (((((argsq + q4) * argsq + q3) * argsq + q2) * argsq + q1) * argsq + q0); + return value * arg; + } + + private static double msatan(double arg) { + return arg < sq2m1 ? mxatan(arg) + : arg > sq2p1 ? PIO2 - mxatan(1 / arg) + : PIO2 / 2 + mxatan((arg - 1) / (arg + 1)); + } + + public static double atan(double arg) { + return arg > 0 ? msatan(arg) : -msatan(-arg); + } + + public static double atan2(double arg1, double arg2) { + if (arg1 + arg2 == arg1) + return arg1 == 0 ? 0 : arg1 > 0 ? PIO2 : -PIO2; + arg1 = atan(arg1 / arg2); + return arg2 < 0 ? arg1 <= 0 ? arg1 + Math.PI : arg1 - Math.PI : arg1; + } + + private static float mxatan(float arg) { + float argsq = arg * arg, value; + + value = ((((p4f * argsq + p3f) * argsq + p2f) * argsq + p1f) * argsq + p0f); + value = value / (((((argsq + q4f) * argsq + q3f) * argsq + q2f) * argsq + q1f) * argsq + q0f); + return value * arg; + } + + private static float msatan(float arg) { + return arg < sq2m1f ? mxatan(arg) + : arg > sq2p1f ? PIO2f - mxatan(1f / arg) + : PIO2f / 2 + mxatan((arg - 1f) / (arg + 1f)); + } + + public static float atan(float arg) { + return arg > 0 ? msatan(arg) : -msatan(-arg); + } + + public static float atan2(float arg1, float arg2) { + if (arg1 + arg2 == arg1) + return arg1 == 0 ? 0 : arg1 > 0 ? PIO2f : -PIO2f; + arg1 = atan(arg1 / arg2); + return arg2 < 0 ? arg1 <= 0 ? arg1 + (float)Math.PI : arg1 - (float)Math.PI : arg1; + } + + public static double atan(int arg) { + return arg > 0 ? msatan((double)arg) : -msatan(-(double)arg); + } + + public static double atan2(int arg1, int arg2) { + if (arg1 + arg2 == arg1) + return arg1 == 0 ? 0 : arg1 > 0 ? PIO2 : -PIO2; + arg1 = (int)atan((double)arg1 / (double)arg2); + return arg2 < 0 ? arg1 <= 0 ? arg1 + Math.PI : arg1 - Math.PI : (double)arg1; + } + + public static double atan(short arg) { + return arg > 0 ? msatan((double)arg) : -msatan(-(double)arg); + } + + public static double atan2(short arg1, short arg2) { + if (arg1 + arg2 == arg1) + return arg1 == 0 ? 0 : arg1 > 0 ? PIO2 : -PIO2; + arg1 = (short)atan((double)arg1 / (double)arg2); + return arg2 < 0 ? arg1 <= 0 ? arg1 + Math.PI : arg1 - Math.PI : (double)arg1; + } +} \ No newline at end of file diff --git a/src/main/java/org/bogdang/modifications/random/XSTR.java b/src/main/java/org/bogdang/modifications/random/XSTR.java new file mode 100644 index 0000000000..84d095a0b3 --- /dev/null +++ b/src/main/java/org/bogdang/modifications/random/XSTR.java @@ -0,0 +1,255 @@ +package org.bogdang.modifications.random; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; + +/** + * A subclass of java.util.random that implements the Xorshift random number + * generator + * + * - it is 30% faster than the generator from Java's library - it produces + * random sequences of higher quality than java.util.Random - this class also + * provides a clone() function + * + * Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt(); + * //pull a random number + * + * To use the class in legacy code, you may also instantiate an XSRandom object + * and assign it to a java.util.Random object: java.util.Random rand = new + * XSRandom(); + * + * for an explanation of the algorithm, see + * http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html + * + * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs + * http://www.elmenreich.tk + * + * This code is released under the GNU Lesser General Public License Version 3 + * http://www.gnu.org/licenses/lgpl-3.0.txt + */ + + /** + * XSTR - Xorshift ThermiteRandom + * Modified by Bogdan-G + * 03.06.2016 + * version 0.0.4 + */ +public class XSTR extends Random { + + private static final long serialVersionUID = 6208727693524452904L; + private long seed; + private long last; + private static final long GAMMA = 0x9e3779b97f4a7c15L; + private static final int PROBE_INCREMENT = 0x9e3779b9; + private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) + private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + + /* + MODIFIED BY: Robotia + Modification: Implemented Random class seed generator + */ + /** + * Creates a new pseudo random number generator. The seed is initialized to + * the current time, as if by + * setSeed(System.currentTimeMillis());. + */ + public XSTR() { + this(seedUniquifier() ^ System.nanoTime()); + } + private static final AtomicLong seedUniquifier + = new AtomicLong(8682522807148012L); + + private static long seedUniquifier() { + // L'Ecuyer, "Tables of Linear Congruential Generators of + // Different Sizes and Good Lattice Structure", 1999 + for (;;) { + long current = seedUniquifier.get(); + long next = current * 181783497276652981L; + if (seedUniquifier.compareAndSet(current, next)) { + return next; + } + } + } + + /** + * Creates a new pseudo random number generator, starting with the specified + * seed, using setSeed(seed);. + * + * @param seed the initial seed + */ + public XSTR(long seed) { + this.seed = seed; + } + public boolean nextBoolean() { + return next(1) != 0; + } + + public double nextDouble() { + return (((long)(next(26)) << 27) + next(27)) * DOUBLE_UNIT; + } + /** + * Returns the current state of the seed, can be used to clone the object + * + * @return the current seed + */ + public synchronized long getSeed() { + return seed; + } + + /** + * Sets the seed for this pseudo random number generator. As described + * above, two instances of the same random class, starting with the same + * seed, produce the same results, if the same methods are called. + * + * @param seed the new seed + */ + public synchronized void setSeed(long seed) { + this.seed = seed; + } + + /** + * @return Returns an XSRandom object with the same state as the original + */ + @Override + public XSTR clone() { + return new XSTR(getSeed()); + } + + /** + * Implementation of George Marsaglia's elegant Xorshift random generator + * 30% faster and better quality than the built-in java.util.random see also + * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml + * + * @param nbits + * @return + */ + public int next(int nbits) { + long x = seed; + x ^= (x << 21); + x ^= (x >>> 35); + x ^= (x << 4); + seed = x; + x &= ((1L << nbits) - 1); + return (int) x; + } + boolean haveNextNextGaussian = false; + double nextNextGaussian = 0; + synchronized public double nextGaussian() { + // See Knuth, ACP, Section 3.4.1 Algorithm C. + if (haveNextNextGaussian) { + haveNextNextGaussian = false; + return nextNextGaussian; + } else { + double v1, v2, s; + do { + v1 = 2 * nextDouble() - 1; // between -1 and 1 + v2 = 2 * nextDouble() - 1; // between -1 and 1 + s = v1 * v1 + v2 * v2; + } while (s >= 1 || s == 0); + double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s)/s); + nextNextGaussian = v2 * multiplier; + haveNextNextGaussian = true; + return v1 * multiplier; + } + } + /** + * Returns a pseudorandom, uniformly distributed {@code int} value between 0 + * (inclusive) and the specified value (exclusive), drawn from this random + * number generator's sequence. The general contract of {@code nextInt} is + * that one {@code int} value in the specified range is pseudorandomly + * generated and returned. All {@code bound} possible {@code int} values are + * produced with (approximately) equal probability. The method + * {@code nextInt(int bound)} is implemented by class {@code Random} as if + * by: + *
 {@code
+     * public int nextInt(int bound) {
+     *   if (bound <= 0)
+     *     throw new IllegalArgumentException("bound must be positive");
+     *
+     *   if ((bound & -bound) == bound)  // i.e., bound is a power of 2
+     *     return (int)((bound * (long)next(31)) >> 31);
+     *
+     *   int bits, val;
+     *   do {
+     *       bits = next(31);
+     *       val = bits % bound;
+     *   } while (bits - val + (bound-1) < 0);
+     *   return val;
+     * }}
+ * + *

The hedge "approx + * imately" is used in the foregoing description only because the next + * method is only approximately an unbiased source of independently chosen + * bits. If it were a perfect source of randomly chosen bits, then the + * algorithm shown would choose {@code int} values from the stated range + * with perfect uniformity. + *

+ * The algorithm is slightly tricky. It rejects values that would result in + * an uneven distribution (due to the fact that 2^31 is not divisible by n). + * The probability of a value being rejected depends on n. The worst case is + * n=2^30+1, for which the probability of a reject is 1/2, and the expected + * number of iterations before the loop terminates is 2. + *

+ * The algorithm treats the case where n is a power of two specially: it + * returns the correct number of high-order bits from the underlying + * pseudo-random number generator. In the absence of special treatment, the + * correct number of low-order bits would be returned. Linear + * congruential pseudo-random number generators such as the one implemented + * by this class are known to have short periods in the sequence of values + * of their low-order bits. Thus, this special case greatly increases the + * length of the sequence of values returned by successive calls to this + * method if n is a small power of two. + * + * @param bound the upper bound (exclusive). Must be positive. + * @return the next pseudorandom, uniformly distributed {@code int} value + * between zero (inclusive) and {@code bound} (exclusive) from this random + * number generator's sequence + * @throws IllegalArgumentException if bound is not positive + * @since 1.2 + */ + public int nextInt(int bound) { + //if (bound <= 0) { + //throw new RuntimeException("BadBound"); + //} + + /*int r = next(31); + int m = bound - 1; + if ((bound & m) == 0) // i.e., bound is a power of 2 + { + r = (int) ((bound * (long) r) >> 31); + } else { + for (int u = r; + u - (r = u % bound) + m < 0; + u = next(31)) + ; + } + return r;*/ + //speedup, new nextInt ~+40% + last = seed ^ (seed << 21); + last ^= (last >>> 35); + last ^= (last << 4); + seed = last; + int out = (int) last % bound; + return (out < 0) ? -out : out; + } + public int nextInt() { + return next(32); + } + + public float nextFloat() { + return next(24) * FLOAT_UNIT; + } + + public long nextLong() { + // it's okay that the bottom word remains signed. + return ((long)(next(32)) << 32) + next(32); + } + + public void nextBytes(byte[] bytes_arr) { + for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) + for (int rndba = nextInt(), + nba = Math.min(lenba - iba, Integer.SIZE/Byte.SIZE); + nba-- > 0; rndba >>= Byte.SIZE) + bytes_arr[iba++] = (byte)rndba; + } +} \ No newline at end of file diff --git a/src/main/java/twilightforest/TFEventListener.java b/src/main/java/twilightforest/TFEventListener.java index 7272edcf84..1b84526a79 100644 --- a/src/main/java/twilightforest/TFEventListener.java +++ b/src/main/java/twilightforest/TFEventListener.java @@ -85,6 +85,7 @@ public class TFEventListener { */ @SubscribeEvent public void pickupItem(EntityItemPickupEvent event) { + if (event.entityPlayer.worldObj.provider.dimensionId == TwilightForestMod.dimensionID) { Item item = event.item.getEntityItem().getItem(); if (item == TFItems.scepterTwilight || item == TFItems.scepterLifeDrain || item == TFItems.scepterZombie) { @@ -143,6 +144,7 @@ public void pickupItem(EntityItemPickupEvent event) { if (item == TFItems.lampOfCinders) { event.entityPlayer.triggerAchievement(TFAchievementPage.twilightProgressTroll); } + } } /** @@ -191,29 +193,33 @@ public void onCrafting(ItemCraftedEvent event) { ItemStack itemStack = event.crafting; EntityPlayer player = event.player; + boolean isTFdim = player.worldObj.provider.dimensionId == TwilightForestMod.dimensionID; + Item item = itemStack.getItem(); // if the item is naga armor - if ((itemStack.getItem() == TFItems.plateNaga || itemStack.getItem() == TFItems.legsNaga)) { + if ((item == TFItems.plateNaga || item == TFItems.legsNaga)) { // check if the player has made both armors checkPlayerForNagaArmorer(player); } // trigger achievements - if (itemStack.getItem() == TFItems.magicMapFocus) { + if (isTFdim) { + if (item == TFItems.magicMapFocus) { player.triggerAchievement(TFAchievementPage.twilightMagicMapFocus); } - if (itemStack.getItem() == TFItems.emptyMagicMap) { + if (item == TFItems.emptyMagicMap) { player.triggerAchievement(TFAchievementPage.twilightMagicMap); } - if (itemStack.getItem() == TFItems.emptyMazeMap) { + if (item == TFItems.emptyMazeMap) { player.triggerAchievement(TFAchievementPage.twilightMazeMap); } - if (itemStack.getItem() == TFItems.emptyOreMap) { + if (item == TFItems.emptyOreMap) { player.triggerAchievement(TFAchievementPage.twilightOreMap); } + } // if we've crafted 64 planks from a giant log, sneak 192 more planks into the player's inventory or drop them nearby - if (itemStack.getItem() == Item.getItemFromBlock(Blocks.planks) && itemStack.stackSize == 64 && this.doesCraftMatrixHaveGiantLog(event.craftMatrix)) { + if (item == Item.getItemFromBlock(Blocks.planks) && itemStack.stackSize == 64 && this.doesCraftMatrixHaveGiantLog(event.craftMatrix)) { addToPlayerInventoryOrDrop(player, new ItemStack(Blocks.planks, 64)); addToPlayerInventoryOrDrop(player, new ItemStack(Blocks.planks, 64)); addToPlayerInventoryOrDrop(player, new ItemStack(Blocks.planks, 64)); @@ -347,8 +353,13 @@ private void spawnSpeltXP(ItemStack smelted, World world, int x, int y, int z) { @SubscribeEvent public void entityHurts(LivingHurtEvent event) { + //1 call event = 1 entity? if true, no need checks + boolean CacheInstOfValue = event.entityLiving instanceof EntityPlayer; + boolean CacheDTeqValue = event.source.damageType.equals("mob"); + boolean CacheIsNullValue = event.source.getEntity() != null; + // fire aura - if (event.entityLiving instanceof EntityPlayer && event.source.damageType.equals("mob") && event.source.getEntity() != null) + if (CacheInstOfValue && CacheDTeqValue && CacheIsNullValue) { EntityPlayer player = (EntityPlayer)event.entityLiving; int fireLevel = TFEnchantment.getFieryAuraLevel(player.inventory, event.source); @@ -363,8 +374,8 @@ public void entityHurts(LivingHurtEvent event) } // chill aura - if (event.entityLiving instanceof EntityPlayer && event.source.damageType.equals("mob") - && event.source.getEntity() != null && event.source.getEntity() instanceof EntityLivingBase) { + if (CacheInstOfValue && CacheDTeqValue + && CacheIsNullValue && event.source.getEntity() instanceof EntityLivingBase) { EntityPlayer player = (EntityPlayer)event.entityLiving; int chillLevel = TFEnchantment.getChillAuraLevel(player.inventory, event.source); @@ -377,8 +388,10 @@ public void entityHurts(LivingHurtEvent event) } } + boolean CacheDTeqValue2 = event.source.damageType.equals("arrow"); + boolean CacheInstOfValue2 = event.source.getEntity() instanceof EntityPlayer; // triple bow strips hurtResistantTime - if (event.source.damageType.equals("arrow") && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + if (CacheDTeqValue2 && CacheIsNullValue && CacheInstOfValue2) { EntityPlayer player = (EntityPlayer)event.source.getEntity(); if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == TFItems.tripleBow) { @@ -388,7 +401,7 @@ public void entityHurts(LivingHurtEvent event) } // ice bow freezes - if (event.source.damageType.equals("arrow") && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + if (CacheDTeqValue2 && CacheIsNullValue && CacheInstOfValue2) { EntityPlayer player = (EntityPlayer)event.source.getEntity(); if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == TFItems.iceBow) { @@ -399,7 +412,7 @@ public void entityHurts(LivingHurtEvent event) } // enderbow teleports - if (event.source.damageType.equals("arrow") && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { + if (CacheDTeqValue2 && CacheIsNullValue && CacheInstOfValue2) { EntityPlayer player = (EntityPlayer)event.source.getEntity(); if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == TFItems.enderBow) { @@ -427,7 +440,7 @@ public void entityHurts(LivingHurtEvent event) } // charm of life? - if (event.entityLiving instanceof EntityPlayer && willEntityDie(event)) + if (CacheInstOfValue && willEntityDie(event)) { EntityPlayer player = (EntityPlayer)event.entityLiving; diff --git a/src/main/java/twilightforest/TFFeature.java b/src/main/java/twilightforest/TFFeature.java index c71cedd9f8..6d69522d6e 100644 --- a/src/main/java/twilightforest/TFFeature.java +++ b/src/main/java/twilightforest/TFFeature.java @@ -318,6 +318,7 @@ public static TFFeature getFeatureDirectlyAt(int chunkX, int chunkZ, World world /** * What feature would go in this chunk. Called when we know there is a feature, but there is no cache data, * either generating this chunk for the first time, or using the magic map to forecast beyond the edge of the world. + * Bogdan-G: hmm frequent generation dungeon, is not very good in lagre modpack, especially with jetpack (player speed-run in chunks) */ public static TFFeature generateFeatureForOldMapGen(int chunkX, int chunkZ, World world) { @@ -331,32 +332,37 @@ public static TFFeature generateFeatureForOldMapGen(int chunkX, int chunkZ, Worl BiomeGenBase biomeAt = world.getBiomeGenForCoords((chunkX << 4) + 8, (chunkZ << 4) + 8); // get random value - Random hillRNG = new Random(world.getSeed() + chunkX * 25117 + chunkZ * 151121); - int randnum = hillRNG.nextInt(16); + Random hillRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + chunkX * 25117L + chunkZ * 151121L); + int randnum = hillRNG.nextInt(32);//old: 16 // glaciers have ice towers if (biomeAt == TFBiomeBase.glacier) { - return iceTower; + if (hillRNG.nextInt(41) > 10) return iceTower; + else return nothing; } // lakes have quest islands if (biomeAt == TFBiomeBase.tfLake) { - return questIsland; + if (hillRNG.nextInt(41) > 10) return questIsland; + else return nothing; } // enchanted forests have groves if (biomeAt == TFBiomeBase.enchantedForest) { - return questGrove; + if (hillRNG.nextInt(41) > 10) return questGrove; + else return nothing; } // fire swamp has hydra lair if (biomeAt == TFBiomeBase.fireSwamp) { - return hydraLair; + if (hillRNG.nextInt(41) > 10) return hydraLair; + else return nothing; } // temporary, clearing has maze ruins if (biomeAt == TFBiomeBase.clearing || biomeAt == TFBiomeBase.oakSavanna) { - return labyrinth; + if (hillRNG.nextInt(41) > 10) return labyrinth; + else return nothing; } // dark forests have their own things @@ -368,53 +374,95 @@ public static TFFeature generateFeatureForOldMapGen(int chunkX, int chunkZ, Worl //return druidGrove; break; case 1: - return darkTower; + if (hillRNG.nextInt(41) > 10) return darkTower; + else return nothing; case 2: - return tfStronghold; + if (hillRNG.nextInt(41) > 10) return tfStronghold; + else return nothing; } } // highlands center has castle if (biomeAt == TFBiomeBase.highlandsCenter) { - return finalCastle; + if (hillRNG.nextInt(41) > 10) return finalCastle; + else return nothing; } // highlands has trolls if (biomeAt == TFBiomeBase.highlands) { - return trollCave; + if (hillRNG.nextInt(41) > 10) return trollCave; + else return nothing; } // deep mushrooms has mushroom tower if (biomeAt == TFBiomeBase.deepMushrooms) { - return mushroomTower; + if (hillRNG.nextInt(41) > 10) return mushroomTower; + else return nothing; } // okay, well that takes care of most special cases switch (randnum) { default: - case 0: // oops, I forgot about zero for a long time, now there are too many hill 1s + case 0: // oops, I forgot about zero for a long time, now there are too many hill 1s// Bogdan-G: agree, too much of the hills case 1: case 2: case 3: + return nothing;//Bogdan-G: he-he case 4: case 5: case 6: - return hill1; + if (hillRNG.nextInt(3) > 1) return hill1; + else return nothing; case 7: case 8: + return nothing; case 9: - return hill2; + if (hillRNG.nextInt(3) > 1) return hill2; + else return nothing; case 10: - return hill3; + if (hillRNG.nextInt(3) > 1) return hill3; + else return nothing; case 11: case 12: - return hedgeMaze; + if (hillRNG.nextInt(4) > 2) return hedgeMaze; + else return nothing; case 13: - return (biomeAt != TFBiomeBase.tfSwamp) ? nagaCourtyard : hydraLair; // hydra in the swamp, naga everywhere else + if (hillRNG.nextInt(4) > 2) return (biomeAt != TFBiomeBase.tfSwamp) ? nagaCourtyard : hydraLair; // hydra in the swamp, naga everywhere else + else return nothing; case 14: case 15: - return lichTower; + if (hillRNG.nextInt(4) > 2) return lichTower; + else return nothing; + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + return nothing; + case 23: + case 24: + if (hillRNG.nextInt(3) > 1) return hill1; + else return nothing; + case 25: + if (hillRNG.nextInt(3) > 1) return hill2; + else return nothing; + case 26: + if (hillRNG.nextInt(3) > 1) return hill3; + else return nothing; + case 27: + case 28: + if (hillRNG.nextInt(4) > 2) return hedgeMaze; + else return nothing; + case 29: + if (hillRNG.nextInt(4) > 2) return (biomeAt != TFBiomeBase.tfSwamp) ? nagaCourtyard : hydraLair; // hydra in the swamp, naga everywhere else + else return nothing; + case 30: + case 31: + if (hillRNG.nextInt(4) > 2) return lichTower; + else return nothing; } } @@ -432,63 +480,74 @@ public static TFFeature generateFeatureFor1Point7(int chunkX, int chunkZ, World BiomeGenBase biomeAt = world.getBiomeGenForCoords((chunkX << 4) + 8, (chunkZ << 4) + 8); // get random value - Random hillRNG = new Random(world.getSeed() + chunkX * 25117 + chunkZ * 151121); - int randnum = hillRNG.nextInt(16); + Random hillRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + chunkX * 25117L + chunkZ * 151121L); + int randnum = hillRNG.nextInt(20); // glaciers have ice towers if (biomeAt == TFBiomeBase.glacier) { - return iceTower; + if (hillRNG.nextInt(41) > 10) return iceTower; + else return nothing; } // snow has yeti lair if (biomeAt == TFBiomeBase.tfSnow) { - return yetiCave; + if (hillRNG.nextInt(41) > 10) return yetiCave; + else return nothing; } // lakes have quest islands if (biomeAt == TFBiomeBase.tfLake) { - return questIsland; + if (hillRNG.nextInt(41) > 10) return questIsland; + else return nothing; } // enchanted forests have groves if (biomeAt == TFBiomeBase.enchantedForest) { - return questGrove; + if (hillRNG.nextInt(41) > 10) return questGrove; + else return nothing; } // fire swamp has hydra lair if (biomeAt == TFBiomeBase.fireSwamp) { - return hydraLair; + if (hillRNG.nextInt(41) > 10) return hydraLair; + else return nothing; } // swamp has labyrinth if (biomeAt == TFBiomeBase.tfSwamp) { - return labyrinth; + if (hillRNG.nextInt(41) > 10) return labyrinth; + else return nothing; } // dark forests have their own things if (biomeAt == TFBiomeBase.darkForest) { - return tfStronghold; + if (hillRNG.nextInt(41) > 10) return tfStronghold; + else return nothing; } if (biomeAt == TFBiomeBase.darkForestCenter) { - return darkTower; + if (hillRNG.nextInt(41) > 10) return darkTower; + else return nothing; } // highlands center has castle if (biomeAt == TFBiomeBase.highlandsCenter) { - return finalCastle; + if (hillRNG.nextInt(41) > 10) return finalCastle; + else return nothing; } // highlands has trolls if (biomeAt == TFBiomeBase.highlands) { - return trollCave; + if (hillRNG.nextInt(41) > 10) return trollCave; + else return nothing; } // deep mushrooms has mushroom tower if (biomeAt == TFBiomeBase.deepMushrooms) { - return mushroomTower; + if (hillRNG.nextInt(41) > 10) return mushroomTower; + else return nothing; } int regionOffsetX = Math.abs((chunkX + 64 >> 4) % 8); int regionOffsetZ = Math.abs((chunkZ + 64 >> 4) % 8); - + // plant two lich towers near the center of each 2048x2048 map area if ((regionOffsetX == 4 && regionOffsetZ == 5) || (regionOffsetX == 4 && regionOffsetZ == 3)) { return lichTower; @@ -498,33 +557,41 @@ public static TFFeature generateFeatureFor1Point7(int chunkX, int chunkZ, World if ((regionOffsetX == 5 && regionOffsetZ == 4) || (regionOffsetX == 3 && regionOffsetZ == 4)) { return nagaCourtyard; } - + // okay, well that takes care of most special cases switch (randnum) { default: + return nothing; case 0: case 1: case 2: + return nothing; case 3: case 4: case 5: - return hill1; + if (hillRNG.nextInt(3) > 1) return hill1; + else return nothing; case 6: case 7: case 8: - return hill2; + if (hillRNG.nextInt(3) > 1) return hill2; + else return nothing; case 9: - return hill3; + if (hillRNG.nextInt(3) > 1) return hill3; + else return nothing; case 10: case 11: - return hedgeMaze; + if (hillRNG.nextInt(4) > 2) return hedgeMaze; + else return nothing; case 12: case 13: - return nagaCourtyard; + if (hillRNG.nextInt(4) > 2) return nagaCourtyard; + else return nothing; case 14: case 15: - return lichTower; + if (hillRNG.nextInt(4) > 2) return lichTower; + else return nothing; } } @@ -706,7 +773,7 @@ public static ChunkCoordinates getNearestCenterXYZ(int cx, int cz, World world) int regionX = (chunkX + 8) >> 4; int regionZ = (chunkZ + 8) >> 4; - long seed = (long)(regionX * 3129871) ^ (long)regionZ * 116129781L; + long seed = (regionX * 3129871L) ^ (long)regionZ * 116129781L; seed = seed * seed * 42317861L + seed * 7L; int num0 = (int) (seed >> 12 & 3L); diff --git a/src/main/java/twilightforest/TFGenericPacketHandler.java b/src/main/java/twilightforest/TFGenericPacketHandler.java index 782af248a6..662bc6fabe 100644 --- a/src/main/java/twilightforest/TFGenericPacketHandler.java +++ b/src/main/java/twilightforest/TFGenericPacketHandler.java @@ -189,7 +189,7 @@ private void processEnforcedProgressionStatusData(ByteBuf buf) { boolean isEnforced = buf.readBoolean(); - worldObj.getGameRules().setOrCreateGameRule(TwilightForestMod.ENFORCED_PROGRESSION_RULE, Boolean.valueOf(isEnforced).toString()); + worldObj.getGameRules().setOrCreateGameRule(TwilightForestMod.ENFORCED_PROGRESSION_RULE, Boolean.toString(isEnforced)); } diff --git a/src/main/java/twilightforest/TFTeleporter.java b/src/main/java/twilightforest/TFTeleporter.java index 41f7ca77ed..237fa41010 100644 --- a/src/main/java/twilightforest/TFTeleporter.java +++ b/src/main/java/twilightforest/TFTeleporter.java @@ -29,7 +29,7 @@ public TFTeleporter(WorldServer par1WorldServer) { myWorld = par1WorldServer; if (this.rand == null) { - this.rand = new Random(); + this.rand = new org.bogdang.modifications.random.XSTR(); } } @@ -46,7 +46,7 @@ public void placeInPortal(Entity par1Entity, double x, double y, double z, float int px = MathHelper.floor_double(par1Entity.posX); int pz = MathHelper.floor_double(par1Entity.posZ); if (!isSafeBiomeAt(px, pz, par1Entity)) { - System.out.println("[TwilightForest] Portal destination looks unsafe, rerouting!"); + cpw.mods.fml.common.FMLLog.info("[TwilightForest] Portal destination looks unsafe, rerouting!"); ChunkCoordinates safeCoords = findSafeCoords(200, px, pz, par1Entity); @@ -55,18 +55,18 @@ public void placeInPortal(Entity par1Entity, double x, double y, double z, float x = safeCoords.posX; z = safeCoords.posZ; - System.out.println("[TwilightForest] Safely rerouted!"); + cpw.mods.fml.common.FMLLog.info("[TwilightForest] Safely rerouted!"); } else { - System.out.println("[TwilightForest] Did not find a safe spot at first try, trying again with longer range."); + cpw.mods.fml.common.FMLLog.info("[TwilightForest] Did not find a safe spot at first try, trying again with longer range."); safeCoords = findSafeCoords(400, px, pz, par1Entity); if (safeCoords != null) { par1Entity.setLocationAndAngles(safeCoords.posX, par1Entity.posY, safeCoords.posZ, 90.0F, 0.0F); x = safeCoords.posX; z = safeCoords.posZ; - System.out.println("[TwilightForest] Safely rerouted to long range portal. Return trip not guaranteed."); + cpw.mods.fml.common.FMLLog.info("[TwilightForest] Safely rerouted to long range portal. Return trip not guaranteed."); } else { - System.out.println("[TwilightForest] Did not find a safe spot."); + cpw.mods.fml.common.FMLLog.info("[TwilightForest] Did not find a safe spot."); } } } @@ -401,9 +401,15 @@ private void makePortalAt(World world, int px, int py, int pz) { } public Block randNatureBlock(Random random) { - Block[] block = {Blocks.brown_mushroom, Blocks.red_mushroom, Blocks.tallgrass, Blocks.red_flower, Blocks.yellow_flower}; + /*Block[] block = {Blocks.brown_mushroom, Blocks.red_mushroom, Blocks.tallgrass, Blocks.red_flower, Blocks.yellow_flower}; - return block[random.nextInt(block.length)]; + return block[random.nextInt(block.length)];*/ + int value = random.nextInt(5)+1; + if (value==1) return Blocks.brown_mushroom; + else if (value==2) return Blocks.red_mushroom; + else if (value==3) return Blocks.tallgrass; + else if (value==4) return Blocks.red_flower; + else return Blocks.yellow_flower; } } diff --git a/src/main/java/twilightforest/TFTickHandler.java b/src/main/java/twilightforest/TFTickHandler.java index ec985f5091..88345f3765 100644 --- a/src/main/java/twilightforest/TFTickHandler.java +++ b/src/main/java/twilightforest/TFTickHandler.java @@ -27,6 +27,8 @@ import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.internal.FMLProxyPacket; +import twilightforest.TwilightForestMod; + /** * This class listens for ticks in the world. If the player is near a diamond in the water, this class attempts to open a portal. * @@ -45,12 +47,12 @@ public class TFTickHandler @SubscribeEvent public void playerTick(PlayerTickEvent event) { - EntityPlayer player = event.player; World world = player.worldObj; + if (!world.isRemote && event.phase == TickEvent.Phase.END && world.getWorldTime() % 20 == 0) { // check for portal creation, at least if it's not disabled - if (!TwilightForestMod.disablePortalCreation && event.phase == TickEvent.Phase.END && !world.isRemote && world.getWorldTime() % 20 == 0) { + if (!TwilightForestMod.disablePortalCreation) { // skip non admin players when the option is on if (TwilightForestMod.adminOnlyPortals) { try { @@ -72,22 +74,21 @@ public void playerTick(PlayerTickEvent event) { } } + if (world.getGameRules().getGameRuleBooleanValue(TwilightForestMod.ENFORCED_PROGRESSION_RULE) && world.provider instanceof WorldProviderTwilightForest) { // check the player for being in a forbidden progression area, only every 20 ticks - if (!world.isRemote && event.phase == TickEvent.Phase.END && world.getWorldTime() % 20 == 0 && world.getGameRules().getGameRuleBooleanValue(TwilightForestMod.ENFORCED_PROGRESSION_RULE)) { - if (world.provider instanceof WorldProviderTwilightForest && !player.capabilities.isCreativeMode) { + if (!player.capabilities.isCreativeMode) { checkBiomeForProgression(player, world); } - } // check and send nearby forbidden structures, every 100 ticks or so - if (!world.isRemote && event.phase == TickEvent.Phase.END && world.getWorldTime() % 100 == 0 && world.getGameRules().getGameRuleBooleanValue(TwilightForestMod.ENFORCED_PROGRESSION_RULE)) { - if (world.provider instanceof WorldProviderTwilightForest) { + if (world.getWorldTime() % 100 == 0) { if (!player.capabilities.isCreativeMode) { checkForLockedStructuresSendPacket(player, world); } else { sendAllClearPacket(world, player); } - } + } + } } } @@ -97,9 +98,9 @@ private void sendStructureProtectionPacket(World world, EntityPlayer player, Str if (player instanceof EntityPlayerMP) { TwilightForestMod.genericChannel.sendTo(message, (EntityPlayerMP) player); //System.out.println("Sent structure protection"); - } else { + }// else { //System.err.println("Can't sent packet to player, not an EntityPlayerMP"); - } + //} } private void sendAllClearPacket(World world, EntityPlayer player) { @@ -107,9 +108,9 @@ private void sendAllClearPacket(World world, EntityPlayer player) { if (player instanceof EntityPlayerMP) { TwilightForestMod.genericChannel.sendTo(message, (EntityPlayerMP) player); //System.out.println("Sent structure all clear"); - } else { + }// else { //System.err.println("Can't sent packet to player, not an EntityPlayerMP"); - } + //} } private boolean checkForLockedStructuresSendPacket(EntityPlayer player, World world) { @@ -141,7 +142,7 @@ private boolean checkForLockedStructuresSendPacket(EntityPlayer player, World wo @SubscribeEvent public void tickStart(ItemTossEvent event) { - System.out.println("ItemTossEvent Tick"); + cpw.mods.fml.common.FMLLog.info("ItemTossEvent Tick"); } @@ -156,11 +157,11 @@ private void checkForPortalCreation(EntityPlayer player, World world, float rang List itemList = world.getEntitiesWithinAABB(EntityItem.class, player.boundingBox.expand(rangeToCheck, rangeToCheck, rangeToCheck)); // do we have the item set? if not, can we set it? - if (this.portalItem == null) { + /*if (this.portalItem == null) { - } + }*/ // check to see if someone's thrown the portal item into the water for (EntityItem entityItem : itemList) @@ -170,7 +171,7 @@ private void checkForPortalCreation(EntityPlayer player, World world, float rang //System.out.println("There is a diamond in the water"); // make sparkles in the area - Random rand = new Random(); + Random rand = new org.bogdang.modifications.random.XSTR(); for (int k = 0; k < 2; k++) { double d = rand.nextGaussian() * 0.02D; diff --git a/src/main/java/twilightforest/TFTreasure.java b/src/main/java/twilightforest/TFTreasure.java index 781a6c3322..cd203ad72f 100644 --- a/src/main/java/twilightforest/TFTreasure.java +++ b/src/main/java/twilightforest/TFTreasure.java @@ -68,7 +68,7 @@ public TFTreasure(int i) { rare = new TFTreasureTable(); ultrarare = new TFTreasureTable(); - treasureRNG = new Random(); + treasureRNG = new org.bogdang.modifications.random.XSTR(); // TODO: separate these into plain ol' different classes fill(i); diff --git a/src/main/java/twilightforest/TwilightForestMod.java b/src/main/java/twilightforest/TwilightForestMod.java index dd13d71241..d3296b1ef5 100644 --- a/src/main/java/twilightforest/TwilightForestMod.java +++ b/src/main/java/twilightforest/TwilightForestMod.java @@ -99,6 +99,9 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; +import java.util.Random; +import org.bogdang.modifications.random.XSTR; + @Mod(modid = TwilightForestMod.ID, name = "The Twilight Forest", version = TwilightForestMod.VERSION) public class TwilightForestMod { @@ -241,6 +244,9 @@ public class TwilightForestMod { public static final TFEventListener eventListener = new TFEventListener(); public static final TFTickHandler tickHandler = new TFTickHandler(); public static FMLEventChannel genericChannel; + + //for min-max values adds for N + public static Random Scatter = new XSTR(); @Instance(ID) diff --git a/src/main/java/twilightforest/biomes/TFBiomeBase.java b/src/main/java/twilightforest/biomes/TFBiomeBase.java index 5cc2f3922d..9aa9e85cad 100644 --- a/src/main/java/twilightforest/biomes/TFBiomeBase.java +++ b/src/main/java/twilightforest/biomes/TFBiomeBase.java @@ -389,7 +389,7 @@ public void genTwilightBiomeTerrain(World world, Random rand, Block[] blockStora Block fillerBlock = this.fillerBlock; byte fillerMeta = (byte)(this.field_76754_C & 255); int currentFillerDepth = -1; - int maxFillerDepth = (int)(stoneNoise / 3.0D + 3.0D + rand.nextDouble() * 0.25D); + int maxFillerDepth = (int)(stoneNoise / 3.0D + 3.0D + rand.nextFloat() * 0.25D); int maskX = x & 15; int maskZ = z & 15; int worldHeight = blockStorage.length / 256; diff --git a/src/main/java/twilightforest/biomes/TFBiomeDarkForest.java b/src/main/java/twilightforest/biomes/TFBiomeDarkForest.java index 0a025f274b..6ec0cbe9ee 100644 --- a/src/main/java/twilightforest/biomes/TFBiomeDarkForest.java +++ b/src/main/java/twilightforest/biomes/TFBiomeDarkForest.java @@ -54,7 +54,7 @@ public TFBiomeDarkForest(int i) { this.rootHeight = 0.05F; this.heightVariation = 0.05F; - this.monsterRNG = new Random(); + this.monsterRNG = new org.bogdang.modifications.random.XSTR(); this.spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 1, 1, 4)); this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 5, 1, 4)); diff --git a/src/main/java/twilightforest/biomes/TFBiomeDecorator.java b/src/main/java/twilightforest/biomes/TFBiomeDecorator.java index 52bbf69ab5..b01e4e0a00 100644 --- a/src/main/java/twilightforest/biomes/TFBiomeDecorator.java +++ b/src/main/java/twilightforest/biomes/TFBiomeDecorator.java @@ -148,6 +148,8 @@ public void decorateChunk(World world, Random rand, BiomeGenBase biome, int mapX protected void genDecorations(BiomeGenBase biome) { + try { + //at this point the error did not occur, but seeing what could be randomGenerator this null, then add a cap and here // random features! if(randomGenerator.nextInt(6) == 0) { @@ -155,15 +157,20 @@ protected void genDecorations(BiomeGenBase biome) int rz = chunk_Z + randomGenerator.nextInt(16) + 8; int ry = currentWorld.getHeightValue(rx, rz); TFGenerator rf = randomFeature(randomGenerator); + //rf.generate(currentWorld, randomGenerator, rx, ry, rz); if (rf.generate(currentWorld, randomGenerator, rx, ry, rz)) { // System.out.println(rf + " success at " + rx + ", " + ry + ", " + rz); + //cpw.mods.fml.common.FMLLog.info(rf + " success at " + rx + ", " + ry + ", " + rz); } } + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip random feature, ");} // add canopy trees + try { int nc = (int)canopyPerChunk + ((randomGenerator.nextFloat() < (canopyPerChunk - (int)canopyPerChunk)) ? 1 : 0); for (int i = 0; i < nc; i++) { + try {//this in order not to miss the party generating the trees and miss only a few trees int rx = chunk_X + randomGenerator.nextInt(16) + 8; int rz = chunk_Z + randomGenerator.nextInt(16) + 8; int ry = currentWorld.getHeightValue(rx, rz); @@ -172,37 +179,49 @@ protected void genDecorations(BiomeGenBase biome) } else { canopyTreeGen.generate(currentWorld, randomGenerator, rx, ry, rz); } + } catch (Throwable thrwe) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrwe, "TwilightForest: skip canopy tree(s), ");} } + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip canopy trees gen, ");} // mangrove trees for (int i = 0; i < mangrovesPerChunk; i++) { + try {//yes, not good variant, fix NPE, if randomGenerator this null, yeah int rx = chunk_X + randomGenerator.nextInt(16) + 8; int rz = chunk_Z + randomGenerator.nextInt(16) + 8; int ry = currentWorld.getHeightValue(rx, rz); mangroveTreeGen.generate(currentWorld, randomGenerator, rx, ry, rz); + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip mangrove tree(s), ");} } // add extra lakes for swamps for (int i = 0; i < lakesPerChunk; i++) { + try { int rx = chunk_X + randomGenerator.nextInt(16) + 8; int rz = chunk_Z + randomGenerator.nextInt(16) + 8; int ry = currentWorld.getHeightValue(rx, rz); extraLakeGen.generate(currentWorld, randomGenerator, rx, ry, rz); + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip extra lakes for swamps, ");} } + try { // add extra lava for fire swamps if (randomGenerator.nextFloat() <= lavaPoolChance) { + try { int rx = chunk_X + randomGenerator.nextInt(16) + 8; int rz = chunk_Z + randomGenerator.nextInt(16) + 8; int ry = currentWorld.getHeightValue(rx, rz); extraLavaPoolGen.generate(currentWorld, randomGenerator, rx, ry, rz); + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip extra lava for fire swamps, ");} } + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip extra lava for fire swamps gen, ");} // mycelium blobs for (int i = 0; i < myceliumPerChunk; i++) { + try { int rx = chunk_X + randomGenerator.nextInt(16) + 8; int rz = chunk_Z + randomGenerator.nextInt(16) + 8; int ry = currentWorld.getHeightValue(rx, rz); myceliumBlobGen.generate(currentWorld, randomGenerator, rx, ry, rz); + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip mycelium blobs, ");} } super.genDecorations(biome); @@ -219,39 +238,47 @@ protected void decorateUnderground(World world, Random rand, int mapX, int mapZ) // generate roots for (int i = 0; i < 12; ++i) { + try { int rx = mapX + rand.nextInt(16) + 8; byte ry = 64; int rz = mapZ + rand.nextInt(16) + 8; plantRootGen.generate(world, rand, rx, ry, rz); + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip generate roots, ");} } // generate roots for (int i = 0; i < 20; ++i) { + try { int rx = mapX + rand.nextInt(16) + 8; int ry = rand.nextInt(64); int rz = mapZ + rand.nextInt(16) + 8; woodRootGen.generate(world, rand, rx, ry, rz); + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip generate roots 2, ");} } // extra underground water sources if (this.generateLakes) { for (int i = 0; i < 50; ++i) { + try { int rx = mapX + rand.nextInt(16) + 8; int ry = rand.nextInt(24) + 4; int rz = mapZ + rand.nextInt(16) + 8; caveWaterGen.generate(world, rand, rx, ry, rz); + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip extra underground water sources, ");} } } // torch berries are almost guaranteed to spawn so we don't need many for (int i = 0; i < 3; ++i) { + try { int rx = mapX + rand.nextInt(16) + 8; int ry = 64; int rz = mapZ + rand.nextInt(16) + 8; torchBerryGen.generate(world, rand, rx, ry, rz); + } catch (Throwable thrw) {cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.INFO, thrw, "TwilightForest: skip torch berries, ");} } } diff --git a/src/main/java/twilightforest/biomes/TFBiomeEnchantedForest.java b/src/main/java/twilightforest/biomes/TFBiomeEnchantedForest.java index 04e0e73694..69d7ec6aa6 100644 --- a/src/main/java/twilightforest/biomes/TFBiomeEnchantedForest.java +++ b/src/main/java/twilightforest/biomes/TFBiomeEnchantedForest.java @@ -25,7 +25,7 @@ public class TFBiomeEnchantedForest extends TFBiomeBase { public TFBiomeEnchantedForest(int i) { super(i); - colorRNG = new Random(); + colorRNG = new org.bogdang.modifications.random.XSTR(); getTFBiomeDecorator().setGrassPerChunk(12); diff --git a/src/main/java/twilightforest/biomes/TFBiomeHighlands.java b/src/main/java/twilightforest/biomes/TFBiomeHighlands.java index 0d39620cd2..be0162b4da 100644 --- a/src/main/java/twilightforest/biomes/TFBiomeHighlands.java +++ b/src/main/java/twilightforest/biomes/TFBiomeHighlands.java @@ -93,8 +93,8 @@ public WorldGenerator getRandomWorldGenForGrass(Random par1Random) public void genTerrainBlocks(World world, Random rand, Block[] blockStorage, byte[] metaStorage, int x, int z, double noiseVal) { - if (true) - { + //if (true) + //{ this.topBlock = Blocks.grass; this.field_150604_aj = 0; this.fillerBlock = Blocks.dirt; @@ -109,7 +109,7 @@ else if (noiseVal > -0.95D) this.topBlock = Blocks.dirt; this.field_150604_aj = 2; } - } + //} this.genTwilightBiomeTerrain(world, rand, blockStorage, metaStorage, x, z, noiseVal); } diff --git a/src/main/java/twilightforest/biomes/TFBiomeSnow.java b/src/main/java/twilightforest/biomes/TFBiomeSnow.java index e5f0d26ac2..3bc8c22364 100644 --- a/src/main/java/twilightforest/biomes/TFBiomeSnow.java +++ b/src/main/java/twilightforest/biomes/TFBiomeSnow.java @@ -31,7 +31,7 @@ public class TFBiomeSnow extends TFBiomeBase { private static final int MONSTER_SPAWN_RATE = 10; - Random monsterRNG = new Random(53439L); + Random monsterRNG = new org.bogdang.modifications.random.XSTR(53439L); ArrayList emptyList = new ArrayList(); /** diff --git a/src/main/java/twilightforest/biomes/TFBiomeSwamp.java b/src/main/java/twilightforest/biomes/TFBiomeSwamp.java index 0e73433b67..5d048fd755 100644 --- a/src/main/java/twilightforest/biomes/TFBiomeSwamp.java +++ b/src/main/java/twilightforest/biomes/TFBiomeSwamp.java @@ -34,7 +34,7 @@ public class TFBiomeSwamp extends TFBiomeBase { private static final int MONSTER_SPAWN_RATE = 20; - Random monsterRNG = new Random(53439L); + Random monsterRNG = new org.bogdang.modifications.random.XSTR(53439L); ArrayList emptyList = new ArrayList(); WorldGenVines worldgenvines = new WorldGenVines(); diff --git a/src/main/java/twilightforest/biomes/TFGenHugeWaterLily.java b/src/main/java/twilightforest/biomes/TFGenHugeWaterLily.java index fc965cf2d6..bd0eddf90f 100644 --- a/src/main/java/twilightforest/biomes/TFGenHugeWaterLily.java +++ b/src/main/java/twilightforest/biomes/TFGenHugeWaterLily.java @@ -19,7 +19,7 @@ public class TFGenHugeWaterLily extends WorldGenerator { - private Random rand = new Random(); + private Random rand = new org.bogdang.modifications.random.XSTR(); public boolean generate(World world, Random random, int x, int y, int z) diff --git a/src/main/java/twilightforest/block/BlockTFAuroraBrick.java b/src/main/java/twilightforest/block/BlockTFAuroraBrick.java index 66def7d507..cf7d63afa9 100644 --- a/src/main/java/twilightforest/block/BlockTFAuroraBrick.java +++ b/src/main/java/twilightforest/block/BlockTFAuroraBrick.java @@ -162,4 +162,10 @@ public void onBlockAdded(World world, int x, int y, int z) { world.setBlockMetadataWithNotify(x, y, z, Math.abs(x + z) % 16, 2); } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFAuroraPillar.java b/src/main/java/twilightforest/block/BlockTFAuroraPillar.java index 5295d4092b..e4649dd473 100644 --- a/src/main/java/twilightforest/block/BlockTFAuroraPillar.java +++ b/src/main/java/twilightforest/block/BlockTFAuroraPillar.java @@ -11,6 +11,7 @@ import twilightforest.item.TFItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.world.World; public class BlockTFAuroraPillar extends BlockRotatedPillar { @@ -82,4 +83,10 @@ public void registerBlockIcons(IIconRegister par1IconRegister) this.topIcon = par1IconRegister.registerIcon(TwilightForestMod.ID + ":aurora_pillar_top"); } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFAuroraSlab.java b/src/main/java/twilightforest/block/BlockTFAuroraSlab.java index c37daa24f3..3f65ac9350 100644 --- a/src/main/java/twilightforest/block/BlockTFAuroraSlab.java +++ b/src/main/java/twilightforest/block/BlockTFAuroraSlab.java @@ -15,6 +15,7 @@ import twilightforest.item.TFItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.world.World; public class BlockTFAuroraSlab extends BlockSlab { @@ -124,4 +125,10 @@ private static boolean isSingleSlab(Block p_150003_0_) { return p_150003_0_ == TFBlocks.auroraSlab; } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFBossSpawner.java b/src/main/java/twilightforest/block/BlockTFBossSpawner.java index 182fc4666c..923258a257 100644 --- a/src/main/java/twilightforest/block/BlockTFBossSpawner.java +++ b/src/main/java/twilightforest/block/BlockTFBossSpawner.java @@ -145,4 +145,10 @@ public void registerBlockIcons(IIconRegister par1IconRegister) { ; // don't load anything } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFCastleBlock.java b/src/main/java/twilightforest/block/BlockTFCastleBlock.java index 04c694960b..a2fe7adedd 100644 --- a/src/main/java/twilightforest/block/BlockTFCastleBlock.java +++ b/src/main/java/twilightforest/block/BlockTFCastleBlock.java @@ -114,4 +114,10 @@ public int damageDropped(int meta) { return meta; } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFCastleDoor.java b/src/main/java/twilightforest/block/BlockTFCastleDoor.java index c44c444e13..6d90fe59dc 100644 --- a/src/main/java/twilightforest/block/BlockTFCastleDoor.java +++ b/src/main/java/twilightforest/block/BlockTFCastleDoor.java @@ -303,14 +303,15 @@ public static void checkAndActivateCastleDoor(World world, int x, int y, int z) */ public void randomDisplayTick(World par1World, int x, int y, int z, Random par5Random) { - int meta = par1World.getBlockMetadata(x, y, z); + //FB: Useless control flow -> meh, code dont commented + /*int meta = par1World.getBlockMetadata(x, y, z); if (isMetaActive(meta)); { for (int i = 0; i < 1; ++i) { //this.sparkle(par1World, x, y, z, par5Random); } - } + }*/ } diff --git a/src/main/java/twilightforest/block/BlockTFCastleMagic.java b/src/main/java/twilightforest/block/BlockTFCastleMagic.java index 27d086b9de..de52091a59 100644 --- a/src/main/java/twilightforest/block/BlockTFCastleMagic.java +++ b/src/main/java/twilightforest/block/BlockTFCastleMagic.java @@ -55,7 +55,7 @@ public void registerBlockIcons(IIconRegister par1IconRegister) public static IIcon getMagicIconFor(int x, int y, int z) { - long seed = x * 3129871 ^ y * 116129781L ^ z; + long seed = x * 3129871L ^ y * 116129781L ^ z; seed = seed * seed * 42317861L + seed * 11L; int index = (int) (seed >> 12 & 7L); diff --git a/src/main/java/twilightforest/block/BlockTFCinderFurnace.java b/src/main/java/twilightforest/block/BlockTFCinderFurnace.java index b0fcc2620b..0ad00dbdae 100644 --- a/src/main/java/twilightforest/block/BlockTFCinderFurnace.java +++ b/src/main/java/twilightforest/block/BlockTFCinderFurnace.java @@ -29,7 +29,7 @@ public class BlockTFCinderFurnace extends BlockContainer{ private static boolean isUpdating; private Boolean isLit; private IIcon topIcon; - private Random furnaceRandom = new Random(); + private Random furnaceRandom = new org.bogdang.modifications.random.XSTR(); protected BlockTFCinderFurnace(Boolean isLit) { super(Material.wood); diff --git a/src/main/java/twilightforest/block/BlockTFCinderLog.java b/src/main/java/twilightforest/block/BlockTFCinderLog.java index 37b8ec7a3d..deb09e05c0 100644 --- a/src/main/java/twilightforest/block/BlockTFCinderLog.java +++ b/src/main/java/twilightforest/block/BlockTFCinderLog.java @@ -14,6 +14,7 @@ import net.minecraft.util.IIcon; import twilightforest.TwilightForestMod; import twilightforest.item.TFItems; +import net.minecraft.world.World; public class BlockTFCinderLog extends BlockLog { @@ -60,5 +61,11 @@ public Item getItemDropped(int par1, Random par2Random, int par3) return Item.getItemFromBlock(TFBlocks.cinderLog); // hey that's my block ID! } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFCritter.java b/src/main/java/twilightforest/block/BlockTFCritter.java index d55ce3ef7e..06f8ae8611 100644 --- a/src/main/java/twilightforest/block/BlockTFCritter.java +++ b/src/main/java/twilightforest/block/BlockTFCritter.java @@ -254,7 +254,10 @@ public void onNeighborBlockChange(World world, int x, int y, int z, Block blockI */ public boolean canPlaceAt(World world, int x, int y, int z) { - return world.isBlockNormalCubeDefault(x, y, z, true) || world.getBlock(x, y, z).getMaterial() == Material.leaves || world.getBlock(x, y, z).getMaterial() == Material.cactus; + //return world.isBlockNormalCubeDefault(x, y, z, true) || world.getBlock(x, y, z).getMaterial() == Material.leaves || world.getBlock(x, y, z).getMaterial() == Material.cactus; + Block block = world.getBlock(x, y, z); + Material mblock = block.getMaterial(); + return block.isNormalCube(world, x, y, z) || mblock == Material.leaves || mblock == Material.cactus; } /** diff --git a/src/main/java/twilightforest/block/BlockTFDarkLeaves.java b/src/main/java/twilightforest/block/BlockTFDarkLeaves.java index 9d3f9089f4..b25cdbcbf3 100644 --- a/src/main/java/twilightforest/block/BlockTFDarkLeaves.java +++ b/src/main/java/twilightforest/block/BlockTFDarkLeaves.java @@ -147,5 +147,11 @@ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int p } } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFDeadrock.java b/src/main/java/twilightforest/block/BlockTFDeadrock.java index b048c0d076..57b02ec8ac 100644 --- a/src/main/java/twilightforest/block/BlockTFDeadrock.java +++ b/src/main/java/twilightforest/block/BlockTFDeadrock.java @@ -13,6 +13,7 @@ import twilightforest.item.TFItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.world.World; public class BlockTFDeadrock extends Block { @@ -69,4 +70,10 @@ public int damageDropped(int meta) { return meta; } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFFirefly.java b/src/main/java/twilightforest/block/BlockTFFirefly.java index 43c0d03e3e..bee73ae7b4 100644 --- a/src/main/java/twilightforest/block/BlockTFFirefly.java +++ b/src/main/java/twilightforest/block/BlockTFFirefly.java @@ -13,7 +13,7 @@ public class BlockTFFirefly extends BlockTFCritter { public static int sprFirefly = 4; - public static Random rand = new Random(); + public static Random rand = new org.bogdang.modifications.random.XSTR(); protected BlockTFFirefly() { super(); diff --git a/src/main/java/twilightforest/block/BlockTFGiantBlock.java b/src/main/java/twilightforest/block/BlockTFGiantBlock.java index ca96e5afc4..0f92519a7c 100644 --- a/src/main/java/twilightforest/block/BlockTFGiantBlock.java +++ b/src/main/java/twilightforest/block/BlockTFGiantBlock.java @@ -50,10 +50,11 @@ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { // return an icon from the icon matrix! switch (side) { case 0: - default: - return this.giantIcon[x & 3][z & 3][side]; case 1: + default: return this.giantIcon[x & 3][z & 3][side]; + //case 1: + //return this.giantIcon[x & 3][z & 3][side]; case 2: return this.giantIcon[3 - (x & 3)][3 - (y & 3)][side]; case 3: @@ -265,4 +266,10 @@ public int getMobilityFlag() { return 2; } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFGiantCobble.java b/src/main/java/twilightforest/block/BlockTFGiantCobble.java index 7a7e597d75..e9b5cb4ad9 100644 --- a/src/main/java/twilightforest/block/BlockTFGiantCobble.java +++ b/src/main/java/twilightforest/block/BlockTFGiantCobble.java @@ -2,6 +2,7 @@ import twilightforest.item.TFItems; import net.minecraft.init.Blocks; +import net.minecraft.world.World; public class BlockTFGiantCobble extends BlockTFGiantBlock { @@ -13,5 +14,11 @@ protected BlockTFGiantCobble() { this.setCreativeTab(TFItems.creativeTab); } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFGiantLeaves.java b/src/main/java/twilightforest/block/BlockTFGiantLeaves.java index b4d056f3d9..8ae1bdc883 100644 --- a/src/main/java/twilightforest/block/BlockTFGiantLeaves.java +++ b/src/main/java/twilightforest/block/BlockTFGiantLeaves.java @@ -6,6 +6,7 @@ import net.minecraft.init.Blocks; import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; public class BlockTFGiantLeaves extends BlockTFGiantBlock { @@ -94,4 +95,10 @@ public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int return super.shouldSideBeRendered(world, x, y, z, side); } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFGiantLog.java b/src/main/java/twilightforest/block/BlockTFGiantLog.java index 04c2c754f2..7f894dfc02 100644 --- a/src/main/java/twilightforest/block/BlockTFGiantLog.java +++ b/src/main/java/twilightforest/block/BlockTFGiantLog.java @@ -2,6 +2,7 @@ import twilightforest.item.TFItems; import net.minecraft.init.Blocks; +import net.minecraft.world.World; public class BlockTFGiantLog extends BlockTFGiantBlock { @@ -14,4 +15,10 @@ protected BlockTFGiantLog() { this.setCreativeTab(TFItems.creativeTab); } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFGiantObsidian.java b/src/main/java/twilightforest/block/BlockTFGiantObsidian.java index 6a680f5d34..9565a2c0ef 100644 --- a/src/main/java/twilightforest/block/BlockTFGiantObsidian.java +++ b/src/main/java/twilightforest/block/BlockTFGiantObsidian.java @@ -2,6 +2,7 @@ import twilightforest.item.TFItems; import net.minecraft.init.Blocks; +import net.minecraft.world.World; public class BlockTFGiantObsidian extends BlockTFGiantBlock { @@ -15,4 +16,10 @@ protected BlockTFGiantObsidian() { this.setCreativeTab(TFItems.creativeTab); } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFKnightmetalBlock.java b/src/main/java/twilightforest/block/BlockTFKnightmetalBlock.java index 97ba4d80c6..377a06ef97 100644 --- a/src/main/java/twilightforest/block/BlockTFKnightmetalBlock.java +++ b/src/main/java/twilightforest/block/BlockTFKnightmetalBlock.java @@ -87,4 +87,10 @@ public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int { return true; } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFLeaves.java b/src/main/java/twilightforest/block/BlockTFLeaves.java index 3bd6ecf115..e14723a7f5 100644 --- a/src/main/java/twilightforest/block/BlockTFLeaves.java +++ b/src/main/java/twilightforest/block/BlockTFLeaves.java @@ -220,4 +220,10 @@ public int getSaplingMeta(int leafMeta) { public String[] func_150125_e() { return unlocalizedNameArray; } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFLeaves3.java b/src/main/java/twilightforest/block/BlockTFLeaves3.java index 7469652d39..a4cfe05cbf 100644 --- a/src/main/java/twilightforest/block/BlockTFLeaves3.java +++ b/src/main/java/twilightforest/block/BlockTFLeaves3.java @@ -125,5 +125,11 @@ public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) { return true; } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFLog.java b/src/main/java/twilightforest/block/BlockTFLog.java index 69959ab59f..3281a76ce9 100644 --- a/src/main/java/twilightforest/block/BlockTFLog.java +++ b/src/main/java/twilightforest/block/BlockTFLog.java @@ -14,6 +14,7 @@ import twilightforest.item.TFItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.world.World; public class BlockTFLog extends BlockLog { @@ -96,4 +97,10 @@ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List par3List.add(new ItemStack(par1, 1, 3)); } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFMagicLogSpecial.java b/src/main/java/twilightforest/block/BlockTFMagicLogSpecial.java index 52c99e7836..be2a3029b0 100644 --- a/src/main/java/twilightforest/block/BlockTFMagicLogSpecial.java +++ b/src/main/java/twilightforest/block/BlockTFMagicLogSpecial.java @@ -426,8 +426,11 @@ private void doSortingTreeEffect(World world, int x, int y, int z, Random rand) { ItemStack currentItem = chest.getStackInSlot(slotNum); - if (currentItem!= null && currentItem != beingSorted && beingSorted.isItemEqual(currentItem)) + if (currentItem!=null && currentItem!=beingSorted && beingSorted.isItemEqual(currentItem)) { + if (beingSorted.stackTagCompound!=null && currentItem.stackTagCompound!=null && beingSorted.stackTagCompound.equals(currentItem.stackTagCompound)) ; + else if (beingSorted.stackTagCompound==null && currentItem.stackTagCompound==null) ; + else continue; if (currentItem.stackSize <= (beingSorted.getMaxStackSize() - beingSorted.stackSize)) { chest.setInventorySlotContents(slotNum, null); @@ -444,7 +447,7 @@ private void doSortingTreeEffect(World world, int x, int y, int z, Random rand) private boolean isSortingMatch(ItemStack beingSorted, ItemStack currentItem) { - return getCreativeTab(currentItem.getItem()) == getCreativeTab(beingSorted.getItem()); + return getCreativeTab(currentItem.getItem()).equals(getCreativeTab(beingSorted.getItem()));//no use reference } private Object getCreativeTab(Item item) @@ -465,7 +468,7 @@ private Object getCreativeTab(Item item) private boolean checkIfChestsContains(ArrayList chests, IInventory testChest) { for (IInventory chest : chests) { - if (chest == testChest) + if (chest.equals(testChest)) { return true; } diff --git a/src/main/java/twilightforest/block/BlockTFMazestone.java b/src/main/java/twilightforest/block/BlockTFMazestone.java index 4cae304519..837c6f7679 100644 --- a/src/main/java/twilightforest/block/BlockTFMazestone.java +++ b/src/main/java/twilightforest/block/BlockTFMazestone.java @@ -134,4 +134,10 @@ public int damageDropped(int meta) { return meta; } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFNagastone.java b/src/main/java/twilightforest/block/BlockTFNagastone.java index f9c6dac1cf..860c66b423 100644 --- a/src/main/java/twilightforest/block/BlockTFNagastone.java +++ b/src/main/java/twilightforest/block/BlockTFNagastone.java @@ -808,4 +808,10 @@ public void registerBlockIcons(IIconRegister par1IconRegister) BlockTFNagastone.TURN_TOP = par1IconRegister.registerIcon(TwilightForestMod.ID + ":nagastone_turn_top"); } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFPlant.java b/src/main/java/twilightforest/block/BlockTFPlant.java index f6ee5a0da0..2c13964cf2 100644 --- a/src/main/java/twilightforest/block/BlockTFPlant.java +++ b/src/main/java/twilightforest/block/BlockTFPlant.java @@ -1,6 +1,7 @@ package twilightforest.block; import java.util.ArrayList; +import java.util.BitSet; import java.util.List; import java.util.Random; @@ -31,8 +32,9 @@ public class BlockTFPlant extends BlockBush implements IShearable { - boolean[] isGrassColor = {false, false, false, false, true, true, false, false, true, false, true, false, false, false, false, false}; - int[] lightValue = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0}; + //boolean[] isGrassColor = {false, false, false, false, true, true, false, false, true, false, true, false, false, false, false, false}; + BitSet isGrassColor; + //int[] lightValue = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0};//Bogdan-G: index - value: 9 - 3, 13 - 8; range of values 0-15? if true byte[] enough, but will lead to int; array identical for everyone class BlockTFPlant? private IIcon[] icons; private String[] iconNames = new String[] {null, null, null, "mosspatch", "mayapple", "cloverpatch", null, null, "fiddlehead", "mushgloom", null, null, null, "torchberry", "rootstrand", null}; @@ -57,6 +59,9 @@ protected BlockTFPlant() { this.setHardness(0.0F); this.setStepSound(Block.soundTypeGrass); this.setCreativeTab(TFItems.creativeTab); + boolean[] isGrassColor_oldtype = {false, false, false, false, true, true, false, false, true, false, true, false, false, false, false, false}; + this.isGrassColor=new BitSet(isGrassColor_oldtype.length); + for (int i=0;i> 12 & 3L); @@ -177,7 +182,7 @@ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int x, int } else if (meta == META_CLOVERPATCH) { - long seed = x * 3129871 ^ y * 116129781L ^ z; + long seed = x * 3129871L ^ y * 116129781L ^ z; seed = seed * seed * 42317861L + seed * 11L; int xOff0 = (int) (seed >> 12 & 3L); @@ -216,7 +221,7 @@ else if (meta == META_MAYAPPLE) @Override public int getRenderColor(int par1) { - return isGrassColor[par1] ? ColorizerFoliage.getFoliageColorBasic() : 0xFFFFFF; + return isGrassColor.get(par1) ? ColorizerFoliage.getFoliageColorBasic() : 0xFFFFFF; } /** @@ -227,7 +232,7 @@ public int getRenderColor(int par1) public int colorMultiplier(IBlockAccess par1IBlockAccess, int x, int y, int z) { int meta = par1IBlockAccess.getBlockMetadata(x, y, z); - return isGrassColor[meta] ? par1IBlockAccess.getBiomeGenForCoords(x, z).getBiomeGrassColor(x, y, z) : 0xFFFFFF; + return isGrassColor.get(meta) ? par1IBlockAccess.getBiomeGenForCoords(x, z).getBiomeGrassColor(x, y, z) : 0xFFFFFF; } @@ -277,11 +282,11 @@ public int getRenderType() { @Override public void updateTick(World par1World, int x, int y, int z, Random par5Random) { - int meta = par1World.getBlockMetadata(x, y, z); + /*int meta = par1World.getBlockMetadata(x, y, z); if (par1World.getBlockLightValue(x, y, z) < lightValue[meta]) { //par1World.updateLightByType(EnumSkyBlock.Block, x, y, z); //par1World.markBlockForUpdate(x, y, z); // do we need this now? - } + }*/ } @@ -297,7 +302,7 @@ public void updateTick(World par1World, int x, int y, int z, Random par5Random) @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - return lightValue[meta]; + return meta==9 ? 3 : meta==13 ? 8 : 0;//lightValue[meta]; } @@ -520,4 +525,10 @@ public void randomDisplayTick(World par1World, int x, int y, int z, Random par5R } } + + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } } diff --git a/src/main/java/twilightforest/block/BlockTFRoots.java b/src/main/java/twilightforest/block/BlockTFRoots.java index 470662771a..9758e3a405 100644 --- a/src/main/java/twilightforest/block/BlockTFRoots.java +++ b/src/main/java/twilightforest/block/BlockTFRoots.java @@ -15,6 +15,7 @@ import twilightforest.item.TFItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.world.World; public class BlockTFRoots extends Block { @@ -125,4 +126,10 @@ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List par3List.add(new ItemStack(par1, 1, 1)); } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFSlider.java b/src/main/java/twilightforest/block/BlockTFSlider.java index 3536c94862..d8a66dcbd8 100644 --- a/src/main/java/twilightforest/block/BlockTFSlider.java +++ b/src/main/java/twilightforest/block/BlockTFSlider.java @@ -248,8 +248,9 @@ private boolean isConnectedInRangeRecursive(World world, int x, int y, int z, Fo int dy = y + dir.offsetY; int dz = z + dir.offsetZ; + boolean check_xyz = x==dx && y==dy && z==dz; // are the blocks connected? (block and meta are the same - if (world.getBlock(x, y, z) == world.getBlock(dx, dy, dz) && world.getBlockMetadata(x, y, z) == world.getBlockMetadata(dx, dy, dz)) { + if ((check_xyz || world.getBlock(x, y, z) == world.getBlock(dx, dy, dz)) && (check_xyz || world.getBlockMetadata(x, y, z) == world.getBlockMetadata(dx, dy, dz))) { return this.anyPlayerInRange(world, dx, dy, dz) || this.isConnectedInRangeRecursive(world, dx, dy, dz, dir); } else { return false; diff --git a/src/main/java/twilightforest/block/BlockTFTowerTranslucent.java b/src/main/java/twilightforest/block/BlockTFTowerTranslucent.java index 51ffba403f..b755f3cf51 100644 --- a/src/main/java/twilightforest/block/BlockTFTowerTranslucent.java +++ b/src/main/java/twilightforest/block/BlockTFTowerTranslucent.java @@ -37,7 +37,7 @@ public class BlockTFTowerTranslucent extends Block public static IIcon TEX_BUILT_ACTIVE; public static IIcon TEX_REVERTER_REPLACEMENT; - private static Random sideRNG = new Random(); + private static Random sideRNG = new org.bogdang.modifications.random.XSTR(); public BlockTFTowerTranslucent() { diff --git a/src/main/java/twilightforest/block/BlockTFTrophy.java b/src/main/java/twilightforest/block/BlockTFTrophy.java index 00517da5c6..c2f255ec2a 100644 --- a/src/main/java/twilightforest/block/BlockTFTrophy.java +++ b/src/main/java/twilightforest/block/BlockTFTrophy.java @@ -255,5 +255,11 @@ public void registerBlockIcons(IIconRegister par1IconRegister) ; // don't load anything } + @Override + public int tickRate(World p_149738_1_) + { + return 20; + } + } diff --git a/src/main/java/twilightforest/block/BlockTFTrophyPedestal.java b/src/main/java/twilightforest/block/BlockTFTrophyPedestal.java index d618bc8625..abf6df1d72 100644 --- a/src/main/java/twilightforest/block/BlockTFTrophyPedestal.java +++ b/src/main/java/twilightforest/block/BlockTFTrophyPedestal.java @@ -27,6 +27,7 @@ import twilightforest.item.TFItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.world.World; public class BlockTFTrophyPedestal extends Block { @@ -360,7 +361,7 @@ protected void removeNearbyShields(World world, int x, int y, int z) { @Override public int tickRate(World world) { - return 10; + return 20; } /** diff --git a/src/main/java/twilightforest/client/GuiTFGoblinCrafting.java b/src/main/java/twilightforest/client/GuiTFGoblinCrafting.java index add8f1443d..cace692fba 100644 --- a/src/main/java/twilightforest/client/GuiTFGoblinCrafting.java +++ b/src/main/java/twilightforest/client/GuiTFGoblinCrafting.java @@ -74,12 +74,12 @@ protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { if (costVal > 0) { if (this.mc.thePlayer.experienceLevel < costVal && !this.mc.thePlayer.capabilities.isCreativeMode) { int color = 0xA00000; - String cost = "" + costVal; + String cost = String.valueOf(costVal); fontRendererObj.drawStringWithShadow(cost, frameX + 48 - fontRendererObj.getStringWidth(cost), frameY + 38, color); } else { int color = 0x80FF20; - String cost = "" + costVal; + String cost = String.valueOf(costVal); fontRendererObj.drawStringWithShadow(cost, frameX + 48 - fontRendererObj.getStringWidth(cost), frameY + 38, color); } } @@ -88,12 +88,12 @@ protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { if (costVal > 0) { if (this.mc.thePlayer.experienceLevel < costVal && !this.mc.thePlayer.capabilities.isCreativeMode) { int color = 0xA00000; - String cost = "" + costVal; + String cost = String.valueOf(costVal); fontRendererObj.drawStringWithShadow(cost, frameX + 130 - fontRendererObj.getStringWidth(cost), frameY + 38, color); } else { int color = 0x80FF20; - String cost = "" + costVal; + String cost = String.valueOf(costVal); fontRendererObj.drawStringWithShadow(cost, frameX + 130 - fontRendererObj.getStringWidth(cost), frameY + 38, color); } } diff --git a/src/main/java/twilightforest/client/TFClientEvents.java b/src/main/java/twilightforest/client/TFClientEvents.java index 747bb64760..f15ae689df 100644 --- a/src/main/java/twilightforest/client/TFClientEvents.java +++ b/src/main/java/twilightforest/client/TFClientEvents.java @@ -29,7 +29,7 @@ public class TFClientEvents { private Random random; public TFClientEvents() { - this.random = new Random(); + this.random = new org.bogdang.modifications.random.XSTR(); } diff --git a/src/main/java/twilightforest/client/TFClientProxy.java b/src/main/java/twilightforest/client/TFClientProxy.java index 8b13ea5b7a..60d9f3aedc 100644 --- a/src/main/java/twilightforest/client/TFClientProxy.java +++ b/src/main/java/twilightforest/client/TFClientProxy.java @@ -179,7 +179,7 @@ public class TFClientProxy extends TFCommonProxy { ModelBiped[] arcticArmorModel; ModelBiped[] fieryArmorModel; - TFClientTicker clientTicker; + //TFClientTicker clientTicker; TFClientEvents clientEvents; boolean isDangerOverlayShown; @@ -201,8 +201,8 @@ public void doOnLoadRegistration() { Minecraft mc = FMLClientHandler.instance().getClient(); // client tick listener - clientTicker = new TFClientTicker(); - FMLCommonHandler.instance().bus().register(clientTicker); + /*clientTicker = new TFClientTicker(); + FMLCommonHandler.instance().bus().register(clientTicker);*/ // client events clientEvents = new TFClientEvents(); diff --git a/src/main/java/twilightforest/client/TFClientTicker.java b/src/main/java/twilightforest/client/TFClientTicker.java_off similarity index 80% rename from src/main/java/twilightforest/client/TFClientTicker.java rename to src/main/java/twilightforest/client/TFClientTicker.java_off index c9ccf814d7..f0b21a3994 100644 --- a/src/main/java/twilightforest/client/TFClientTicker.java +++ b/src/main/java/twilightforest/client/TFClientTicker.java_off @@ -12,8 +12,10 @@ public class TFClientTicker { /** * On the tick, we kill the vignette */ - @SubscribeEvent - public void clientTick(ClientTickEvent event) { + //@//SubscribeEvent + /*public void clientTick(ClientTickEvent event) { + //Bogdan-G: need? if vignette off or vignette.png = 1x1 fully transparent? + //test for off event Minecraft mc = Minecraft.getMinecraft(); World world = mc.theWorld; diff --git a/src/main/java/twilightforest/client/model/ModelTFBlockGoblin.java b/src/main/java/twilightforest/client/model/ModelTFBlockGoblin.java index 9ccc95c91d..c659e123d9 100644 --- a/src/main/java/twilightforest/client/model/ModelTFBlockGoblin.java +++ b/src/main/java/twilightforest/client/model/ModelTFBlockGoblin.java @@ -196,8 +196,8 @@ public void setRotationAngles(float f, float f1, float f2, float yaw, float pitc float angle = f2 / 4F; float length = 0;//16F; - block.rotationPointX = (float) Math.sin(angle) * length; - block.rotationPointZ = (float) -Math.cos(angle) * length; + block.rotationPointX = (float) org.bogdang.modifications.math.MathHelperLite.sin(angle) * length; + block.rotationPointZ = (float) -org.bogdang.modifications.math.MathHelperLite.cos(angle) * length; block.rotateAngleY = -angle; diff --git a/src/main/java/twilightforest/client/model/ModelTFBoar.java b/src/main/java/twilightforest/client/model/ModelTFBoar.java index 150f7d80f1..562fdfbe26 100644 --- a/src/main/java/twilightforest/client/model/ModelTFBoar.java +++ b/src/main/java/twilightforest/client/model/ModelTFBoar.java @@ -21,7 +21,7 @@ public ModelTFBoar() body.addBox(-5F, -8F, -7F, 10, 14, 8, 0F); body.setRotationPoint(0F, 11F, 2F); - body.rotateAngleX = 1.570796F; + body.rotateAngleX = (((float)Math.PI)/2f); leg1 = new ModelRenderer(this, 0, 16); leg1.addBox(-2F, 0F, -2F, 4, 6, 4, 0F); diff --git a/src/main/java/twilightforest/client/model/ModelTFCubeOfAnnihilation.java b/src/main/java/twilightforest/client/model/ModelTFCubeOfAnnihilation.java index 5a2fb5197b..3878603876 100644 --- a/src/main/java/twilightforest/client/model/ModelTFCubeOfAnnihilation.java +++ b/src/main/java/twilightforest/client/model/ModelTFCubeOfAnnihilation.java @@ -47,9 +47,9 @@ public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float @Override public void setRotationAngles(float f, float f1, float f2, float f3, float time, float f5, Entity entity) { - boxX.rotateAngleX = (float) Math.sin((entity.ticksExisted + time)) / 5F; - boxY.rotateAngleY = (float) Math.sin((entity.ticksExisted + time)) / 5F; - boxZ.rotateAngleZ = (float) Math.sin((entity.ticksExisted + time)) / 5F; + boxX.rotateAngleX = (float) org.bogdang.modifications.math.MathHelperLite.sin((entity.ticksExisted + time)) / 5F; + boxY.rotateAngleY = (float) org.bogdang.modifications.math.MathHelperLite.sin((entity.ticksExisted + time)) / 5F; + boxZ.rotateAngleZ = (float) org.bogdang.modifications.math.MathHelperLite.sin((entity.ticksExisted + time)) / 5F; } diff --git a/src/main/java/twilightforest/client/model/ModelTFDeathTome.java b/src/main/java/twilightforest/client/model/ModelTFDeathTome.java index eec3367d99..633f74cd2f 100644 --- a/src/main/java/twilightforest/client/model/ModelTFDeathTome.java +++ b/src/main/java/twilightforest/client/model/ModelTFDeathTome.java @@ -93,24 +93,27 @@ public void setLivingAnimations(EntityLivingBase par1EntityLiving, float par2, f this.pagesLeft.rotateAngleY = -openAngle; this.flippingPageRight.rotateAngleY = openAngle - openAngle * 2.0F * flipRight; this.flippingPageLeft.rotateAngleY = openAngle - openAngle * 2.0F * flipLeft; - this.pagesRight.rotationPointX = MathHelper.sin(openAngle); - this.pagesLeft.rotationPointX = MathHelper.sin(openAngle); - this.flippingPageRight.rotationPointX = MathHelper.sin(openAngle); - this.flippingPageLeft.rotationPointX = MathHelper.sin(openAngle); + float msin = MathHelper.sin(openAngle); + this.pagesRight.rotationPointX = msin; + this.pagesLeft.rotationPointX = msin; + this.flippingPageRight.rotationPointX = msin; + this.flippingPageLeft.rotationPointX = msin; // page rotations loosePage1.rotateAngleY = (bounce) / 4.0F; - loosePage1.rotateAngleX = MathHelper.sin((bounce) / 5.0F) / 3.0F; - loosePage1.rotateAngleZ = MathHelper.cos((bounce) / 5.0F) / 5.0F; + float msin0 = MathHelper.sin((bounce) / 5.0F); + loosePage1.rotateAngleX = msin0 / 3.0F; + float mcos0 = MathHelper.cos((bounce) / 5.0F); + loosePage1.rotateAngleZ = mcos0 / 5.0F; loosePage2.rotateAngleY = (bounce) / 3.0F; - loosePage2.rotateAngleX = MathHelper.sin((bounce) / 5.0F) / 3.0F; - loosePage2.rotateAngleZ = MathHelper.cos((bounce) / 5.0F) / 4.0F + 2; + loosePage2.rotateAngleX = msin0 / 3.0F; + loosePage2.rotateAngleZ = mcos0 / 4.0F + 2; loosePage3.rotateAngleY = (bounce) / 4.0F; - loosePage3.rotateAngleX = -MathHelper.sin((bounce) / 5.0F) / 3.0F; - loosePage3.rotateAngleZ = MathHelper.cos((bounce) / 5.0F) / 5.0F - 1.0F; + loosePage3.rotateAngleX = -msin0 / 3.0F; + loosePage3.rotateAngleZ = mcos0 / 5.0F - 1.0F; loosePage4.rotateAngleY = (bounce) / 4.0F; loosePage4.rotateAngleX = -MathHelper.sin((bounce) / 2.0F) / 4.0F; diff --git a/src/main/java/twilightforest/client/model/ModelTFDeer.java b/src/main/java/twilightforest/client/model/ModelTFDeer.java index 4502962762..bbd6500b92 100644 --- a/src/main/java/twilightforest/client/model/ModelTFDeer.java +++ b/src/main/java/twilightforest/client/model/ModelTFDeer.java @@ -21,7 +21,7 @@ public ModelTFDeer() body.addBox(-4F, -10F, -7F, 6, 18, 8, 0F); body.setRotationPoint(1F, 5F, 2F); - body.rotateAngleX = 1.570796F; + body.rotateAngleX = (((float)Math.PI)/2f); leg1 = new ModelRenderer(this, 0, 17); leg1.addBox(-3F, 0F, -2F, 2, 12, 3, 0F); leg1.setRotationPoint(0F, 12F, 9F); diff --git a/src/main/java/twilightforest/client/model/ModelTFFireBeetle.java b/src/main/java/twilightforest/client/model/ModelTFFireBeetle.java index 5f127945b0..b6eb4e48bd 100644 --- a/src/main/java/twilightforest/client/model/ModelTFFireBeetle.java +++ b/src/main/java/twilightforest/client/model/ModelTFFireBeetle.java @@ -53,7 +53,7 @@ public ModelTFFireBeetle() RearEnd = new ModelRenderer(this, 22, 9); RearEnd.addBox(-6F, -9F, -4F, 12, 14, 9); RearEnd.setRotationPoint(0F, 18F, 7F); - setRotation(RearEnd, 1.570796F, 0F, 0F); + setRotation(RearEnd, (((float)Math.PI)/2f), 0F, 0F); Leg6 = new ModelRenderer(this, 40, 0); Leg6.addBox(-1F, -1F, -1F, 10, 2, 2); @@ -101,7 +101,7 @@ public ModelTFFireBeetle() jaw1b = new ModelRenderer(this, 0, 0); jaw1b.addBox(0F, 0F, 0F, 1, 1, 2); jaw1b.setRotationPoint(0F, 0F, -2F); - setRotation(jaw1b, 0F, 1.570796F, 0F); + setRotation(jaw1b, 0F, (((float)Math.PI)/2f), 0F); jaw2a = new ModelRenderer(this, 0, 0); jaw2a.addBox(-1F, 0F, -2F, 1, 1, 2); @@ -111,12 +111,12 @@ public ModelTFFireBeetle() jaw2b = new ModelRenderer(this, 0, 0); jaw2b.addBox(0F, 0F, -2F, 1, 1, 2); jaw2b.setRotationPoint(0F, 0F, -2F); - setRotation(jaw2b, 0F, 1.570796F, 0F); + setRotation(jaw2b, 0F, (((float)Math.PI)/2f), 0F); antenna1 = new ModelRenderer(this, 42, 4); antenna1.addBox(0F, -0.5F, -0.5F, 10, 1, 1); antenna1.setRotationPoint(1F, -3F, -5F); - setRotation(antenna1, 0F, 1.047198F, -0.296706F); + setRotation(antenna1, 0F, (((float)Math.PI)/3f), -0.296706F); antenna2 = new ModelRenderer(this, 42, 4); antenna2.addBox(0F, -0.5F, -0.5F, 10, 1, 1); diff --git a/src/main/java/twilightforest/client/model/ModelTFGhast.java b/src/main/java/twilightforest/client/model/ModelTFGhast.java index 39379ef3eb..d7ca321b06 100644 --- a/src/main/java/twilightforest/client/model/ModelTFGhast.java +++ b/src/main/java/twilightforest/client/model/ModelTFGhast.java @@ -22,7 +22,7 @@ public ModelTFGhast() this.body = new ModelRenderer(this, 0, 0); this.body.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16); this.body.rotationPointY += (float)(24 + yOffset); - Random rand = new Random(1660L); + Random rand = new org.bogdang.modifications.random.XSTR(1660L); for (int i = 0; i < this.tentacles.length; ++i) { diff --git a/src/main/java/twilightforest/client/model/ModelTFHydra.java b/src/main/java/twilightforest/client/model/ModelTFHydra.java index 70aea681e0..43b05c70e0 100644 --- a/src/main/java/twilightforest/client/model/ModelTFHydra.java +++ b/src/main/java/twilightforest/client/model/ModelTFHydra.java @@ -264,7 +264,7 @@ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, f super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); leg1.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; - leg2.rotateAngleX = MathHelper.cos(f * 0.6662F + 3.141593F) * 1.4F * f1; + leg2.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1; leg1.rotateAngleY = 0.0F; leg2.rotateAngleY = 0.0F; @@ -281,18 +281,18 @@ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, f // Vec3 vec; // // vec = Vec3.getVec3Pool().getVecFromPool(0, 0, 7*-16); -// vec.rotateAroundX((60 * 3.141593F) / 180F); -// vec.rotateAroundY((0 * 3.141593F) / 180F); +// vec.rotateAroundX((60 * (float)Math.PI) / 180F); +// vec.rotateAroundY((0 * (float)Math.PI) / 180F); // head1.setRotationPoint((float)vec.xCoord, (float)vec.yCoord - 48, (float)vec.zCoord); // // vec = Vec3.getVec3Pool().getVecFromPool(0, 0, 9*-16); -// vec.rotateAroundX((45 * 3.141593F) / 180F); -// vec.rotateAroundY((-60 * 3.141593F) / 180F); +// vec.rotateAroundX((45 * (float)Math.PI) / 180F); +// vec.rotateAroundY((-60 * (float)Math.PI) / 180F); // head2.setRotationPoint((float)vec.xCoord, (float)vec.yCoord - 48, (float)vec.zCoord); // // vec = Vec3.getVec3Pool().getVecFromPool(0, 0, 9*-16); -// vec.rotateAroundX((-10 * 3.141593F) / 180F); -// vec.rotateAroundY((60 * 3.141593F) / 180F); +// vec.rotateAroundX((-10 * (float)Math.PI) / 180F); +// vec.rotateAroundY((60 * (float)Math.PI) / 180F); // head3.setRotationPoint((float)vec.xCoord, (float)vec.yCoord - 48, (float)vec.zCoord); // // // rotate the heads diff --git a/src/main/java/twilightforest/client/model/ModelTFIceExploder.java b/src/main/java/twilightforest/client/model/ModelTFIceExploder.java index 175a565d36..8f0f8ad06a 100644 --- a/src/main/java/twilightforest/client/model/ModelTFIceExploder.java +++ b/src/main/java/twilightforest/client/model/ModelTFIceExploder.java @@ -90,8 +90,9 @@ public void setLivingAnimations(EntityLivingBase par1EntityLiving, float par2, f this.spikes[i].rotateAngleZ += i * 3; this.spikes[i].rotationPointX = MathHelper.cos((par1EntityLiving.ticksExisted + time) / (float)i) * 3F; - this.spikes[i].rotationPointY = 5F + MathHelper.sin((par1EntityLiving.ticksExisted + time) / (float)i) * 3F; - this.spikes[i].rotationPointZ = MathHelper.sin((par1EntityLiving.ticksExisted + time) / (float)i) * 3F; + float msin = MathHelper.sin((par1EntityLiving.ticksExisted + time) / (float)i); + this.spikes[i].rotationPointY = 5F + msin * 3F; + this.spikes[i].rotationPointZ = msin * 3F; ((ModelRenderer)this.spikes[i].childModels.get(0)).rotationPointY = 10 + MathHelper.sin((i + par1EntityLiving.ticksExisted + time) / i) * 3F; diff --git a/src/main/java/twilightforest/client/model/ModelTFIceShooter.java b/src/main/java/twilightforest/client/model/ModelTFIceShooter.java index 4687773526..2461bf8557 100644 --- a/src/main/java/twilightforest/client/model/ModelTFIceShooter.java +++ b/src/main/java/twilightforest/client/model/ModelTFIceShooter.java @@ -15,7 +15,7 @@ public void setLivingAnimations(EntityLivingBase par1EntityLiving, float par2, f { for (int i = 0; i < spikes.length; i++) { // rotate the spikes - this.spikes[i].rotateAngleY = (3.14159F / 2F) + (MathHelper.sin((par1EntityLiving.ticksExisted + time) / 5.0F) * 0.5F); + this.spikes[i].rotateAngleY = ((float)Math.PI / 2F) + (MathHelper.sin((par1EntityLiving.ticksExisted + time) / 5.0F) * 0.5F); this.spikes[i].rotateAngleX = (par1EntityLiving.ticksExisted + time) / 5.0F; this.spikes[i].rotateAngleZ = MathHelper.cos(i / 5.0F) / 4.0F; diff --git a/src/main/java/twilightforest/client/model/ModelTFKnightPhantom.java b/src/main/java/twilightforest/client/model/ModelTFKnightPhantom.java index ac46259be0..547ce92da2 100644 --- a/src/main/java/twilightforest/client/model/ModelTFKnightPhantom.java +++ b/src/main/java/twilightforest/client/model/ModelTFKnightPhantom.java @@ -157,10 +157,12 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl // this.bipedRightArm.rotateAngleY = 0.0F; // this.bipedLeftArm.rotateAngleY = 0.0F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + float mcos = MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleZ += mcos; + this.bipedLeftArm.rotateAngleZ -= mcos; + float msin = MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleX += msin; + this.bipedLeftArm.rotateAngleX -= msin; } diff --git a/src/main/java/twilightforest/client/model/ModelTFKnightPhantom2.java b/src/main/java/twilightforest/client/model/ModelTFKnightPhantom2.java index f721c7273c..6bdd823920 100644 --- a/src/main/java/twilightforest/client/model/ModelTFKnightPhantom2.java +++ b/src/main/java/twilightforest/client/model/ModelTFKnightPhantom2.java @@ -63,8 +63,9 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedRightLeg.rotateAngleY = 0; this.bipedRightLeg.rotateAngleZ = 0; - this.bipedRightLeg.rotateAngleX = 0.2F * MathHelper.sin(par3 * 0.3F) + 0.4F; - this.bipedLeftLeg.rotateAngleX = 0.2F * MathHelper.sin(par3 * 0.3F) + 0.4F; + float msin = 0.2F * MathHelper.sin(par3 * 0.3F) + 0.4F; + this.bipedRightLeg.rotateAngleX = msin; + this.bipedLeftLeg.rotateAngleX = msin; } diff --git a/src/main/java/twilightforest/client/model/ModelTFKobold.java b/src/main/java/twilightforest/client/model/ModelTFKobold.java index 7716ba651c..09d07265f1 100644 --- a/src/main/java/twilightforest/client/model/ModelTFKobold.java +++ b/src/main/java/twilightforest/client/model/ModelTFKobold.java @@ -96,8 +96,10 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI); this.bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI); - this.bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F; - this.bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F; + float mcos = MathHelper.cos(par1 * 0.6662F + (float)Math.PI); + this.bipedRightArm.rotateAngleX = mcos * 2.0F * par2 * 0.5F; + float mcos0 = MathHelper.cos(par1 * 0.6662F); + this.bipedLeftArm.rotateAngleX = mcos0 * 2.0F * par2 * 0.5F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; @@ -105,15 +107,17 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedLeftArm.rotateAngleX = -((float)Math.PI * .15F); - this.bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; - this.bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.bipedRightLeg.rotateAngleX = mcos0 * 1.4F * par2; + this.bipedLeftLeg.rotateAngleX = mcos * 1.4F * par2; this.bipedRightLeg.rotateAngleY = 0.0F; this.bipedLeftLeg.rotateAngleY = 0.0F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.19F) * 0.15F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.19F) * 0.15F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.267F) * 0.25F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.267F) * 0.25F; + float mcos1 = MathHelper.cos(par3 * 0.19F) * 0.15F + 0.05F; + this.bipedRightArm.rotateAngleZ += mcos1; + this.bipedLeftArm.rotateAngleZ -= mcos1; + float msin = MathHelper.sin(par3 * 0.267F) * 0.25F; + this.bipedRightArm.rotateAngleX += msin; + this.bipedLeftArm.rotateAngleX -= msin; if (this.isJumping) { // open jaw diff --git a/src/main/java/twilightforest/client/model/ModelTFLich.java b/src/main/java/twilightforest/client/model/ModelTFLich.java index f551ff2a97..be4d0196aa 100644 --- a/src/main/java/twilightforest/client/model/ModelTFLich.java +++ b/src/main/java/twilightforest/client/model/ModelTFLich.java @@ -136,7 +136,7 @@ public void setLivingAnimations(EntityLivingBase par1EntityLiving, float par2, f Vec3 vec; for (int i = 0; i < shields; i++) { vec = Vec3.createVectorHelper(11, 0, 0); - float rotateY = ((i * (360F / shields)) * 3.141593F) / 180F; + float rotateY = ((i * (360F / shields)) * (float)Math.PI) / 180F; vec.rotateAroundY(rotateY); ModelRenderer shield = new ModelRenderer(this, 26, 40); shield.addBox(0.5F, -6F, -6F, 1, 12, 12); @@ -159,20 +159,22 @@ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, f { aimedBow = false; super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - float ogSin = MathHelper.sin(onGround * 3.141593F); - float otherSin = MathHelper.sin((1.0F - (1.0F - onGround) * (1.0F - onGround)) * 3.141593F); + float ogSin = MathHelper.sin(onGround * (float)Math.PI); + float otherSin = MathHelper.sin((1.0F - (1.0F - onGround) * (1.0F - onGround)) * (float)Math.PI); bipedRightArm.rotateAngleZ = 0.0F; bipedLeftArm.rotateAngleZ = 0.5F; bipedRightArm.rotateAngleY = -(0.1F - ogSin * 0.6F); bipedLeftArm.rotateAngleY = 0.1F - ogSin * 0.6F; - bipedRightArm.rotateAngleX = -1.570796F; - bipedLeftArm.rotateAngleX = -3.141593F; + bipedRightArm.rotateAngleX = -(((float)Math.PI)/2f); + bipedLeftArm.rotateAngleX = -(float)Math.PI; bipedRightArm.rotateAngleX -= ogSin * 1.2F - otherSin * 0.4F; bipedLeftArm.rotateAngleX -= ogSin * 1.2F - otherSin * 0.4F; - bipedRightArm.rotateAngleZ += MathHelper.cos(f2 * 0.26F) * 0.15F + 0.05F; - bipedLeftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.26F) * 0.15F + 0.05F; - bipedRightArm.rotateAngleX += MathHelper.sin(f2 * 0.167F) * 0.15F; - bipedLeftArm.rotateAngleX -= MathHelper.sin(f2 * 0.167F) * 0.15F; + float c = MathHelper.cos(f2 * 0.26F) * 0.15F + 0.05F; + bipedRightArm.rotateAngleZ += c; + bipedLeftArm.rotateAngleZ -= c; + float s = MathHelper.sin(f2 * 0.167F) * 0.15F; + bipedRightArm.rotateAngleX += s; + bipedLeftArm.rotateAngleX -= s; bipedHead.rotationPointY = -4.0F; bipedHeadwear.rotationPointY = -4.0F; diff --git a/src/main/java/twilightforest/client/model/ModelTFLichMinion.java b/src/main/java/twilightforest/client/model/ModelTFLichMinion.java index a125b1a833..ef51c8523c 100644 --- a/src/main/java/twilightforest/client/model/ModelTFLichMinion.java +++ b/src/main/java/twilightforest/client/model/ModelTFLichMinion.java @@ -35,12 +35,12 @@ public void render(Entity par1Entity, float par2, float par3, float par4, float { EntityTFLichMinion minion = (EntityTFLichMinion)par1Entity; // make strong minions bigger - if (minion.getActivePotionEffect(Potion.damageBoost) != null) { + //if (minion.getActivePotionEffect(Potion.damageBoost) != null) { super.render(par1Entity, par2, par3, par4, par5, par6, par7); - } - else { - super.render(par1Entity, par2, par3, par4, par5, par6, par7); - } + //} + //else { + //super.render(par1Entity, par2, par3, par4, par5, par6, par7); + //} } } diff --git a/src/main/java/twilightforest/client/model/ModelTFMinoshroom.java b/src/main/java/twilightforest/client/model/ModelTFMinoshroom.java index dd01d0f14e..7f6b501066 100644 --- a/src/main/java/twilightforest/client/model/ModelTFMinoshroom.java +++ b/src/main/java/twilightforest/client/model/ModelTFMinoshroom.java @@ -33,7 +33,7 @@ public ModelTFMinoshroom() body = new ModelRenderer(this, 18, 4); body.addBox(-6F, -10F, -7F, 12, 18, 10); body.setRotationPoint(0F, 5F, 2F); - setRotation(body, 1.570796F, 0F, 0F); + setRotation(body, (((float)Math.PI)/2f), 0F, 0F); leg1 = new ModelRenderer(this, 0, 16); leg1.addBox(-3F, 0F, -2F, 4, 12, 4); @@ -54,7 +54,7 @@ public ModelTFMinoshroom() udders = new ModelRenderer(this, 52, 0); udders.addBox(-2F, -3F, 0F, 4, 6, 2); udders.setRotationPoint(0F, 14F, 6F); - setRotation(udders, 1.570796F, 0F, 0F); + setRotation(udders, (((float)Math.PI)/2f), 0F, 0F); bipedBody = new ModelRenderer(this, 64, 0); bipedBody.addBox(-4F, 0F, -2.5F, 8, 12, 5); @@ -151,13 +151,15 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; - this.bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F; - this.bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F; + float c = MathHelper.cos(par1 * 0.6662F); + float c0 = MathHelper.cos(par1 * 0.6662F + (float)Math.PI); + this.bipedRightArm.rotateAngleX = c0 * 2.0F * par2 * 0.5F; + this.bipedLeftArm.rotateAngleX = c * 2.0F * par2 * 0.5F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; - this.bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; - this.bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.bipedRightLeg.rotateAngleX = c * 1.4F * par2; + this.bipedLeftLeg.rotateAngleX = c0 * 1.4F * par2; this.bipedRightLeg.rotateAngleY = 0.0F; this.bipedLeftLeg.rotateAngleY = 0.0F; @@ -173,10 +175,12 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + float c1 = MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleZ += c1; + this.bipedLeftArm.rotateAngleZ -= c1; + float s = MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleX += s; + this.bipedLeftArm.rotateAngleX -= s; if (this.aimedBow) { @@ -190,18 +194,18 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; this.bipedRightArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F; this.bipedLeftArm.rotateAngleX -= var7 * 1.2F - var8 * 0.4F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleZ += c1; + this.bipedLeftArm.rotateAngleZ -= c1; + this.bipedRightArm.rotateAngleX += s; + this.bipedLeftArm.rotateAngleX -= s; } // copied from ModelQuadruped this.body.rotateAngleX = ((float)Math.PI / 2F); - this.leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; - this.leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; - this.leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; - this.leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; + this.leg1.rotateAngleX = c * 1.4F * par2; + this.leg2.rotateAngleX = c0 * 1.4F * par2; + this.leg3.rotateAngleX = c0 * 1.4F * par2; + this.leg4.rotateAngleX = c * 1.4F * par2; } } diff --git a/src/main/java/twilightforest/client/model/ModelTFMosquitoSwarm.java b/src/main/java/twilightforest/client/model/ModelTFMosquitoSwarm.java index bbf9adb08f..6a31537cee 100644 --- a/src/main/java/twilightforest/client/model/ModelTFMosquitoSwarm.java +++ b/src/main/java/twilightforest/client/model/ModelTFMosquitoSwarm.java @@ -20,7 +20,7 @@ public class ModelTFMosquitoSwarm extends ModelBase ModelRenderer node5; ModelRenderer node6; - Random rand = new Random(); + Random rand = new org.bogdang.modifications.random.XSTR(); public ModelTFMosquitoSwarm() { @@ -83,7 +83,7 @@ public void addBugsToNodes(ModelRenderer node) for (int i = 0; i < bugs; i++) { Vec3 vec = Vec3.createVectorHelper(11, 0, 0); - float rotateY = ((i * (360F / bugs)) * 3.141593F) / 180F; + float rotateY = ((i * (360F / bugs)) * (float)Math.PI) / 180F; vec.rotateAroundY(rotateY); ModelRenderer bug = new ModelRenderer(this, rand.nextInt(28), rand.nextInt(28)); @@ -101,33 +101,43 @@ public void addBugsToNodes(ModelRenderer node) @Override public void setLivingAnimations(EntityLivingBase par1EntityLiving, float par2, float par3, float time) { - core.rotateAngleY = (par1EntityLiving.ticksExisted + time) / 5.0F; - core.rotateAngleX = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 5.0F) / 4.0F; - core.rotateAngleZ = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 5.0F) / 4.0F; + //Bogdan-G: reduce duplicate sin/cos, improve perf + float value0 = (par1EntityLiving.ticksExisted + time) / 5.0F; + float msin = MathHelper.sin(value0); + float mcos = MathHelper.cos(value0); + float msin0 = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 6.0F); + float msin1 = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 2.0F); + float msin2 = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 7.0F); + float mcos0 = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 4.0F); + float mcos1 = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 7.0F); + + core.rotateAngleY = value0; + core.rotateAngleX = msin / 4.0F; + core.rotateAngleZ = mcos / 4.0F; node1.rotateAngleY = (par1EntityLiving.ticksExisted + time) / 2.0F; - node1.rotateAngleX = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 6.0F) / 2.0F; - node1.rotateAngleZ = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 5.0F) / 4.0F; + node1.rotateAngleX = msin0 / 2.0F; + node1.rotateAngleZ = mcos / 4.0F; - node2.rotateAngleY = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 2.0F) / 3.0F; - node2.rotateAngleX = (par1EntityLiving.ticksExisted + time) / 5.0F; - node2.rotateAngleZ = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 5.0F) / 4.0F; + node2.rotateAngleY = msin1 / 3.0F; + node2.rotateAngleX = value0; + node2.rotateAngleZ = mcos / 4.0F; - node3.rotateAngleY = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 7.0F) / 3.0F; - node3.rotateAngleX = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 4.0F) / 2.0F; - node3.rotateAngleZ = (par1EntityLiving.ticksExisted + time) / 5.0F; + node3.rotateAngleY = msin2 / 3.0F; + node3.rotateAngleX = mcos0 / 2.0F; + node3.rotateAngleZ = value0; node4.rotateAngleX = (par1EntityLiving.ticksExisted + time) / 2.0F; - node4.rotateAngleZ = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 6.0F) / 2.0F; - node4.rotateAngleY = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 5.0F) / 4.0F; + node4.rotateAngleZ = msin0 / 2.0F; + node4.rotateAngleY = msin / 4.0F; - node5.rotateAngleZ = MathHelper.sin((par1EntityLiving.ticksExisted + time) / 2.0F) / 3.0F; - node5.rotateAngleY = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 5.0F) / 4.0F; - node5.rotateAngleX = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 5.0F) / 4.0F; + node5.rotateAngleZ = msin1 / 3.0F; + node5.rotateAngleY = mcos / 4.0F; + node5.rotateAngleX = mcos / 4.0F; - node6.rotateAngleZ = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 7.0F) / 3.0F; - node6.rotateAngleX = MathHelper.cos((par1EntityLiving.ticksExisted + time) / 4.0F) / 2.0F; - node6.rotateAngleY = (par1EntityLiving.ticksExisted + time) / 5.0F; + node6.rotateAngleZ = mcos1 / 3.0F; + node6.rotateAngleX = mcos0 / 2.0F; + node6.rotateAngleY = value0; } diff --git a/src/main/java/twilightforest/client/model/ModelTFPinchBeetle.java b/src/main/java/twilightforest/client/model/ModelTFPinchBeetle.java index abde43a095..672c60c56e 100644 --- a/src/main/java/twilightforest/client/model/ModelTFPinchBeetle.java +++ b/src/main/java/twilightforest/client/model/ModelTFPinchBeetle.java @@ -61,7 +61,7 @@ public ModelTFPinchBeetle() RearEnd = new ModelRenderer(this, 28, 14); RearEnd.addBox(-5F, -9F, -4F, 10, 10, 8); RearEnd.setRotationPoint(0F, 18F, 7F); - setRotation(RearEnd, 1.570796F, 0F, 0F); + setRotation(RearEnd, (((float)Math.PI)/2f), 0F, 0F); Leg6 = new ModelRenderer(this, 40, 0); Leg6.addBox(-1F, -1F, -1F, 10, 2, 2); @@ -109,7 +109,7 @@ public ModelTFPinchBeetle() jaw1b = new ModelRenderer(this, 40, 10); jaw1b.addBox(-1F, -1F, -1F, 10, 2, 2); jaw1b.setRotationPoint(7F, 0F, 0F); - setRotation(jaw1b, 0F, -1.047197F, 0F); + setRotation(jaw1b, 0F, -(((float)Math.PI)/3f), 0F); jaw2a = new ModelRenderer(this, 40, 6); jaw2a.addBox(-1F, -1F, -1.5F, 8, 2, 3); @@ -119,12 +119,12 @@ public ModelTFPinchBeetle() jaw2b = new ModelRenderer(this, 40, 10); jaw2b.addBox(-1F, -1F, -1F, 10, 2, 2); jaw2b.setRotationPoint(7F, 0F, 0F); - setRotation(jaw2b, 0F, 1.047197F, 0F); + setRotation(jaw2b, 0F, (((float)Math.PI)/3f), 0F); antenna1 = new ModelRenderer(this, 42, 4); antenna1.addBox(0F, -0.5F, -0.5F, 10, 1, 1); antenna1.setRotationPoint(1F, -3F, -5F); - setRotation(antenna1, 0F, 1.047198F, -0.296706F); + setRotation(antenna1, 0F, (((float)Math.PI)/3f), -0.296706F); antenna2 = new ModelRenderer(this, 42, 4); antenna2.addBox(0F, -0.5F, -0.5F, 10, 1, 1); @@ -147,12 +147,12 @@ public ModelTFPinchBeetle() tooth1b = new ModelRenderer(this, 0, 0); tooth1b.addBox(-2.5F, -0.5F, -0F, 2, 1, 1); tooth1b.setRotationPoint(6F, 0F, 0F); - setRotation(tooth1b, 0F, 1.5707963F, 0); + setRotation(tooth1b, 0F, (((float)Math.PI)/2f), 0); tooth1c = new ModelRenderer(this, 0, 0); tooth1c.addBox(-2.5F, -0.5F, -0F, 2, 1, 1); tooth1c.setRotationPoint(3F, 0F, 0F); - setRotation(tooth1c, 0F, 1.5707963F, 0); + setRotation(tooth1c, 0F, (((float)Math.PI)/2f), 0); tooth2a = new ModelRenderer(this, 0, 0); tooth2a.addBox(0F, -0.5F, -1F, 2, 1, 1); @@ -162,12 +162,12 @@ public ModelTFPinchBeetle() tooth2b = new ModelRenderer(this, 0, 0); tooth2b.addBox(-2.5F, -0.5F, -1F, 2, 1, 1); tooth2b.setRotationPoint(6F, 0F, 0F); - setRotation(tooth2b, 0F, -1.5707963F, 0); + setRotation(tooth2b, 0F, -(((float)Math.PI)/2f), 0); tooth2c = new ModelRenderer(this, 0, 0); tooth2c.addBox(-2.5F, -0.5F, -1F, 2, 1, 1); tooth2c.setRotationPoint(3F, 0F, 0F); - setRotation(tooth2c, 0F, -1.5707963F, 0); + setRotation(tooth2c, 0F, -(((float)Math.PI)/2f), 0); head.addChild(jaw1a); jaw1a.addChild(jaw1b); diff --git a/src/main/java/twilightforest/client/model/ModelTFQuestRam.java b/src/main/java/twilightforest/client/model/ModelTFQuestRam.java index 08220a7c15..60b50d06d6 100644 --- a/src/main/java/twilightforest/client/model/ModelTFQuestRam.java +++ b/src/main/java/twilightforest/client/model/ModelTFQuestRam.java @@ -6,6 +6,7 @@ package twilightforest.client.model; +import java.util.BitSet; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; @@ -38,7 +39,7 @@ public class ModelTFQuestRam extends ModelBase ModelRenderer head; ModelRenderer[] segments; - boolean[] segmentEnabled; + BitSet segmentEnabled; int[] colorOrder = new int[] {0, 8, 7, 15, 14, 1, 4, 5, 13, 3, 9, 11, 10, 2, 6, 12}; @@ -136,13 +137,13 @@ public ModelTFQuestRam() head.addChild(nose); segments = new ModelRenderer[16]; - segmentEnabled = new boolean[16]; + segmentEnabled = new BitSet(16); for (int i = 0; i < 16; i++) { segments[i] = new ModelRenderer(this, 0, 104); segments[i].addBox(-9F, -7.5F, 0F, 18, 15, 2); segments[i].setRotationPoint(0F, -1F, 2F); - segmentEnabled[i] = false; + //segmentEnabled[i] = false; } } @@ -165,7 +166,7 @@ public void render(Entity entity, float f, float f1, float f2, float f3, float f head.render(f5); for (int i = 0; i < 16; i++) { - if (segmentEnabled[i]) { + if (segmentEnabled.get(i)) { float var4 = 1.0F; GL11.glColor3f(var4 * EntitySheep.fleeceColorTable[i][0], var4 * EntitySheep.fleeceColorTable[i][1], var4 * EntitySheep.fleeceColorTable[i][2]); segments[i].render(f5); @@ -223,13 +224,13 @@ public void setLivingAnimations(EntityLivingBase par1EntityLiving, float par2, f int segmentOffset = 2; for (int color : colorOrder) { if (ram.isColorPresent(color)) { - segmentEnabled[color] = true; + segmentEnabled.set(color); segments[color].rotationPointZ = segmentOffset; segmentOffset += 2; } else { - segmentEnabled[color] = false; + segmentEnabled.clear(color); } } } diff --git a/src/main/java/twilightforest/client/model/ModelTFSlimeBeetle.java b/src/main/java/twilightforest/client/model/ModelTFSlimeBeetle.java index 81005388b3..14f65595ed 100644 --- a/src/main/java/twilightforest/client/model/ModelTFSlimeBeetle.java +++ b/src/main/java/twilightforest/client/model/ModelTFSlimeBeetle.java @@ -55,7 +55,7 @@ public ModelTFSlimeBeetle(boolean renderpass) RearEnd = new ModelRenderer(this, 31, 6); RearEnd.addBox(-4F, -11F, -4F, 8, 10, 8); RearEnd.setRotationPoint(0F, 18F, 7F); - setRotation(RearEnd, 1.570796F, 0F, 0F); + setRotation(RearEnd, (((float)Math.PI)/2f), 0F, 0F); Leg6 = new ModelRenderer(this, 40, 0); Leg6.addBox(-1F, -1F, -1F, 10, 2, 2); @@ -98,7 +98,7 @@ public ModelTFSlimeBeetle(boolean renderpass) antenna1 = new ModelRenderer(this, 38, 4); antenna1.addBox(0F, -0.5F, -0.5F, 12, 1, 1); antenna1.setRotationPoint(1F, -3F, -5F); - setRotation(antenna1, 0F, 1.047198F, -0.296706F); + setRotation(antenna1, 0F, (((float)Math.PI)/3f), -0.296706F); antenna2 = new ModelRenderer(this, 38, 4); antenna2.addBox(0F, -0.5F, -0.5F, 12, 1, 1); diff --git a/src/main/java/twilightforest/client/model/ModelTFSnowQueen.java b/src/main/java/twilightforest/client/model/ModelTFSnowQueen.java index 3bb6c4aeea..2649077062 100644 --- a/src/main/java/twilightforest/client/model/ModelTFSnowQueen.java +++ b/src/main/java/twilightforest/client/model/ModelTFSnowQueen.java @@ -54,23 +54,23 @@ private ModelRenderer makeSideCrown(float spikeDepth, float crownX, float angle) ModelRenderer crownSide = new ModelRenderer(this, 28, 28); crownSide.addBox(-3.5F, -0.5F, -0.5F, 7, 1, 1); crownSide.setRotationPoint(crownX, -6.0F, 0.0F); - crownSide.rotateAngleY = 3.14159F / 2.0F; + crownSide.rotateAngleY = (float)Math.PI / 2.0F; ModelRenderer spike4 = new ModelRenderer(this, 48, 27); spike4.addBox(-0.5F, -3.5F, spikeDepth, 1, 4, 1); - spike4.rotateAngleX = angle * 1.5F / 180F * 3.14159F; + spike4.rotateAngleX = angle * 1.5F / 180F * (float)Math.PI; ModelRenderer spike3l = new ModelRenderer(this, 52, 28); spike3l.addBox(-0.5F, -2.5F, spikeDepth, 1, 3, 1); spike3l.setRotationPoint(-2.5F, 0.0F, 0.0F); - spike3l.rotateAngleX = angle / 180F * 3.14159F; - spike3l.rotateAngleZ = -10F / 180F * 3.14159F; + spike3l.rotateAngleX = angle / 180F * (float)Math.PI; + spike3l.rotateAngleZ = -10F / 180F * (float)Math.PI; ModelRenderer spike3r = new ModelRenderer(this, 52, 28); spike3r.addBox(-0.5F, -2.5F, spikeDepth, 1, 3, 1); spike3r.setRotationPoint(2.5F, 0.0F, 0.0F); - spike3r.rotateAngleX = angle / 180F * 3.14159F; - spike3r.rotateAngleZ = 10F / 180F * 3.14159F; + spike3r.rotateAngleX = angle / 180F * (float)Math.PI; + spike3r.rotateAngleZ = 10F / 180F * (float)Math.PI; crownSide.addChild(spike4); @@ -86,19 +86,19 @@ private ModelRenderer makeFrontCrown(float spikeDepth, float crownZ, float angle ModelRenderer spike4 = new ModelRenderer(this, 48, 27); spike4.addBox(-0.5F, -3.5F, spikeDepth, 1, 4, 1); - spike4.rotateAngleX = angle * 1.5F / 180F * 3.14159F; + spike4.rotateAngleX = angle * 1.5F / 180F * (float)Math.PI; ModelRenderer spike3l = new ModelRenderer(this, 52, 28); spike3l.addBox(-0.5F, -2.5F, spikeDepth, 1, 3, 1); spike3l.setRotationPoint(-2.5F, 0.0F, 0.0F); - spike3l.rotateAngleX = angle / 180F * 3.14159F; - spike3l.rotateAngleZ = -10F / 180F * 3.14159F; + spike3l.rotateAngleX = angle / 180F * (float)Math.PI; + spike3l.rotateAngleZ = -10F / 180F * (float)Math.PI; ModelRenderer spike3r = new ModelRenderer(this, 52, 28); spike3r.addBox(-0.5F, -2.5F, spikeDepth, 1, 3, 1); spike3r.setRotationPoint(2.5F, 0.0F, 0.0F); - spike3r.rotateAngleX = angle / 180F * 3.14159F; - spike3r.rotateAngleZ = 10F / 180F * 3.14159F; + spike3r.rotateAngleX = angle / 180F * (float)Math.PI; + spike3r.rotateAngleZ = 10F / 180F * (float)Math.PI; crownFront.addChild(spike4); crownFront.addChild(spike3l); diff --git a/src/main/java/twilightforest/client/model/ModelTFTroll.java b/src/main/java/twilightforest/client/model/ModelTFTroll.java index 7738d53392..6ad6339fbc 100644 --- a/src/main/java/twilightforest/client/model/ModelTFTroll.java +++ b/src/main/java/twilightforest/client/model/ModelTFTroll.java @@ -70,12 +70,14 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI); this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; - this.bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F; - this.bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F; + float c = MathHelper.cos(par1 * 0.6662F + (float)Math.PI); + this.bipedRightArm.rotateAngleX = c * 2.0F * par2 * 0.5F; + float c0 = MathHelper.cos(par1 * 0.6662F); + this.bipedLeftArm.rotateAngleX = c0 * 2.0F * par2 * 0.5F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; - this.bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; - this.bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.bipedRightLeg.rotateAngleX = c0 * 1.4F * par2; + this.bipedLeftLeg.rotateAngleX = c * 1.4F * par2; this.bipedRightLeg.rotateAngleY = 0.0F; this.bipedLeftLeg.rotateAngleY = 0.0F; @@ -103,10 +105,12 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedLeftArm.rotateAngleY = 0.0F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + float c1 = MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleZ += c1; + this.bipedLeftArm.rotateAngleZ -= c1; + float s = MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleX += s; + this.bipedLeftArm.rotateAngleX -= s; } diff --git a/src/main/java/twilightforest/client/model/ModelTFWraith.java b/src/main/java/twilightforest/client/model/ModelTFWraith.java index a3563168b1..b269beae68 100644 --- a/src/main/java/twilightforest/client/model/ModelTFWraith.java +++ b/src/main/java/twilightforest/client/model/ModelTFWraith.java @@ -51,10 +51,12 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F; this.bipedLeftArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + float c = MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleZ += c; + this.bipedLeftArm.rotateAngleZ -= c; + float s = MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleX += s; + this.bipedLeftArm.rotateAngleX -= s; } diff --git a/src/main/java/twilightforest/client/model/ModelTFYeti.java b/src/main/java/twilightforest/client/model/ModelTFYeti.java index 6fe806a4fb..7b27d78402 100644 --- a/src/main/java/twilightforest/client/model/ModelTFYeti.java +++ b/src/main/java/twilightforest/client/model/ModelTFYeti.java @@ -89,12 +89,14 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI); this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; - this.bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F; - this.bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F; + float c = MathHelper.cos(par1 * 0.6662F + (float)Math.PI); + this.bipedRightArm.rotateAngleX = c * 2.0F * par2 * 0.5F; + float c0 = MathHelper.cos(par1 * 0.6662F); + this.bipedLeftArm.rotateAngleX = c0 * 2.0F * par2 * 0.5F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; - this.bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; - this.bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.bipedRightLeg.rotateAngleX = c0 * 1.4F * par2; + this.bipedLeftLeg.rotateAngleX = c * 1.4F * par2; this.bipedRightLeg.rotateAngleY = 0.0F; this.bipedLeftLeg.rotateAngleY = 0.0F; @@ -120,10 +122,12 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedLeftArm.rotateAngleY = 0.0F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + float c1 = MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleZ += c1; + this.bipedLeftArm.rotateAngleZ -= c1; + float s = MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleX += s; + this.bipedLeftArm.rotateAngleX -= s; // if yeti is angry, hold arms forwards like a zombie @@ -139,10 +143,10 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleZ += c1; + this.bipedLeftArm.rotateAngleZ -= c1; + this.bipedRightArm.rotateAngleX += s; + this.bipedLeftArm.rotateAngleX -= s; } } diff --git a/src/main/java/twilightforest/client/model/ModelTFYetiAlpha.java b/src/main/java/twilightforest/client/model/ModelTFYetiAlpha.java index cad170e6d2..6202e01cde 100644 --- a/src/main/java/twilightforest/client/model/ModelTFYetiAlpha.java +++ b/src/main/java/twilightforest/client/model/ModelTFYetiAlpha.java @@ -145,8 +145,10 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedBody.rotateAngleX = par5 / (180F / (float)Math.PI); - this.bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; - this.bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + float c = MathHelper.cos(par1 * 0.6662F); + this.bipedRightLeg.rotateAngleX = c * 1.4F * par2; + float c0 = MathHelper.cos(par1 * 0.6662F + (float)Math.PI); + this.bipedLeftLeg.rotateAngleX = c0 * 1.4F * par2; this.bipedRightLeg.rotateAngleY = 0.0F; this.bipedLeftLeg.rotateAngleY = 0.0F; @@ -160,10 +162,12 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; - this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; - this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; - this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + float c1 = MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleZ += c1; + this.bipedLeftArm.rotateAngleZ -= c1; + float s = MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedRightArm.rotateAngleX += s; + this.bipedLeftArm.rotateAngleX -= s; this.bipedBody.rotationPointY = -6F; this.bipedRightLeg.rotationPointY = 4F; @@ -172,8 +176,8 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl if (yeti.isTired()) { // arms down - this.bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F; - this.bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F; + this.bipedRightArm.rotateAngleX = c0 * 2.0F * par2 * 0.5F; + this.bipedLeftArm.rotateAngleX = c * 2.0F * par2 * 0.5F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; @@ -199,8 +203,9 @@ public void setRotationAngles(float par1, float par2, float par3, float par4, fl // this.bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; // this.bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; - this.bipedRightArm.rotateAngleY += MathHelper.cos(par1 * 0.25F) * 0.5F + 0.5F; - this.bipedLeftArm.rotateAngleY -= MathHelper.cos(par1 * 0.25F) * 0.5F + 0.5F; + float c2 = MathHelper.cos(par1 * 0.25F); + this.bipedRightArm.rotateAngleY += c2 * 0.5F + 0.5F; + this.bipedLeftArm.rotateAngleY -= c2 * 0.5F + 0.5F; this.bipedRightArm.rotateAngleX += Math.PI * 1.25; this.bipedLeftArm.rotateAngleX += Math.PI * 1.25; diff --git a/src/main/java/twilightforest/client/particle/EntityTFAnnihilateFX.java b/src/main/java/twilightforest/client/particle/EntityTFAnnihilateFX.java index 8dda255f14..0989d36eae 100644 --- a/src/main/java/twilightforest/client/particle/EntityTFAnnihilateFX.java +++ b/src/main/java/twilightforest/client/particle/EntityTFAnnihilateFX.java @@ -32,7 +32,7 @@ public EntityTFAnnihilateFX(World par1World, double par2, double par4, double pa this.particleScale *= 0.75F; this.particleScale *= par14; this.initialParticleScale = this.particleScale; - this.particleMaxAge = (int)(60.0D / (Math.random() * 0.8D + 0.6D)); + this.particleMaxAge = (int)(60.0F / ((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.8F + 0.6F)); this.particleMaxAge = (int)((float)this.particleMaxAge * par14); this.noClip = false; diff --git a/src/main/java/twilightforest/client/particle/EntityTFFireflyFX.java b/src/main/java/twilightforest/client/particle/EntityTFFireflyFX.java index 2aecb26f68..a8717489e3 100644 --- a/src/main/java/twilightforest/client/particle/EntityTFFireflyFX.java +++ b/src/main/java/twilightforest/client/particle/EntityTFFireflyFX.java @@ -41,7 +41,7 @@ public EntityTFFireflyFX(World world, double d, double d1, double d2, particleScale *= 1.0F; particleScale *= f; fireflyParticleScale = particleScale; - particleMaxAge = (int)(32D / (Math.random() * 0.80000000000000004D + 0.20000000000000001D)); + particleMaxAge = (int)(32F / ((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.80F + 0.20F)); particleMaxAge *= f; fireflyHalfLife = particleMaxAge / 2; noClip = false; diff --git a/src/main/java/twilightforest/client/particle/EntityTFGhastTrapFX.java b/src/main/java/twilightforest/client/particle/EntityTFGhastTrapFX.java index 6b29e7d021..cd0c17b6f8 100644 --- a/src/main/java/twilightforest/client/particle/EntityTFGhastTrapFX.java +++ b/src/main/java/twilightforest/client/particle/EntityTFGhastTrapFX.java @@ -30,17 +30,17 @@ public EntityTFGhastTrapFX(World par1World, double x, double y, double z, float this.originY = y; this.originZ = z; - float f4 = (float)Math.random() * 0.4F;// + 0.6F; - //this.particleRed = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * f4; - this.particleGreen = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * f4; - this.particleBlue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * f4; + float f4 = (float)(new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.4F;// + 0.6F; + //this.particleRed = ((float)((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.20000000298023224D) + 0.8F) * f4; + this.particleGreen = ((float)((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.20000000298023224F) + 0.8F) * f4; + this.particleBlue = ((float)((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.20000000298023224F) + 0.8F) * f4; this.particleRed = 1.0F; this.particleScale *= 0.75F; this.particleScale *= scale; this.reddustParticleScale = this.particleScale; - this.particleMaxAge = (int)(10.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)(10.0F / ((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.8F + 0.2F)); //this.particleMaxAge = (int)((float)this.particleMaxAge * scale); this.noClip = false; diff --git a/src/main/java/twilightforest/client/particle/EntityTFIceBeamFX.java b/src/main/java/twilightforest/client/particle/EntityTFIceBeamFX.java index ea55680c66..2856a1384d 100644 --- a/src/main/java/twilightforest/client/particle/EntityTFIceBeamFX.java +++ b/src/main/java/twilightforest/client/particle/EntityTFIceBeamFX.java @@ -31,7 +31,7 @@ public EntityTFIceBeamFX(World par1World, double par2, double par4, double par6, this.particleScale *= 0.75F; this.particleScale *= par14; this.initialParticleScale = this.particleScale; -// this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D)); +// this.particleMaxAge = (int)(6.0D / ((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.8D + 0.6D)); // this.particleMaxAge = (int)((float)this.particleMaxAge * par14); this.particleMaxAge = 50; this.noClip = false; diff --git a/src/main/java/twilightforest/client/particle/EntityTFLargeFlameFX.java b/src/main/java/twilightforest/client/particle/EntityTFLargeFlameFX.java index 3b26787f28..9b9d30f27e 100644 --- a/src/main/java/twilightforest/client/particle/EntityTFLargeFlameFX.java +++ b/src/main/java/twilightforest/client/particle/EntityTFLargeFlameFX.java @@ -21,7 +21,7 @@ public EntityTFLargeFlameFX(World par1World, double par2, double par4, double pa this.particleScale *= 5.0D; this.flameScale = this.particleScale; this.particleRed = this.particleGreen = this.particleBlue = 1.0F; - this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4; + this.particleMaxAge = (int)(8.0F / ((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.8F + 0.2F)) + 4; //this.noClip = true; this.setParticleTextureIndex(48); } diff --git a/src/main/java/twilightforest/client/particle/EntityTFSnowFX.java b/src/main/java/twilightforest/client/particle/EntityTFSnowFX.java index ba6bfd0faa..100e63f506 100644 --- a/src/main/java/twilightforest/client/particle/EntityTFSnowFX.java +++ b/src/main/java/twilightforest/client/particle/EntityTFSnowFX.java @@ -31,7 +31,7 @@ public EntityTFSnowFX(World par1World, double par2, double par4, double par6, do this.particleScale *= 0.75F; this.particleScale *= par14; this.initialParticleScale = this.particleScale; - this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D)); + this.particleMaxAge = (int)(6.0F / ((new org.bogdang.modifications.random.XSTR()).nextFloat() * 0.8F + 0.6F)); this.particleMaxAge = (int)((float)this.particleMaxAge * par14); this.noClip = false; diff --git a/src/main/java/twilightforest/client/renderer/TFFieryItemRenderer.java b/src/main/java/twilightforest/client/renderer/TFFieryItemRenderer.java index ce48f4169d..774424c0c3 100644 --- a/src/main/java/twilightforest/client/renderer/TFFieryItemRenderer.java +++ b/src/main/java/twilightforest/client/renderer/TFFieryItemRenderer.java @@ -103,8 +103,8 @@ private void renderFieryItemEquipped(IIcon iicon, ItemStack par2ItemStack) { ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F); - if (true) - { + //if (true) + //{ GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); @@ -112,10 +112,10 @@ private void renderFieryItemEquipped(IIcon iicon, ItemStack par2ItemStack) { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); // pulse yellow - float f9 = (float) Math.sin((float)(Minecraft.getSystemTime() % 6000L) / 6000.0F * 2 * 3.14159F) * 0.2F + 0.2F; + float f9_0 = (float) org.bogdang.modifications.math.MathHelperLite.sin((float)(Minecraft.getSystemTime() % 6000L) / 6000.0F * 2 * (float)Math.PI) * 0.2F + 0.2F; - float yellooo = 0.4F; - GL11.glColor4f(yellooo, yellooo, 0.0F, f9); + float yellooo_0 = 0.4F; + GL11.glColor4f(yellooo_0, yellooo_0, 0.0F, f9_0); ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F); @@ -124,7 +124,7 @@ private void renderFieryItemEquipped(IIcon iicon, ItemStack par2ItemStack) { GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); - } + //} if (par2ItemStack.hasEffect(par3)) { diff --git a/src/main/java/twilightforest/client/renderer/TFSkyRenderer.java b/src/main/java/twilightforest/client/renderer/TFSkyRenderer.java index 68697487f7..d9fafe6cb9 100644 --- a/src/main/java/twilightforest/client/renderer/TFSkyRenderer.java +++ b/src/main/java/twilightforest/client/renderer/TFSkyRenderer.java @@ -78,6 +78,7 @@ public TFSkyRenderer() var5.draw(); GL11.glEndList(); + GL11.glPopMatrix(); } @@ -278,7 +279,7 @@ private float getRealCelestialAngle(World world, float partialTicks) { } float var6 = var5; - var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D); + var5 = 1.0F - (((float)Math.cos(var5 * (float)Math.PI) + 1.0F) / 2.0F); var5 = var6 + (var5 - var6) / 3.0F; return var5; } @@ -295,50 +296,124 @@ private Vec3 getTwilightSkyColor(World world) { private void renderStars() { - Random var1 = new Random(10842L); + Random var1 = new org.bogdang.modifications.random.XSTR(10842L); Tessellator var2 = Tessellator.instance; var2.startDrawingQuads(); for (int var3 = 0; var3 < 3000; ++var3) - { - double var4 = (double)(var1.nextFloat() * 2.0F - 1.0F); - double var6 = (double)(var1.nextFloat() * 2.0F - 1.0F); - double var8 = (double)(var1.nextFloat() * 2.0F - 1.0F); - double size = (double)(0.10F + var1.nextFloat() * 0.25F); - double var12 = var4 * var4 + var6 * var6 + var8 * var8; - - if (var12 < 1.0D && var12 > 0.01D) + {//Bogdan-G: dont rewrite temp values + final float var4 = (var1.nextFloat() * 2.0F - 1.0F); + final float var6 = (var1.nextFloat() * 2.0F - 1.0F); + final float var8 = (var1.nextFloat() * 2.0F - 1.0F); + final float size = (0.10F + var1.nextFloat() * 0.25F); + final float var12 = var4 * var4 + var6 * var6 + var8 * var8; + + if (var12 < 1.0F && var12 > 0.01F) { - var12 = 1.0D / Math.sqrt(var12); - var4 *= var12; - var6 *= var12; - var8 *= var12; - double var14 = var4 * 100.0D; - double var16 = var6 * 100.0D; - double var18 = var8 * 100.0D; - double var20 = Math.atan2(var4, var8); - double var22 = Math.sin(var20); - double var24 = Math.cos(var20); - double var26 = Math.atan2(Math.sqrt(var4 * var4 + var8 * var8), var6); - double var28 = Math.sin(var26); - double var30 = Math.cos(var26); - double var32 = var1.nextDouble() * Math.PI * 2.0D; - double var34 = Math.sin(var32); - double var36 = Math.cos(var32); - - for (int var38 = 0; var38 < 4; ++var38) + final float var12d = 1.0F / (float)Math.sqrt(var12); + final float var4d = var4 * var12d; + final float var6d = var6 * var12d; + final float var8d = var8 * var12d; + final float var14 = var4d * 100.0F; + final float var16 = var6d * 100.0F; + final float var18 = var8d * 100.0F; + final float var20 = org.bogdang.modifications.math.TrigMath2.atan2(var4d, var8d); + final float var22 = (float)Math.sin(var20); + final float var24 = (float)Math.cos(var20); + final float var26 = org.bogdang.modifications.math.TrigMath2.atan2((float)Math.sqrt(var4d * var4d + var8d * var8d), var6d); + final float var28 = (float)Math.sin(var26); + final float var30 = (float)Math.cos(var26); + final float var32 = var1.nextFloat() * (float)Math.PI * 2.0F; + final float var34 = (float)Math.sin(var32); + final float var36 = (float)Math.cos(var32); + + //for (int var38 = 0; var38 < 4; ++var38) + //{//Bogdan-G: drop cycle for, calculate the known values + /*final float var41_1a = size * var36; + final float var41_2a = size * var34; + + final float var53 = (var41_2a - var41_1a) * var28; + final float var55 = -((var41_2a - var41_1a) * var30); + final float var57 = var55 * var22 - ((-var41_1a) - var41_2a) * var24; + final float var61 = ((-var41_1a) - var41_2a) * var22 + var55 * var24; + var2.addVertex((double)(var14 + var57), (double)(var16 + var53), (double)(var18 + var61)); + + final float var53a = (-var41_1a) * var28; + final float var55a = var41_1a * var30; + final float var57a = var55a * var22 + var41_2a * var24; + final float var61a = (-var41_2a) * var22 + var55a * var24; + var2.addVertex((double)(var14 + var57a), (double)(var16 + var53a), (double)(var18 + var61a)); + + final float var47 = var41_1a - var41_2a; + final float var49 = var41_1a + var41_2a; + final float var53b = var47 * var28; + final float var55b = -(var47 * var30); + final float var57b = var55b * var22 - var49 * var24; + final float var61b = var49 * var22 + var55b * var24; + var2.addVertex((double)(var14 + var57b), (double)(var16 + var53b), (double)(var18 + var61b)); + + final float var47a = var41_1a - (2f) * var41_2a; + final float var49a = (2f) * var41_1a + var41_2a; + final float var53c = var47a * var28; + final float var55c = -(var47a * var30); + final float var57c = var55c * var22 - var49a * var24; + final float var61c = var49a * var22 + var55c * var24; + var2.addVertex((double)(var14 + var57c), (double)(var16 + var53c), (double)(var18 + var61c));*/ + /*for (int var38 = 0; var38 < 4; ++var38) { - double var39 = 0.0D; - double var41 = (double)((var38 & 2) - 1) * size; - double var43 = (double)((var38 + 1 & 2) - 1) * size; - double var47 = var41 * var36 - var43 * var34; - double var49 = var43 * var36 + var41 * var34; - double var53 = var47 * var28 + var39 * var30; - double var55 = var39 * var28 - var47 * var30; - double var57 = var55 * var22 - var49 * var24; - double var61 = var49 * var22 + var55 * var24; - var2.addVertex(var14 + var57, var16 + var53, var18 + var61); - } + float var39 = 0.0f; + float var41 = ((var38 & 2) - 1) * size; + float var43 = ((var38 + 1 & 2) - 1) * size; + float var47 = var41 * var36 - var43 * var34; + float var49 = var43 * var36 + var41 * var34; + float var53 = var47 * var28 + var39 * var30; + float var55 = var39 * var28 - var47 * var30; + float var57 = var55 * var22 - var49 * var24; + float var61 = var49 * var22 + var55 * var24; + var2.addVertex((double)(var14 + var57), (double)(var16 + var53), (double)(var18 + var61)); + }*/ + final float var39 = 0.0f; + final float var41 = ((0 & 2) - 1) * size; + final float var43 = ((0 + 1 & 2) - 1) * size; + final float var47 = var41 * var36 - var43 * var34; + final float var49 = var43 * var36 + var41 * var34; + final float var53 = var47 * var28 + var39 * var30; + final float var55 = var39 * var28 - var47 * var30; + final float var57 = var55 * var22 - var49 * var24; + final float var61 = var49 * var22 + var55 * var24; + var2.addVertex((double)(var14 + var57), (double)(var16 + var53), (double)(var18 + var61)); + final float var39a = 0.0f; + final float var41a = ((1 & 2) - 1) * size; + final float var43a = ((1 + 1 & 2) - 1) * size; + final float var47a = var41a * var36 - var43a * var34; + final float var49a = var43a * var36 + var41a * var34; + final float var53a = var47a * var28 + var39a * var30; + final float var55a = var39a * var28 - var47a * var30; + final float var57a = var55a * var22 - var49a * var24; + final float var61a = var49a * var22 + var55a * var24; + var2.addVertex((double)(var14 + var57a), (double)(var16 + var53a), (double)(var18 + var61a)); + final float var39b = 0.0f; + final float var41b = ((2 & 2) - 1) * size; + final float var43b = ((2 + 1 & 2) - 1) * size; + final float var47b = var41b * var36 - var43b * var34; + final float var49b = var43b * var36 + var41b * var34; + final float var53b = var47b * var28 + var39b * var30; + final float var55b = var39b * var28 - var47b * var30; + final float var57b = var55b * var22 - var49b * var24; + final float var61b = var49b * var22 + var55b * var24; + var2.addVertex((double)(var14 + var57b), (double)(var16 + var53b), (double)(var18 + var61b)); + final float var39c = 0.0f; + final float var41c = ((3 & 2) - 1) * size; + final float var43c = ((3 + 1 & 2) - 1) * size; + final float var47c = var41c * var36 - var43c * var34; + final float var49c = var43c * var36 + var41c * var34; + final float var53c = var47c * var28 + var39c * var30; + final float var55c = var39c * var28 - var47c * var30; + final float var57c = var55c * var22 - var49c * var24; + final float var61c = var49c * var22 + var55c * var24; + var2.addVertex((double)(var14 + var57c), (double)(var16 + var53c), (double)(var18 + var61c)); + //} + } } diff --git a/src/main/java/twilightforest/client/renderer/TFWeatherRenderer.java b/src/main/java/twilightforest/client/renderer/TFWeatherRenderer.java index d9793dc304..4ca8be654b 100644 --- a/src/main/java/twilightforest/client/renderer/TFWeatherRenderer.java +++ b/src/main/java/twilightforest/client/renderer/TFWeatherRenderer.java @@ -54,7 +54,7 @@ public class TFWeatherRenderer extends IRenderHandler { public TFWeatherRenderer() { - this.random = new Random(); + this.random = new org.bogdang.modifications.random.XSTR(); } @@ -565,7 +565,7 @@ private void renderLockedStructure(float partialTicks, WorldClient world, Minecr { this.random.setSeed((long)(dx * dx * 3121 + dx * 45238971 ^ dz * dz * 418711 + dz * 13761)); - if (true) { + //if (true) { if (drawFlag != 0) { @@ -596,7 +596,7 @@ private void renderLockedStructure(float partialTicks, WorldClient world, Minecr tessellator.addVertexWithUV((double)((float)dx - rainX) + 0.5D, (double)rainMax, (double)((float)dz - rainZ) + 0.5D, (double)(0.0F * one + uFactor), (double)((float)rainMax * one / 4.0F + countFactor * one + vFactor)); tessellator.setTranslation(0.0D, 0.0D, 0.0D); - } + //} } } diff --git a/src/main/java/twilightforest/client/renderer/TileEntityTFTrophyRenderer.java b/src/main/java/twilightforest/client/renderer/TileEntityTFTrophyRenderer.java index c0d6cc1206..8c67a864e2 100644 --- a/src/main/java/twilightforest/client/renderer/TileEntityTFTrophyRenderer.java +++ b/src/main/java/twilightforest/client/renderer/TileEntityTFTrophyRenderer.java @@ -188,7 +188,7 @@ private void renderUrGhastHead(TileEntityTFTrophy trophy, float rotation, boolea GL11.glRotatef(rotation, 0F, 1F, 0F); GL11.glRotatef(180F, 0F, 1F, 0F); - GL11.glTranslatef(0, onGround ? 1F : 1F, onGround ? 0F : 0F); + GL11.glTranslatef(0, 1F, 0F);//GL11.glTranslatef(0, onGround ? 1F : 1F, onGround ? 0F : 0F); // render the naga head urGhastModel.render((Entity)null, 0.0F, 0, trophy.ticksExisted + partialTime, 0, 0.0F, 0.0625F); diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFCastleMagic.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFCastleMagic.java index 554131dcde..38c8d473d3 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFCastleMagic.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFCastleMagic.java @@ -27,6 +27,7 @@ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderB } public static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, int meta) { + GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); @@ -37,6 +38,7 @@ public static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, in GL11.glTranslatef(0.5F, 0.5F, 0.5F); par1Block.setBlockBoundsForItemRender(); + GL11.glPopMatrix(); } protected static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, int meta, Tessellator tessellator) { @@ -120,6 +122,7 @@ protected static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + GL11.glPushMatrix(); renderer.clearOverrideBlockTexture(); renderer.setRenderBounds(0, 0, 0, 1, 1, 1); renderer.renderStandardBlock(block, x, y, z); @@ -134,9 +137,9 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b // if the block is a door or other clickable block(?), pulse the glyph a little - if (block == TFBlocks.castleDoor) { + /*if (block == TFBlocks.castleDoor) { - } + }*/ Tessellator tessellator = Tessellator.instance; @@ -166,6 +169,7 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b } renderer.clearOverrideBlockTexture(); + GL11.glPopMatrix(); return true; } diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFFireflyJar.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFFireflyJar.java index 0b381909ac..f2453000ec 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFFireflyJar.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFFireflyJar.java @@ -43,6 +43,7 @@ public int getRenderId() { * Look, this is no longer in the Block class! I'm an object oriented genius! */ public static boolean renderJar(RenderBlocks renderblocks, IBlockAccess world, int x, int y, int z, Block block) { + GL11.glPushMatrix(); renderblocks.clearOverrideBlockTexture(); renderblocks.setRenderBounds(0.1875F, 0.0F, 0.1875F, 0.8125F, 0.875F, 0.8125F); renderblocks.renderStandardBlock(block, x, y, z); @@ -53,10 +54,12 @@ public static boolean renderJar(RenderBlocks renderblocks, IBlockAccess world, i renderblocks.clearOverrideBlockTexture(); block.setBlockBoundsForItemRender(); + GL11.glPopMatrix(); return true; } public static void renderInvJar(RenderBlocks renderblocks, Block par1Block, int meta) { + GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); @@ -127,6 +130,7 @@ public static void renderInvJar(RenderBlocks renderblocks, Block par1Block, int GL11.glTranslatef(0.5F, 0.5F, 0.5F); par1Block.setBlockBoundsForItemRender(); + GL11.glPopMatrix(); } diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFHugeLilyPad.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFHugeLilyPad.java index e281a04f52..8573a59b02 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFHugeLilyPad.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFHugeLilyPad.java @@ -26,10 +26,12 @@ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderB public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { // rotate the sides int meta = world.getBlockMetadata(x, y, z); + GL11.glPushMatrix(); setRenderRotate(renderer, meta); boolean didRender = renderer.renderStandardBlock(block, x, y, z); restoreRendererRotate(renderer); + GL11.glPopMatrix(); return didRender; diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFKnightMetal.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFKnightMetal.java index a495e6433e..aa302a4a33 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFKnightMetal.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFKnightMetal.java @@ -45,6 +45,7 @@ public static boolean renderSpikeBlock(RenderBlocks renderblocks, IBlockAccess w float p = 1F / 16F; float a = 1F / 1024F; float p4 = 4F / 16F - a; + GL11.glPushMatrix(); for (int rx = 0; rx < 3; rx++) { for (int ry = 0; ry < 3; ry++) { @@ -61,10 +62,12 @@ public static boolean renderSpikeBlock(RenderBlocks renderblocks, IBlockAccess w block.setBlockBoundsForItemRender(); + GL11.glPopMatrix(); return true; } public static void renderInvJar(RenderBlocks renderblocks, Block par1Block, int meta) { + GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); @@ -93,9 +96,11 @@ public static void renderInvJar(RenderBlocks renderblocks, Block par1Block, int GL11.glTranslatef(0.5F, 0.5F, 0.5F); par1Block.setBlockBoundsForItemRender(); + GL11.glPopMatrix(); } protected static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, int meta, Tessellator tessellator) { + GL11.glPushMatrix(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderblocks.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, par1Block.getIcon(0, meta)); @@ -120,6 +125,7 @@ protected static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, tessellator.setNormal(1.0F, 0.0F, 0.0F); renderblocks.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, par1Block.getIcon(5, meta)); tessellator.draw(); + GL11.glPopMatrix(); } diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFMagicLeaves.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFMagicLeaves.java index 40a8eec9f7..ee1e56b7eb 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFMagicLeaves.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFMagicLeaves.java @@ -19,19 +19,23 @@ public RenderBlockTFMagicLeaves(int myRenderID) { @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); setRenderRotate(renderer, metadata); renderInvNormalBlock(renderer, block, metadata); restoreRendererRotate(renderer); + GL11.glPopMatrix(); } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + GL11.glPushMatrix(); // rotate the sides int meta = world.getBlockMetadata(x, y, z); setRenderRotate(renderer, meta, x, y, z); boolean didRender = renderer.renderStandardBlock(block, x, y, z); restoreRendererRotate(renderer); + GL11.glPopMatrix(); return didRender; diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFNagastone.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFNagastone.java index 62ca291ea5..4056f4b7ef 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFNagastone.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFNagastone.java @@ -19,19 +19,23 @@ public RenderBlockTFNagastone(int nagastoneRenderID) { @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + GL11.glPushMatrix(); setRenderRotate(renderer, metadata); renderInvNormalBlock(renderer, block, metadata); restoreRendererRotate(renderer); + GL11.glPopMatrix(); } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + GL11.glPushMatrix(); // rotate the sides int meta = world.getBlockMetadata(x, y, z); setRenderRotate(renderer, meta); boolean didRender = renderer.renderStandardBlock(block, x, y, z); restoreRendererRotate(renderer); + GL11.glPopMatrix(); return didRender; diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFPedestal.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFPedestal.java index 181cc27b80..085e30536e 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFPedestal.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFPedestal.java @@ -42,6 +42,7 @@ public int getRenderId() { * Look, this is no longer in the Block class! I'm an object oriented genius! */ public static boolean renderPedestal(RenderBlocks renderblocks, IBlockAccess world, int x, int y, int z, Block block) { + GL11.glPushMatrix(); // top renderblocks.setRenderBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.1875F, 0.9375F); renderblocks.renderStandardBlock(block, x, y, z); @@ -55,10 +56,12 @@ public static boolean renderPedestal(RenderBlocks renderblocks, IBlockAccess wor renderblocks.renderStandardBlock(block, x, y, z); block.setBlockBoundsForItemRender(); + GL11.glPopMatrix(); return true; } public static void renderInvJar(RenderBlocks renderblocks, Block par1Block, int meta) { + GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); @@ -79,6 +82,7 @@ public static void renderInvJar(RenderBlocks renderblocks, Block par1Block, int GL11.glTranslatef(0.5F, 0.5F, 0.5F); par1Block.setBlockBoundsForItemRender(); + GL11.glPopMatrix(); } protected static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, int meta, Tessellator tessellator) { diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFPlants.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFPlants.java index 0bdcc320fa..6b01d76116 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFPlants.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFPlants.java @@ -6,6 +6,8 @@ import twilightforest.block.BlockTFPlant; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import org.lwjgl.opengl.GL11; + public class RenderBlockTFPlants implements ISimpleBlockRenderingHandler { final int renderID; @@ -22,6 +24,7 @@ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderB @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + GL11.glPushMatrix(); int meta = world.getBlockMetadata(x, y, z); if (meta == BlockTFPlant.META_MOSSPATCH) { renderMossPatch(x, y, z, block, renderer); @@ -41,6 +44,7 @@ else if (meta == BlockTFPlant.META_ROOT_STRAND) { { renderer.renderCrossedSquares(block, x, y, z); } + GL11.glPopMatrix(); return true; } diff --git a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFThorns.java b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFThorns.java index 406687e87e..60d762aead 100644 --- a/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFThorns.java +++ b/src/main/java/twilightforest/client/renderer/blocks/RenderBlockTFThorns.java @@ -27,6 +27,7 @@ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderB @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + GL11.glPushMatrix(); int l = block.colorMultiplier(world, x, y, z); float f = (float)(l >> 16 & 255) / 255.0F; float f1 = (float)(l >> 8 & 255) / 255.0F; @@ -38,10 +39,13 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b switch (type) { case 0: default: + GL11.glPopMatrix(); return this.renderCactusLikeY(block, x, y, z, f, f1, f2, metadata, world, renderer); case 4: + GL11.glPopMatrix(); return this.renderCactusLikeX(block, x, y, z, f, f1, f2, metadata, world, renderer); case 8: + GL11.glPopMatrix(); return this.renderCactusLikeZ(block, x, y, z, f, f1, f2, metadata, world, renderer); } @@ -378,6 +382,7 @@ private IIcon getSideIcon(Block block, int metadata) { } public static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, int meta) { + GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); @@ -398,6 +403,7 @@ public static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, in GL11.glTranslatef(0.5F, 0.5F, 0.5F); par1Block.setBlockBoundsForItemRender(); + GL11.glPopMatrix(); } protected static void renderInvBlock(RenderBlocks renderblocks, Block par1Block, int meta, Tessellator tessellator) { diff --git a/src/main/java/twilightforest/entity/EntitySeekerArrow.java b/src/main/java/twilightforest/entity/EntitySeekerArrow.java index 3f3432942d..717915c875 100644 --- a/src/main/java/twilightforest/entity/EntitySeekerArrow.java +++ b/src/main/java/twilightforest/entity/EntitySeekerArrow.java @@ -69,7 +69,7 @@ public void onUpdate() if (thing instanceof EntityLivingBase && !(thing instanceof EntityPlayer)) { EntityLivingBase living = (EntityLivingBase)thing; - System.out.println("Possible target : " + living); + cpw.mods.fml.common.FMLLog.info("Possible target : " + living); //System.out.println("Selection box = " + targetBB); courseVec = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ); @@ -88,10 +88,10 @@ public void onUpdate() } } } - if (targets.size() > 0) { + /*if (targets.size() > 0) { //System.out.println("--- End of list"); //System.out.println("We have chosen " + this.homingTarget + " as the target"); - } + }*/ } else { // find ideal heading Vec3 targetVec = Vec3.createVectorHelper(this.posX - this.homingTarget.posX, this.posY - (this.homingTarget.posY + this.homingTarget.getEyeHeight()), this.posZ - this.homingTarget.posZ); diff --git a/src/main/java/twilightforest/entity/EntityTFAdherent.java b/src/main/java/twilightforest/entity/EntityTFAdherent.java index 38d89a4588..5143ba6776 100644 --- a/src/main/java/twilightforest/entity/EntityTFAdherent.java +++ b/src/main/java/twilightforest/entity/EntityTFAdherent.java @@ -1,6 +1,7 @@ package twilightforest.entity; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.SharedMonsterAttributes; @@ -46,7 +47,7 @@ public EntityTFAdherent(World world) { protected void entityInit() { super.entityInit(); - dataWatcher.addObject(CHARGE_FLAG, Byte.valueOf((byte)0)); + dataWatcher.addObject(CHARGE_FLAG, (byte)0); } /** @@ -65,8 +66,9 @@ public boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } @@ -76,7 +78,7 @@ protected void applyEntityAttributes() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } @@ -113,11 +115,11 @@ public void setCharging(boolean flag) { if (flag) { - dataWatcher.updateObject(CHARGE_FLAG, Byte.valueOf((byte)127)); + dataWatcher.updateObject(CHARGE_FLAG, ((byte)127)); } else { - dataWatcher.updateObject(CHARGE_FLAG, Byte.valueOf((byte)0)); + dataWatcher.updateObject(CHARGE_FLAG, (byte)0); } } diff --git a/src/main/java/twilightforest/entity/EntityTFBlockGoblin.java b/src/main/java/twilightforest/entity/EntityTFBlockGoblin.java index 468d133c99..8b26e87b85 100644 --- a/src/main/java/twilightforest/entity/EntityTFBlockGoblin.java +++ b/src/main/java/twilightforest/entity/EntityTFBlockGoblin.java @@ -76,8 +76,8 @@ public EntityTFBlockGoblin(World world) protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(DATA_CHAINLENGTH, Byte.valueOf((byte) 0)); - this.dataWatcher.addObject(DATA_CHAINPOS, Byte.valueOf((byte) 0)); + this.dataWatcher.addObject(DATA_CHAINLENGTH, ((byte) 0)); + this.dataWatcher.addObject(DATA_CHAINPOS, ((byte) 0)); } /** @@ -96,9 +96,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(8.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(8.0D*1.5D); // attack damage } @@ -135,7 +135,7 @@ protected Item getDropItemId() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } @@ -161,8 +161,8 @@ public Vec3 getChainPosition() */ public Vec3 getChainPosition(float angle, float distance) { - double var1 = Math.cos((angle) * Math.PI / 180.0D) * distance; - double var3 = Math.sin((angle) * Math.PI / 180.0D) * distance; + double var1 = org.bogdang.modifications.math.MathHelperLite.cos((angle) * Math.PI / 180.0D) * distance; + double var3 = org.bogdang.modifications.math.MathHelperLite.sin((angle) * Math.PI / 180.0D) * distance; return Vec3.createVectorHelper(this.posX + var1, this.posY + this.getChainYOffset(), this.posZ + var3); } @@ -210,8 +210,8 @@ public void onUpdate() { if (!this.worldObj.isRemote) { - this.dataWatcher.updateObject(DATA_CHAINLENGTH, Byte.valueOf((byte) Math.floor(getChainLength() * 127F))); - this.dataWatcher.updateObject(DATA_CHAINPOS, Byte.valueOf((byte) Math.floor(getChainAngle() / 360F * 255F))); + this.dataWatcher.updateObject(DATA_CHAINLENGTH, ((byte) Math.floor(getChainLength() * 127F))); + this.dataWatcher.updateObject(DATA_CHAINPOS, ((byte) Math.floor(getChainAngle() / 360F * 255F))); } else { diff --git a/src/main/java/twilightforest/entity/EntityTFBoggard.java b/src/main/java/twilightforest/entity/EntityTFBoggard.java index 3df2edb9a8..27453823eb 100644 --- a/src/main/java/twilightforest/entity/EntityTFBoggard.java +++ b/src/main/java/twilightforest/entity/EntityTFBoggard.java @@ -72,9 +72,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(14.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(14.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(7)-twilightforest.TwilightForestMod.Scatter.nextInt(7)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D*1.5D); // attack damage } @Override @@ -161,9 +161,9 @@ public boolean isShy() { */ public boolean isTargetLookingAtMe() { // find angle of approach - double dx = posX - entityToAttack.posX; - double dz = posZ - entityToAttack.posZ; - float angle = (float)((Math.atan2(dz, dx) * 180D) / 3.1415927410125732D) - 90F; + float dx = (float)(posX - entityToAttack.posX); + float dz = (float)(posZ - entityToAttack.posZ); + float angle = ((org.bogdang.modifications.math.TrigMath2.atan2(dz, dx) * 180F) / (float)Math.PI) - 90F; float difference = MathHelper.abs((entityToAttack.rotationYaw - angle) % 360); @@ -191,7 +191,7 @@ public boolean isTargetLookingAtMe() { @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); // are we in a level 1 hill? int chunkX = MathHelper.floor_double(posX) >> 4; diff --git a/src/main/java/twilightforest/entity/EntityTFChainBlock.java b/src/main/java/twilightforest/entity/EntityTFChainBlock.java index 869227c301..404e4ac62d 100644 --- a/src/main/java/twilightforest/entity/EntityTFChainBlock.java +++ b/src/main/java/twilightforest/entity/EntityTFChainBlock.java @@ -102,7 +102,7 @@ protected float getGravityVelocity() protected void onImpact(MovingObjectPosition mop) { // only hit living things if (mop.entityHit != null && mop.entityHit instanceof EntityLivingBase && mop.entityHit != this.getThrower()) { - if (mop.entityHit.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) this.getThrower()), 10)) { + if (mop.entityHit.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) this.getThrower()), 10*1.5f)) { // age when we hit a monster so that we go back to the player faster this.ticksExisted += 60; } diff --git a/src/main/java/twilightforest/entity/EntityTFCharmEffect.java b/src/main/java/twilightforest/entity/EntityTFCharmEffect.java index edc2fb9162..4b9db15220 100644 --- a/src/main/java/twilightforest/entity/EntityTFCharmEffect.java +++ b/src/main/java/twilightforest/entity/EntityTFCharmEffect.java @@ -93,7 +93,7 @@ public void onUpdate() Vec3 look = Vec3.createVectorHelper(DISTANCE, 0, 0); look.rotateAroundY(rotation); this.posX += look.xCoord; -// this.posY += Math.sin(this.ticksExisted / 3.0F + offset); +// this.posY += org.bogdang.modifications.math.MathHelperLite.sin(this.ticksExisted / 3.0F + offset); this.posZ += look.zCoord; this.setPosition(this.posX, this.posY, this.posZ); @@ -103,9 +103,9 @@ public void onUpdate() if (this.getItemID() > 0) { for (int i = 0; i < 3; i++) { - double dx = posX + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dy = posY + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dz = posZ + 0.5 * (rand.nextDouble() - rand.nextDouble()); + double dx = posX + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dy = posY + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dz = posZ + 0.5 * (rand.nextFloat() - rand.nextFloat()); worldObj.spawnParticle("iconcrack_" + this.getItemID(), dx, dy, dz, 0, 0.2, 0); } @@ -135,7 +135,7 @@ public void setPositionAndRotation2(double par1, double par3, double par5, float protected void entityInit() { - this.dataWatcher.addObject(DATA_ITEMID, Integer.valueOf(0)); + this.dataWatcher.addObject(DATA_ITEMID, (int)0); this.dataWatcher.addObject(DATA_OWNER, ""); } diff --git a/src/main/java/twilightforest/entity/EntityTFCubeOfAnnihilation.java b/src/main/java/twilightforest/entity/EntityTFCubeOfAnnihilation.java index 74f5d318b6..a0368e3235 100644 --- a/src/main/java/twilightforest/entity/EntityTFCubeOfAnnihilation.java +++ b/src/main/java/twilightforest/entity/EntityTFCubeOfAnnihilation.java @@ -73,7 +73,7 @@ protected void onImpact(MovingObjectPosition mop) { // only hit living things if (mop.entityHit != null && mop.entityHit instanceof EntityLivingBase) { - if (mop.entityHit.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) this.getThrower()), 10)) + if (mop.entityHit.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) this.getThrower()), 10*1.5f)) { this.ticksExisted += 60; } diff --git a/src/main/java/twilightforest/entity/EntityTFDeathTome.java b/src/main/java/twilightforest/entity/EntityTFDeathTome.java index ca9063cc2e..e9abba8bdb 100644 --- a/src/main/java/twilightforest/entity/EntityTFDeathTome.java +++ b/src/main/java/twilightforest/entity/EntityTFDeathTome.java @@ -15,6 +15,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.entity.ai.EntityAITFMagicAttack; import twilightforest.item.TFItems; @@ -58,8 +59,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(15)-twilightforest.TwilightForestMod.Scatter.nextInt(15)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } @Override @@ -68,7 +70,7 @@ public void onLivingUpdate() { for (int i = 0; i < 1; ++i) { - this.worldObj.spawnParticle("enchantmenttable", this.posX + (this.rand.nextDouble() - 0.5D) * this.width, this.posY + this.rand.nextDouble() * (this.height - 0.75D) + 0.5D, this.posZ + (this.rand.nextDouble() - 0.5D) * this.width, + this.worldObj.spawnParticle("enchantmenttable", this.posX + (this.rand.nextFloat() - 0.5D) * this.width, this.posY + this.rand.nextFloat() * (this.height - 0.75D) + 0.5D, this.posZ + (this.rand.nextFloat() - 0.5D) * this.width, 0, 0.5, 0); } } @@ -145,7 +147,7 @@ protected void dropRareDrop(int par1) @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFFireBeetle.java b/src/main/java/twilightforest/entity/EntityTFFireBeetle.java index 97d9550ceb..72716a28c5 100644 --- a/src/main/java/twilightforest/entity/EntityTFFireBeetle.java +++ b/src/main/java/twilightforest/entity/EntityTFFireBeetle.java @@ -17,6 +17,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.entity.ai.EntityAITFBreathAttack; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,8 +26,8 @@ public class EntityTFFireBeetle extends EntityMob implements IBreathAttacker { - public static final int BREATH_DURATION = 10; - public static final int BREATH_DAMAGE = 2; + public static final int BREATH_DURATION = (int)(10*1.5); + public static final int BREATH_DAMAGE = (int)(2*1.5); public EntityTFFireBeetle(World world) @@ -57,7 +58,7 @@ public EntityTFFireBeetle(World world, double x, double y, double z) protected void entityInit() { super.entityInit(); - dataWatcher.addObject(17, Byte.valueOf((byte)0)); + dataWatcher.addObject(17, (byte)0); } /** @@ -76,9 +77,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(12)-twilightforest.TwilightForestMod.Scatter.nextInt(12)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D*1.5D); // attack damage } @@ -143,11 +144,11 @@ public void setBreathing(boolean flag) { if (flag) { - dataWatcher.updateObject(17, Byte.valueOf((byte)127)); + dataWatcher.updateObject(17, ((byte)127)); } else { - dataWatcher.updateObject(17, Byte.valueOf((byte)0)); + dataWatcher.updateObject(17, (byte)0); } } @@ -177,8 +178,8 @@ public void onLivingUpdate() double dy = look.yCoord; double dz = look.zCoord; - double spread = 5 + this.getRNG().nextDouble() * 2.5; - double velocity = 0.15 + this.getRNG().nextDouble() * 0.15; + double spread = 5 + this.getRNG().nextFloat() * 2.5; + double velocity = 0.15 + this.getRNG().nextFloat() * 0.15; // spread flame dx += this.getRNG().nextGaussian() * 0.007499999832361937D * spread; @@ -223,7 +224,7 @@ public int getBrightnessForRender(float par1) { @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFGiantMiner.java b/src/main/java/twilightforest/entity/EntityTFGiantMiner.java index 3830bb0e6b..989c58bdb2 100644 --- a/src/main/java/twilightforest/entity/EntityTFGiantMiner.java +++ b/src/main/java/twilightforest/entity/EntityTFGiantMiner.java @@ -42,10 +42,10 @@ public EntityTFGiantMiner(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(80.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(80.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(40)-twilightforest.TwilightForestMod.Scatter.nextInt(40)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10.0D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D*1.5D); } diff --git a/src/main/java/twilightforest/entity/EntityTFGoblinKnightLower.java b/src/main/java/twilightforest/entity/EntityTFGoblinKnightLower.java index 7909910866..267ed738e2 100644 --- a/src/main/java/twilightforest/entity/EntityTFGoblinKnightLower.java +++ b/src/main/java/twilightforest/entity/EntityTFGoblinKnightLower.java @@ -53,9 +53,9 @@ public EntityTFGoblinKnightLower(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D*1.5D); // attack damage } /** @@ -71,7 +71,7 @@ protected boolean isAIEnabled() protected void entityInit() { super.entityInit(); - dataWatcher.addObject(DATA_EQUIP, Byte.valueOf((byte)0)); + dataWatcher.addObject(DATA_EQUIP, (byte)0); } public boolean hasArmor() @@ -86,11 +86,11 @@ public void setHasArmor(boolean flag) if (flag) { - dataWatcher.updateObject(DATA_EQUIP, Byte.valueOf((byte) (otherFlags | 1))); + dataWatcher.updateObject(DATA_EQUIP, ((byte) (otherFlags | 1))); } else { - dataWatcher.updateObject(DATA_EQUIP, Byte.valueOf((byte)otherFlags)); + dataWatcher.updateObject(DATA_EQUIP, ((byte)otherFlags)); } } @@ -209,9 +209,9 @@ public boolean attackEntityFrom(DamageSource par1DamageSource, float damageAmoun { // determine angle - double dx = this.posX - attacker.posX; - double dz = this.posZ - attacker.posZ; - float angle = (float)((Math.atan2(dz, dx) * 180D) / Math.PI) - 90F; + float dx = (float)(this.posX - attacker.posX); + float dz = (float)(this.posZ - attacker.posZ); + float angle = ((org.bogdang.modifications.math.TrigMath2.atan2(dz, dx) * 180F) / (float)Math.PI) - 90F; float difference = MathHelper.abs((this.renderYawOffset - angle) % 360); diff --git a/src/main/java/twilightforest/entity/EntityTFGoblinKnightUpper.java b/src/main/java/twilightforest/entity/EntityTFGoblinKnightUpper.java index 29261bb0eb..1eefa1bc62 100644 --- a/src/main/java/twilightforest/entity/EntityTFGoblinKnightUpper.java +++ b/src/main/java/twilightforest/entity/EntityTFGoblinKnightUpper.java @@ -30,7 +30,7 @@ public class EntityTFGoblinKnightUpper extends EntityMob { - private static final int SHIELD_DAMAGE_THRESHOLD = 10; + private static final int SHIELD_DAMAGE_THRESHOLD = (int)(10*1.5); private static final int DATA_EQUIP = 17; @@ -81,16 +81,16 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D*1.5D); // attack damage } @Override protected void entityInit() { super.entityInit(); - dataWatcher.addObject(DATA_EQUIP, Byte.valueOf((byte)0)); + dataWatcher.addObject(DATA_EQUIP, (byte)0); } public boolean hasArmor() @@ -105,11 +105,11 @@ public void setHasArmor(boolean flag) if (flag) { - dataWatcher.updateObject(DATA_EQUIP, Byte.valueOf((byte) (otherFlags | 1))); + dataWatcher.updateObject(DATA_EQUIP, ((byte) (otherFlags | 1))); } else { - dataWatcher.updateObject(DATA_EQUIP, Byte.valueOf((byte)otherFlags)); + dataWatcher.updateObject(DATA_EQUIP, ((byte)otherFlags)); } } @@ -125,11 +125,11 @@ public void setHasShield(boolean flag) if (flag) { - dataWatcher.updateObject(DATA_EQUIP, Byte.valueOf((byte) (otherFlags | 2))); + dataWatcher.updateObject(DATA_EQUIP, ((byte) (otherFlags | 2))); } else { - dataWatcher.updateObject(DATA_EQUIP, Byte.valueOf((byte)otherFlags)); + dataWatcher.updateObject(DATA_EQUIP, ((byte)otherFlags)); } } @@ -340,9 +340,9 @@ public boolean attackEntityFrom(DamageSource par1DamageSource, float damageAmoun { // determine angle - double dx = this.posX - attacker.posX; - double dz = this.posZ - attacker.posZ; - float angle = (float)((Math.atan2(dz, dx) * 180D) / Math.PI) - 90F; + float dx = (float)(this.posX - attacker.posX); + float dz = (float)(this.posZ - attacker.posZ); + float angle = ((org.bogdang.modifications.math.TrigMath2.atan2(dz, dx) * 180F) / (float)Math.PI) - 90F; float difference = MathHelper.abs((this.renderYawOffset - angle) % 360); @@ -429,9 +429,9 @@ public boolean takeHitOnShield(DamageSource par1DamageSource, float damageAmount double d0 = par1DamageSource.getEntity().posX - this.posX; double d1; - for (d1 = par1DamageSource.getEntity().posZ - this.posZ; d0 * d0 + d1 * d1 < 1.0E-4D; d1 = (Math.random() - Math.random()) * 0.01D) + for (d1 = par1DamageSource.getEntity().posZ - this.posZ; d0 * d0 + d1 * d1 < 1.0E-4D; d1 = ((new org.bogdang.modifications.random.XSTR()).nextFloat() - (new org.bogdang.modifications.random.XSTR()).nextFloat()) * 0.01D) { - d0 = (Math.random() - Math.random()) * 0.01D; + d0 = ((new org.bogdang.modifications.random.XSTR()).nextFloat() - (new org.bogdang.modifications.random.XSTR()).nextFloat()) * 0.01D; } toKnockback.knockBack(par1DamageSource.getEntity(), 0, d0 / 4D, d1 / 4D); diff --git a/src/main/java/twilightforest/entity/EntityTFHarbingerCube.java b/src/main/java/twilightforest/entity/EntityTFHarbingerCube.java index bc8372ff2d..a99b80b7d9 100644 --- a/src/main/java/twilightforest/entity/EntityTFHarbingerCube.java +++ b/src/main/java/twilightforest/entity/EntityTFHarbingerCube.java @@ -34,8 +34,9 @@ public EntityTFHarbingerCube(World world) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(20)-twilightforest.TwilightForestMod.Scatter.nextInt(20)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } diff --git a/src/main/java/twilightforest/entity/EntityTFHedgeSpider.java b/src/main/java/twilightforest/entity/EntityTFHedgeSpider.java index cf657b843a..9b3d3d8e61 100644 --- a/src/main/java/twilightforest/entity/EntityTFHedgeSpider.java +++ b/src/main/java/twilightforest/entity/EntityTFHedgeSpider.java @@ -1,12 +1,14 @@ package twilightforest.entity; import net.minecraft.entity.Entity; +import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.TFFeature; @@ -28,6 +30,13 @@ public EntityTFHedgeSpider(World world, double x, double y, double z) this(world); this.setPosition(x, y, z); } + + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(8)-twilightforest.TwilightForestMod.Scatter.nextInt(8)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.800000011920929D*1.5); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); + } /** * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking @@ -66,7 +75,7 @@ protected boolean isValidLightLevel() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); // are in a hedge maze? int chunkX = MathHelper.floor_double(posX) >> 4; diff --git a/src/main/java/twilightforest/entity/EntityTFHelmetCrab.java b/src/main/java/twilightforest/entity/EntityTFHelmetCrab.java index d16e09440b..8dc19ced86 100644 --- a/src/main/java/twilightforest/entity/EntityTFHelmetCrab.java +++ b/src/main/java/twilightforest/entity/EntityTFHelmetCrab.java @@ -18,6 +18,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.item.TFItems; @@ -70,9 +71,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(13.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(13.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(6)-twilightforest.TwilightForestMod.Scatter.nextInt(6)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D*1.5D); // attack damage } @@ -133,7 +134,7 @@ protected void dropFewItems(boolean flag, int i) @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFHostileWolf.java b/src/main/java/twilightforest/entity/EntityTFHostileWolf.java index d2112480d0..e266eda48d 100644 --- a/src/main/java/twilightforest/entity/EntityTFHostileWolf.java +++ b/src/main/java/twilightforest/entity/EntityTFHostileWolf.java @@ -12,6 +12,7 @@ import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.TFFeature; @@ -38,7 +39,10 @@ public EntityTFHostileWolf(World world, double x, double y, double z) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D*2.5D+twilightforest.TwilightForestMod.Scatter.nextInt(5)-twilightforest.TwilightForestMod.Scatter.nextInt(5)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D*1.5); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } @Override @@ -57,7 +61,7 @@ public void onUpdate() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFIceExploder.java b/src/main/java/twilightforest/entity/EntityTFIceExploder.java index 889f63f892..6aeec07914 100644 --- a/src/main/java/twilightforest/entity/EntityTFIceExploder.java +++ b/src/main/java/twilightforest/entity/EntityTFIceExploder.java @@ -24,7 +24,7 @@ public class EntityTFIceExploder extends EntityMob { - private static final float EXPLOSION_RADIUS = 1; + private static final float EXPLOSION_RADIUS = 1*1.5f; public EntityTFIceExploder(World par1World) { @@ -44,8 +44,9 @@ public EntityTFIceExploder(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D*1.5D); } @@ -120,7 +121,7 @@ public float getEyeHeight() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFIceShooter.java b/src/main/java/twilightforest/entity/EntityTFIceShooter.java index 6b01aabd55..f8268ae9ae 100644 --- a/src/main/java/twilightforest/entity/EntityTFIceShooter.java +++ b/src/main/java/twilightforest/entity/EntityTFIceShooter.java @@ -39,8 +39,9 @@ public EntityTFIceShooter(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D*1.5D); } @@ -113,7 +114,7 @@ protected String getDeathSound() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFIceSnowball.java b/src/main/java/twilightforest/entity/EntityTFIceSnowball.java index bcd3f58705..26af812ac7 100644 --- a/src/main/java/twilightforest/entity/EntityTFIceSnowball.java +++ b/src/main/java/twilightforest/entity/EntityTFIceSnowball.java @@ -8,7 +8,7 @@ public class EntityTFIceSnowball extends EntityThrowable { - private static final int DAMAGE = 8; + private static final int DAMAGE = (int)(8*1.5); public EntityTFIceSnowball(World par1World) { super(par1World); @@ -39,9 +39,9 @@ protected float getGravityVelocity() */ public void makeTrail() { for (int i = 0; i < 2; i++) { - double dx = posX + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dy = posY + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dz = posZ + 0.5 * (rand.nextDouble() - rand.nextDouble()); + double dx = posX + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dy = posY + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dz = posZ + 0.5 * (rand.nextFloat() - rand.nextFloat()); worldObj.spawnParticle("snowballpoof", dx, dy, dz, 0.0D, 0.0D, 0.0D); } } @@ -66,13 +66,14 @@ public boolean attackEntityFrom(DamageSource damagesource, float i) @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { // only damage living things - if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit instanceof EntityLivingBase) + if (par1MovingObjectPosition.entityHit instanceof EntityLivingBase) { - if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), DAMAGE)) + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), DAMAGE); + /*if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), DAMAGE)) { // damage armor? //TODO: - } + }*/ } pop(); @@ -85,7 +86,7 @@ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { protected void pop() { for (int i = 0; i < 8; ++i) { - this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextDouble() * 0.2D, rand.nextGaussian() * 0.05D); + this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextFloat() * 0.2D, rand.nextGaussian() * 0.05D); } // noise diff --git a/src/main/java/twilightforest/entity/EntityTFKingSpider.java b/src/main/java/twilightforest/entity/EntityTFKingSpider.java index e8d53fd0b0..fdd5b71290 100644 --- a/src/main/java/twilightforest/entity/EntityTFKingSpider.java +++ b/src/main/java/twilightforest/entity/EntityTFKingSpider.java @@ -50,9 +50,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*2.5D+twilightforest.TwilightForestMod.Scatter.nextInt(15)-twilightforest.TwilightForestMod.Scatter.nextInt(15)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D*1.5D); // attack damage } diff --git a/src/main/java/twilightforest/entity/EntityTFKobold.java b/src/main/java/twilightforest/entity/EntityTFKobold.java index a82df12414..e5d2236bc6 100644 --- a/src/main/java/twilightforest/entity/EntityTFKobold.java +++ b/src/main/java/twilightforest/entity/EntityTFKobold.java @@ -58,7 +58,7 @@ public EntityTFKobold(World world, double x, double y, double z) protected void entityInit() { super.entityInit(); - dataWatcher.addObject(17, Byte.valueOf((byte)0)); + dataWatcher.addObject(17, (byte)0); } /** @@ -77,9 +77,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(13.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(13.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(6)-twilightforest.TwilightForestMod.Scatter.nextInt(6)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D*1.5D); // attack damage } @@ -132,11 +132,11 @@ public void setPanicked(boolean flag) { if (flag) { - dataWatcher.updateObject(17, Byte.valueOf((byte)127)); + dataWatcher.updateObject(17, ((byte)127)); } else { - dataWatcher.updateObject(17, Byte.valueOf((byte)0)); + dataWatcher.updateObject(17, (byte)0); } } @@ -155,7 +155,7 @@ public void onLivingUpdate() { for (int i = 0; i < 2; i++) { - this.worldObj.spawnParticle("splash", this.posX + (this.rand.nextDouble() - 0.5D) * this.width * 0.5, this.posY + this.getEyeHeight(), this.posZ + (this.rand.nextDouble() - 0.5D) * this.width * 0.5, 0, 0, 0); + this.worldObj.spawnParticle("splash", this.posX + (this.rand.nextFloat() - 0.5D) * this.width * 0.5, this.posY + this.getEyeHeight(), this.posZ + (this.rand.nextFloat() - 0.5D) * this.width * 0.5, 0, 0, 0); } } @@ -168,7 +168,7 @@ public void onLivingUpdate() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFLoyalZombie.java b/src/main/java/twilightforest/entity/EntityTFLoyalZombie.java index 422e2edfc1..feb9e216ea 100644 --- a/src/main/java/twilightforest/entity/EntityTFLoyalZombie.java +++ b/src/main/java/twilightforest/entity/EntityTFLoyalZombie.java @@ -62,8 +62,10 @@ public EntityAnimal createChild(EntityAgeable entityanimal) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D*1.1D+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D*1.5D); // movement speed + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } /** diff --git a/src/main/java/twilightforest/entity/EntityTFMazeSlime.java b/src/main/java/twilightforest/entity/EntityTFMazeSlime.java index 8015a771b3..ab30ddb28f 100644 --- a/src/main/java/twilightforest/entity/EntityTFMazeSlime.java +++ b/src/main/java/twilightforest/entity/EntityTFMazeSlime.java @@ -35,6 +35,8 @@ public void setSlimeSize(int par1) { super.setSlimeSize(par1); this.experienceValue = par1 + 3; + int size = this.getSlimeSize(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue((2.0D * 4.0D+twilightforest.TwilightForestMod.Scatter.nextInt(2)-twilightforest.TwilightForestMod.Scatter.nextInt(2)) * size * size);//Bogdan-G: fix hp set? } /** @@ -56,7 +58,10 @@ protected void applyEntityAttributes() { super.applyEntityAttributes(); int size = this.getSlimeSize(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2.0D * size * size); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue((2.0D * 4.0D+twilightforest.TwilightForestMod.Scatter.nextInt(2)-twilightforest.TwilightForestMod.Scatter.nextInt(2)) * size * size); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699999988079071D*1.5D); // movement speed + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } /** @@ -74,7 +79,7 @@ protected boolean canDamagePlayer() @Override protected int getAttackStrength() { - return super.getAttackStrength() + 3; + return super.getAttackStrength() + (int)(3*1.5); } diff --git a/src/main/java/twilightforest/entity/EntityTFMiniGhast.java b/src/main/java/twilightforest/entity/EntityTFMiniGhast.java index 2d777fc9ed..e13cc98093 100644 --- a/src/main/java/twilightforest/entity/EntityTFMiniGhast.java +++ b/src/main/java/twilightforest/entity/EntityTFMiniGhast.java @@ -42,7 +42,9 @@ public int getMaxSpawnedInChunk() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.isMinion ? 6 : 10); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.isMinion ? 6*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(3)-twilightforest.TwilightForestMod.Scatter.nextInt(3) : 10*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(5)-twilightforest.TwilightForestMod.Scatter.nextInt(5)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699999988079071D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } @Override diff --git a/src/main/java/twilightforest/entity/EntityTFMinotaur.java b/src/main/java/twilightforest/entity/EntityTFMinotaur.java index c249489fc8..6ef1d5682e 100644 --- a/src/main/java/twilightforest/entity/EntityTFMinotaur.java +++ b/src/main/java/twilightforest/entity/EntityTFMinotaur.java @@ -18,6 +18,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.entity.ai.EntityAITFChargeAttack; import twilightforest.item.TFItems; @@ -47,9 +48,9 @@ public EntityTFMinotaur(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(7.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(15)-twilightforest.TwilightForestMod.Scatter.nextInt(15)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(7.0D*1.5); // attack damage } @@ -59,7 +60,7 @@ protected void applyEntityAttributes() protected void entityInit() { super.entityInit(); - dataWatcher.addObject(17, Byte.valueOf((byte)0)); + dataWatcher.addObject(17, (byte)0); } /** @@ -80,11 +81,11 @@ public void setCharging(boolean flag) { if (flag) { - dataWatcher.updateObject(17, Byte.valueOf((byte)127)); + dataWatcher.updateObject(17, ((byte)127)); } else { - dataWatcher.updateObject(17, Byte.valueOf((byte)0)); + dataWatcher.updateObject(17, (byte)0); } } @@ -217,7 +218,7 @@ protected void dropRareDrop(int par1) @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFMistWolf.java b/src/main/java/twilightforest/entity/EntityTFMistWolf.java index 0d34aa214a..b8d9b57dba 100644 --- a/src/main/java/twilightforest/entity/EntityTFMistWolf.java +++ b/src/main/java/twilightforest/entity/EntityTFMistWolf.java @@ -25,7 +25,7 @@ public EntityTFMistWolf(World world) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*2.5+twilightforest.TwilightForestMod.Scatter.nextInt(15)-twilightforest.TwilightForestMod.Scatter.nextInt(15)); // max health } /** @@ -63,7 +63,7 @@ else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) if (effectDuration > 0) { - ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potion.blindness.id, effectDuration * 20, 0)); + ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potion.blindness.id, (int)(effectDuration * 20 * 1.5), 0)); } } diff --git a/src/main/java/twilightforest/entity/EntityTFMoonwormShot.java b/src/main/java/twilightforest/entity/EntityTFMoonwormShot.java index 26cd8280d3..845ac97c70 100644 --- a/src/main/java/twilightforest/entity/EntityTFMoonwormShot.java +++ b/src/main/java/twilightforest/entity/EntityTFMoonwormShot.java @@ -68,9 +68,9 @@ public int getBrightnessForRender(float par1) public void makeTrail() { // for (int i = 0; i < 5; i++) { -// double dx = posX + 0.5 * (rand.nextDouble() - rand.nextDouble()); -// double dy = posY + 0.5 * (rand.nextDouble() - rand.nextDouble()); -// double dz = posZ + 0.5 * (rand.nextDouble() - rand.nextDouble()); +// double dx = posX + 0.5 * (rand.nextFloat() - rand.nextFloat()); +// double dy = posY + 0.5 * (rand.nextFloat() - rand.nextFloat()); +// double dz = posZ + 0.5 * (rand.nextFloat() - rand.nextFloat()); // // double s1 = ((rand.nextFloat() * 0.5F) + 0.5F) * 0.17F; // double s2 = ((rand.nextFloat() * 0.5F) + 0.5F) * 0.80F; @@ -127,7 +127,7 @@ protected void onImpact(MovingObjectPosition mop) { if (mop.entityHit != null) { - mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0); + mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 2f);//old: 0 } for (int var3 = 0; var3 < 8; ++var3) diff --git a/src/main/java/twilightforest/entity/EntityTFMosquitoSwarm.java b/src/main/java/twilightforest/entity/EntityTFMosquitoSwarm.java index 668057aa24..dc595a1ead 100644 --- a/src/main/java/twilightforest/entity/EntityTFMosquitoSwarm.java +++ b/src/main/java/twilightforest/entity/EntityTFMosquitoSwarm.java @@ -52,9 +52,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(12.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(12.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(6)-twilightforest.TwilightForestMod.Scatter.nextInt(6)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D*1.5); // attack damage } @@ -91,7 +91,7 @@ else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) if (duration > 0) { - ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potion.hunger.id, duration * 20, 0)); + ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potion.hunger.id, (int)(duration * 20 * 1.5), 0)); } } @@ -129,7 +129,9 @@ public boolean getCanSpawnHere() public int getMaxSpawnedInChunk() { // we are solitary creatures - return 1; + //Bogdan-G: where you saw that in the swamp was almost no mosquitoes?(rare mob in tfSwamp, ordinary mobs popping up in the swamp frequency) + if (worldObj.getBiomeGenForCoords(MathHelper.floor_double(posX), MathHelper.floor_double(posZ)) == TFBiomeBase.tfSwamp) return 6; + else return 1; } /** @@ -138,7 +140,8 @@ public int getMaxSpawnedInChunk() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + //Bogdan-G: achievement only in Twilight Forest dimension! + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFNatureBolt.java b/src/main/java/twilightforest/entity/EntityTFNatureBolt.java index a5d6eb73d3..c65e034fbb 100644 --- a/src/main/java/twilightforest/entity/EntityTFNatureBolt.java +++ b/src/main/java/twilightforest/entity/EntityTFNatureBolt.java @@ -57,9 +57,9 @@ protected float getGravityVelocity() */ public void makeTrail() { for (int i = 0; i < 5; i++) { - double dx = posX + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dy = posY + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dz = posZ + 0.5 * (rand.nextDouble() - rand.nextDouble()); + double dx = posX + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dy = posY + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dz = posZ + 0.5 * (rand.nextFloat() - rand.nextFloat()); worldObj.spawnParticle("happyVillager", dx, dy, dz, 0.0D, 0.0D, 0.0D); } } @@ -70,15 +70,15 @@ public void makeTrail() { @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { // only damage living things - if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit instanceof EntityLivingBase) + if (par1MovingObjectPosition.entityHit instanceof EntityLivingBase) { - if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, this.getThrower()), 2)) + if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, this.getThrower()), 2*1.5f)) { // similar to EntityCaveSpider byte poisonStrength = (byte) (worldObj.difficultySetting == EnumDifficulty.PEACEFUL ? 0 : worldObj.difficultySetting == EnumDifficulty.NORMAL ? 3 : 7); if(poisonStrength > 0) { - ((EntityLivingBase)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, poisonStrength * 20, 0)); + ((EntityLivingBase)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, (int)(poisonStrength * 20 * 1.5), 0)); // System.out.println("Poisoning entityHit " + par1MovingObjectPosition.entityHit); } @@ -88,7 +88,7 @@ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { for (int i = 0; i < 8; ++i) { - this.worldObj.spawnParticle("blockcrack_" + Block.getIdFromBlock(Blocks.leaves) + "_0", this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextDouble() * 0.2D, rand.nextGaussian() * 0.05D); + this.worldObj.spawnParticle("blockcrack_" + Block.getIdFromBlock(Blocks.leaves) + "_0", this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextFloat() * 0.2D, rand.nextGaussian() * 0.05D); } if (!this.worldObj.isRemote) diff --git a/src/main/java/twilightforest/entity/EntityTFPinchBeetle.java b/src/main/java/twilightforest/entity/EntityTFPinchBeetle.java index 9e303449a0..3b7fc08dfd 100644 --- a/src/main/java/twilightforest/entity/EntityTFPinchBeetle.java +++ b/src/main/java/twilightforest/entity/EntityTFPinchBeetle.java @@ -16,6 +16,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.entity.ai.EntityAITFChargeAttack; import twilightforest.entity.ai.EntityAITFKidnapRider; import cpw.mods.fml.relauncher.Side; @@ -57,9 +58,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(20)-twilightforest.TwilightForestMod.Scatter.nextInt(20)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D*1.5); // attack damage } /** @@ -162,7 +163,7 @@ public void onLivingUpdate() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } @@ -264,8 +265,8 @@ public Vec3 getRiderPosition() { float distance = 0.9F; - double var1 = Math.cos((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; - double var3 = Math.sin((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; + double var1 = org.bogdang.modifications.math.MathHelperLite.cos((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; + double var3 = org.bogdang.modifications.math.MathHelperLite.sin((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; return Vec3.createVectorHelper(this.posX + var1, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + var3); } diff --git a/src/main/java/twilightforest/entity/EntityTFRedcap.java b/src/main/java/twilightforest/entity/EntityTFRedcap.java index 6e742ae8c0..40f29b2ba1 100644 --- a/src/main/java/twilightforest/entity/EntityTFRedcap.java +++ b/src/main/java/twilightforest/entity/EntityTFRedcap.java @@ -88,8 +88,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } @Override @@ -160,7 +161,7 @@ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); // are we in a level 1 hill? int chunkX = MathHelper.floor_double(posX) >> 4; diff --git a/src/main/java/twilightforest/entity/EntityTFRedcapSapper.java b/src/main/java/twilightforest/entity/EntityTFRedcapSapper.java index 522f7ee9ab..4c69ed9700 100644 --- a/src/main/java/twilightforest/entity/EntityTFRedcapSapper.java +++ b/src/main/java/twilightforest/entity/EntityTFRedcapSapper.java @@ -7,6 +7,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.TFFeature; import twilightforest.entity.ai.EntityAITFRedcapPlantTNT; import twilightforest.item.TFItems; @@ -34,7 +35,9 @@ public EntityTFRedcapSapper(World world) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(15)-twilightforest.TwilightForestMod.Scatter.nextInt(15)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699999988079071D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } /** @@ -66,7 +69,7 @@ public ItemStack getPick() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); // are we in a level 2 hill? int chunkX = MathHelper.floor_double(posX) >> 4; diff --git a/src/main/java/twilightforest/entity/EntityTFRovingCube.java b/src/main/java/twilightforest/entity/EntityTFRovingCube.java index 80caee1885..8f562f6373 100644 --- a/src/main/java/twilightforest/entity/EntityTFRovingCube.java +++ b/src/main/java/twilightforest/entity/EntityTFRovingCube.java @@ -34,9 +34,9 @@ public EntityTFRovingCube(World world) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(5)-twilightforest.TwilightForestMod.Scatter.nextInt(5)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D*1.5); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D*1.5); } diff --git a/src/main/java/twilightforest/entity/EntityTFSkeletonDruid.java b/src/main/java/twilightforest/entity/EntityTFSkeletonDruid.java index f77c08a3ec..75e6843109 100644 --- a/src/main/java/twilightforest/entity/EntityTFSkeletonDruid.java +++ b/src/main/java/twilightforest/entity/EntityTFSkeletonDruid.java @@ -25,6 +25,7 @@ import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.item.TFItems; @@ -68,8 +69,9 @@ public boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } /** @@ -149,7 +151,7 @@ public EnumCreatureAttribute getCreatureAttribute() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFSlimeBeetle.java b/src/main/java/twilightforest/entity/EntityTFSlimeBeetle.java index 9d59c67f42..fa0f0b152e 100644 --- a/src/main/java/twilightforest/entity/EntityTFSlimeBeetle.java +++ b/src/main/java/twilightforest/entity/EntityTFSlimeBeetle.java @@ -18,6 +18,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.entity.ai.EntityAITFMagicAttack; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -60,8 +61,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25.0D*2.5+twilightforest.TwilightForestMod.Scatter.nextInt(12)-twilightforest.TwilightForestMod.Scatter.nextInt(12)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } @@ -128,7 +130,7 @@ public void onLivingUpdate() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/EntityTFSlimeProjectile.java b/src/main/java/twilightforest/entity/EntityTFSlimeProjectile.java index e7fe9e235f..7ae7b7ed3e 100644 --- a/src/main/java/twilightforest/entity/EntityTFSlimeProjectile.java +++ b/src/main/java/twilightforest/entity/EntityTFSlimeProjectile.java @@ -38,9 +38,9 @@ protected float getGravityVelocity() */ public void makeTrail() { for (int i = 0; i < 2; i++) { - double dx = posX + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dy = posY + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dz = posZ + 0.5 * (rand.nextDouble() - rand.nextDouble()); + double dx = posX + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dy = posY + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dz = posZ + 0.5 * (rand.nextFloat() - rand.nextFloat()); worldObj.spawnParticle("slime", dx, dy, dz, 0.0D, 0.0D, 0.0D); } } @@ -65,13 +65,14 @@ public boolean attackEntityFrom(DamageSource damagesource, float i) @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { // only damage living things - if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit instanceof EntityLivingBase) + if (par1MovingObjectPosition.entityHit instanceof EntityLivingBase) { - if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 8)) + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 8*1.5f); + /*if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 8)) { // damage armor? //TODO: - } + }*/ } pop(); @@ -84,7 +85,7 @@ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { protected void pop() { for (int i = 0; i < 8; ++i) { - this.worldObj.spawnParticle("slime", this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextDouble() * 0.2D, rand.nextGaussian() * 0.05D); + this.worldObj.spawnParticle("slime", this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextFloat() * 0.2D, rand.nextGaussian() * 0.05D); } // noise diff --git a/src/main/java/twilightforest/entity/EntityTFSnowGuardian.java b/src/main/java/twilightforest/entity/EntityTFSnowGuardian.java index b936f202c5..0affba609e 100644 --- a/src/main/java/twilightforest/entity/EntityTFSnowGuardian.java +++ b/src/main/java/twilightforest/entity/EntityTFSnowGuardian.java @@ -37,9 +37,9 @@ public EntityTFSnowGuardian(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D*1.5); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D*1.5); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(5)-twilightforest.TwilightForestMod.Scatter.nextInt(5)); } diff --git a/src/main/java/twilightforest/entity/EntityTFSwarmSpider.java b/src/main/java/twilightforest/entity/EntityTFSwarmSpider.java index 79dd627355..05b75bf205 100644 --- a/src/main/java/twilightforest/entity/EntityTFSwarmSpider.java +++ b/src/main/java/twilightforest/entity/EntityTFSwarmSpider.java @@ -9,6 +9,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.TFFeature; @@ -42,8 +43,9 @@ public EntityTFSwarmSpider(World world, double x, double y, double z) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(3.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(3.0D*4.0D+twilightforest.TwilightForestMod.Scatter.nextInt(4)-twilightforest.TwilightForestMod.Scatter.nextInt(4)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699999988079071D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D*1.5); // attack damage } @@ -186,7 +188,7 @@ public void readEntityFromNBT(NBTTagCompound nbttagcompound) @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); // are we in a hedge maze? int chunkX = MathHelper.floor_double(posX) >> 4; diff --git a/src/main/java/twilightforest/entity/EntityTFTomeBolt.java b/src/main/java/twilightforest/entity/EntityTFTomeBolt.java index 2cb271e73b..5d7f143dbf 100644 --- a/src/main/java/twilightforest/entity/EntityTFTomeBolt.java +++ b/src/main/java/twilightforest/entity/EntityTFTomeBolt.java @@ -52,9 +52,9 @@ protected float getGravityVelocity() */ public void makeTrail() { for (int i = 0; i < 5; i++) { - double dx = posX + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dy = posY + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dz = posZ + 0.5 * (rand.nextDouble() - rand.nextDouble()); + double dx = posX + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dy = posY + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dz = posZ + 0.5 * (rand.nextFloat() - rand.nextFloat()); worldObj.spawnParticle("crit", dx, dy, dz, 0.0D, 0.0D, 0.0D); } } @@ -67,13 +67,13 @@ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { // only damage living things if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit instanceof EntityLivingBase) { - if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 6)) + if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 6*1.5f)) { // inflict move slowdown byte potionStrength = (byte) (worldObj.difficultySetting == EnumDifficulty.PEACEFUL ? 3 : worldObj.difficultySetting == EnumDifficulty.NORMAL ? 7 : 9); if(potionStrength > 0) { - ((EntityLivingBase)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, potionStrength * 20, 1)); + ((EntityLivingBase)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, (int)(potionStrength * 20 * 1.5), 1)); } } @@ -82,7 +82,7 @@ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { for (int i = 0; i < 8; ++i) { - this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(Items.fire_charge), this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextDouble() * 0.2D, rand.nextGaussian() * 0.05D); + this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(Items.fire_charge), this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextFloat() * 0.2D, rand.nextGaussian() * 0.05D); } if (!this.worldObj.isRemote) diff --git a/src/main/java/twilightforest/entity/EntityTFTowerBroodling.java b/src/main/java/twilightforest/entity/EntityTFTowerBroodling.java index 5a0c9f8aba..df3050ada6 100644 --- a/src/main/java/twilightforest/entity/EntityTFTowerBroodling.java +++ b/src/main/java/twilightforest/entity/EntityTFTowerBroodling.java @@ -23,8 +23,9 @@ public EntityTFTowerBroodling(World world, boolean spawnMore) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(7.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(7.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(3)-twilightforest.TwilightForestMod.Scatter.nextInt(3)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699999988079071D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D*1.5); // attack damage } /** diff --git a/src/main/java/twilightforest/entity/EntityTFTowerGhast.java b/src/main/java/twilightforest/entity/EntityTFTowerGhast.java index 577f099844..791405efcd 100644 --- a/src/main/java/twilightforest/entity/EntityTFTowerGhast.java +++ b/src/main/java/twilightforest/entity/EntityTFTowerGhast.java @@ -61,7 +61,10 @@ public EntityTFTowerGhast(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699999988079071D*1.5D); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D*1.5); } /** @@ -129,7 +132,7 @@ public void onLivingUpdate() if (this.rand.nextBoolean()) { - this.worldObj.spawnParticle("reddust", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0, 0, 0); + this.worldObj.spawnParticle("reddust", this.posX + (this.rand.nextFloat() - 0.5D) * (double)this.width, this.posY + this.rand.nextFloat() * (double)this.height - 0.25D, this.posZ + (this.rand.nextFloat() - 0.5D) * (double)this.width, 0, 0, 0); } super.onLivingUpdate(); @@ -265,11 +268,11 @@ else if (!this.isAggressive && this.targetedEntity instanceof EntityPlayer) // ignore player, move normally this.isAggressive = false; this.targetedEntity = null; - this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI; + this.renderYawOffset = this.rotationYaw = -(org.bogdang.modifications.math.TrigMath2.atan2((float)this.motionX, (float)this.motionZ)) * 180.0F / (float)Math.PI; // changing the pitch with movement looks goofy and un-ghast-like //double dist = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotationPitch = 0;//(float) (-((Math.atan2(this.motionY, dist) * 180D) / Math.PI));; + this.rotationPitch = 0;//(float) (-((org.bogdang.modifications.math.TrigMath2.atan2(this.motionY, dist) * 180D) / Math.PI));; } @@ -284,7 +287,7 @@ else if (!this.isAggressive && this.targetedEntity instanceof EntityPlayer) if (currentAggroStatus != newAggroStatus) { - this.dataWatcher.updateObject(AGGRO_STATUS, Byte.valueOf(newAggroStatus)); + this.dataWatcher.updateObject(AGGRO_STATUS, newAggroStatus); } } diff --git a/src/main/java/twilightforest/entity/EntityTFTowerGolem.java b/src/main/java/twilightforest/entity/EntityTFTowerGolem.java index 2481aa0b2e..81779a2026 100644 --- a/src/main/java/twilightforest/entity/EntityTFTowerGolem.java +++ b/src/main/java/twilightforest/entity/EntityTFTowerGolem.java @@ -61,9 +61,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(9.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(20)-twilightforest.TwilightForestMod.Scatter.nextInt(20)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(9.0D*1.5); // attack damage } /** @@ -170,7 +170,7 @@ public void onLivingUpdate() // redstone sparkles? if (this.rand.nextBoolean()) { - this.worldObj.spawnParticle("reddust", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0, 0, 0); + this.worldObj.spawnParticle("reddust", this.posX + (this.rand.nextFloat() - 0.5D) * (double)this.width, this.posY + this.rand.nextFloat() * (double)this.height - 0.25D, this.posZ + (this.rand.nextFloat() - 0.5D) * (double)this.width, 0, 0, 0); } } diff --git a/src/main/java/twilightforest/entity/EntityTFTowerTermite.java b/src/main/java/twilightforest/entity/EntityTFTowerTermite.java index 864bb34ad5..f6b4ec4dd9 100644 --- a/src/main/java/twilightforest/entity/EntityTFTowerTermite.java +++ b/src/main/java/twilightforest/entity/EntityTFTowerTermite.java @@ -62,9 +62,9 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(15.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.27D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(15.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(7)-twilightforest.TwilightForestMod.Scatter.nextInt(7)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.27D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D*1.5); // attack damage } /** diff --git a/src/main/java/twilightforest/entity/EntityTFTroll.java b/src/main/java/twilightforest/entity/EntityTFTroll.java index a0142c6561..cb4b465e1a 100644 --- a/src/main/java/twilightforest/entity/EntityTFTroll.java +++ b/src/main/java/twilightforest/entity/EntityTFTroll.java @@ -30,6 +30,7 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.block.TFBlocks; import twilightforest.entity.ai.EntityAITFCollideAttackFixed; import twilightforest.entity.boss.EntityTFIceBomb; @@ -79,15 +80,15 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(7.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*2.5+twilightforest.TwilightForestMod.Scatter.nextInt(15)-twilightforest.TwilightForestMod.Scatter.nextInt(15)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(7.0D*1.5); } protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(ROCK_FLAG, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(ROCK_FLAG, (byte)0); } /** @@ -116,9 +117,9 @@ public void setHasRock(boolean rock) { if (rock) { this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D); - this.dataWatcher.updateObject(ROCK_FLAG, Byte.valueOf((byte)(b0 | 2))); + this.dataWatcher.updateObject(ROCK_FLAG, ((byte)(b0 | 2))); } else { - this.dataWatcher.updateObject(ROCK_FLAG, Byte.valueOf((byte)(b0 & -3))); + this.dataWatcher.updateObject(ROCK_FLAG, ((byte)(b0 & -3))); } this.setCombatTask(); @@ -179,9 +180,9 @@ protected void onDeathUpdate() { this.ripenTrollBerNearby(this.deathTime / 5); } - if (this.deathTime == 1) { + /*if (this.deathTime == 1) { //this.makeTrollStoneInAABB(this.boundingBox); - } + }*/ } @@ -222,7 +223,7 @@ private void ripenBer(int offset, int cx, int cy, int cz) { @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } diff --git a/src/main/java/twilightforest/entity/EntityTFTwilightWandBolt.java b/src/main/java/twilightforest/entity/EntityTFTwilightWandBolt.java index 81b386c0ee..3cbfd3066f 100644 --- a/src/main/java/twilightforest/entity/EntityTFTwilightWandBolt.java +++ b/src/main/java/twilightforest/entity/EntityTFTwilightWandBolt.java @@ -36,9 +36,9 @@ public void onUpdate() { public void makeTrail() { for (int i = 0; i < 5; i++) { - double dx = posX + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dy = posY + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dz = posZ + 0.5 * (rand.nextDouble() - rand.nextDouble()); + double dx = posX + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dy = posY + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dz = posZ + 0.5 * (rand.nextFloat() - rand.nextFloat()); double s1 = ((rand.nextFloat() * 0.5F) + 0.5F) * 0.17F; // color double s2 = ((rand.nextFloat() * 0.5F) + 0.5F) * 0.80F; // color @@ -62,17 +62,18 @@ protected float getGravityVelocity() @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { // only hit living things - if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit instanceof EntityLivingBase) + if (par1MovingObjectPosition.entityHit instanceof EntityLivingBase) { - if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, this.getThrower()), 6)) + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, this.getThrower()), 6*1.5f); + /*if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, this.getThrower()), 6)) { ; - } + }*/ } for (int i = 0; i < 8; ++i) { - this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(Items.ender_pearl), this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextDouble() * 0.2D, rand.nextGaussian() * 0.05D); + this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(Items.ender_pearl), this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextFloat() * 0.2D, rand.nextGaussian() * 0.05D); } if (!this.worldObj.isRemote) diff --git a/src/main/java/twilightforest/entity/EntityTFWinterWolf.java b/src/main/java/twilightforest/entity/EntityTFWinterWolf.java index 0bd5c90096..3544fcefec 100644 --- a/src/main/java/twilightforest/entity/EntityTFWinterWolf.java +++ b/src/main/java/twilightforest/entity/EntityTFWinterWolf.java @@ -46,13 +46,13 @@ public EntityTFWinterWolf(World world) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D*1.6D+twilightforest.TwilightForestMod.Scatter.nextInt(15)-twilightforest.TwilightForestMod.Scatter.nextInt(15)); // max health } protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(BREATH_FLAG, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(BREATH_FLAG, (byte)0); } /** @@ -101,8 +101,8 @@ public void onLivingUpdate() double dy = look.yCoord; double dz = look.zCoord; - double spread = 5 + this.getRNG().nextDouble() * 2.5; - double velocity = 3.0 + this.getRNG().nextDouble() * 0.15; + double spread = 5 + this.getRNG().nextFloat() * 2.5; + double velocity = 3.0 + this.getRNG().nextFloat() * 0.15; // spread flame dx += this.getRNG().nextGaussian() * 0.007499999832361937D * spread; @@ -141,7 +141,7 @@ public boolean isBreathing() { @Override public void setBreathing(boolean flag) { - this.getDataWatcher().updateObject(BREATH_FLAG, Byte.valueOf((byte)(flag ? 1 : 0))); + this.getDataWatcher().updateObject(BREATH_FLAG, ((byte)(flag ? 1 : 0))); } @Override diff --git a/src/main/java/twilightforest/entity/EntityTFWraith.java b/src/main/java/twilightforest/entity/EntityTFWraith.java index b9966455fb..46ea4b2640 100644 --- a/src/main/java/twilightforest/entity/EntityTFWraith.java +++ b/src/main/java/twilightforest/entity/EntityTFWraith.java @@ -38,25 +38,25 @@ public EntityTFWraith(World world, double x, double y, double z) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D*1.5); // movement speed // need to initialize damage since we're not an EntityMob this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D*1.5); // attack damage } @Override public void onLivingUpdate() { - if(worldObj.isDaytime()) + /*if(worldObj.isDaytime()) { float f = getBrightness(1.0F); if(f > 0.5F && worldObj.canBlockSeeTheSky(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) && rand.nextFloat() * 30F < (f - 0.4F) * 2.0F) { // fire = 300; } - } + }*/ super.onLivingUpdate(); } @@ -135,16 +135,16 @@ protected void updateEntityActionState() double d4 = 64D; if(targetedEntity != null && targetedEntity.getDistanceSqToEntity(this) < d4 * d4) { - double d5 = targetedEntity.posX - posX; + float d5 = (float)(targetedEntity.posX - posX); //double d6 = (targetedEntity.boundingBox.minY + (double)(targetedEntity.height / 2.0F)) - (posY + height / 2.0F); - double d7 = targetedEntity.posZ - posZ; - renderYawOffset = rotationYaw = (-(float)Math.atan2(d5, d7) * 180F) / 3.141593F; + float d7 = (float)(targetedEntity.posZ - posZ); + renderYawOffset = rotationYaw = (-org.bogdang.modifications.math.TrigMath2.atan2(d5, d7) * 180F) / (float)Math.PI; if(canEntityBeSeen(targetedEntity)) { - if(attackCounter == 10) + /*if(attackCounter == 10) { //worldObj.playSoundAtEntity(this, "mob.ghast.charge", getSoundVolume(), (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F); - } + }*/ attackCounter++; if(attackCounter == 20) { @@ -162,7 +162,7 @@ protected void updateEntityActionState() } } else { - renderYawOffset = rotationYaw = (-(float)Math.atan2(motionX, motionZ) * 180F) / 3.141593F; + renderYawOffset = rotationYaw = (-org.bogdang.modifications.math.TrigMath2.atan2((float)motionX, (float)motionZ) * 180F) / (float)Math.PI; if(attackCounter > 0) { attackCounter--; @@ -286,7 +286,7 @@ protected Item getDropItem() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); // are we in a level 3 hill? int chunkX = MathHelper.floor_double(posX) >> 4; diff --git a/src/main/java/twilightforest/entity/EntityTFYeti.java b/src/main/java/twilightforest/entity/EntityTFYeti.java index f817dd1f21..025199b049 100644 --- a/src/main/java/twilightforest/entity/EntityTFYeti.java +++ b/src/main/java/twilightforest/entity/EntityTFYeti.java @@ -17,6 +17,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.biomes.TFBiomeBase; import twilightforest.entity.ai.EntityAITFThrowRider; import twilightforest.item.TFItems; @@ -60,16 +61,16 @@ protected boolean isAIEnabled() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.38D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(0.0D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(4.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.38D*1.5); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(0.0D+2.0D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(4.0D*1.5); } protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(ANGER_FLAG, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(ANGER_FLAG, (byte)0); } /** @@ -180,9 +181,9 @@ public void setAngry(boolean anger) { if (anger) { this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D); - this.dataWatcher.updateObject(ANGER_FLAG, Byte.valueOf((byte)(b0 | 2))); + this.dataWatcher.updateObject(ANGER_FLAG, ((byte)(b0 | 2))); } else { - this.dataWatcher.updateObject(ANGER_FLAG, Byte.valueOf((byte)(b0 & -3))); + this.dataWatcher.updateObject(ANGER_FLAG, ((byte)(b0 & -3))); } } @@ -236,8 +237,8 @@ public Vec3 getRiderPosition() { float distance = 0.4F; - double var1 = Math.cos((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; - double var3 = Math.sin((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; + double var1 = org.bogdang.modifications.math.MathHelperLite.cos((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; + double var3 = org.bogdang.modifications.math.MathHelperLite.sin((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; return Vec3.createVectorHelper(this.posX + var1, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + var3); } @@ -264,7 +265,7 @@ public boolean canRiderInteract() @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/ai/EntityAICubeCenterOnSymbol.java b/src/main/java/twilightforest/entity/ai/EntityAICubeCenterOnSymbol.java index 349c3c0258..1a707fb763 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAICubeCenterOnSymbol.java +++ b/src/main/java/twilightforest/entity/ai/EntityAICubeCenterOnSymbol.java @@ -59,10 +59,10 @@ public boolean continueExecuting() this.myCube.getMoveHelper().setMoveTo(this.xPosition + 0.5F, this.yPosition, this.zPosition + 0.5F, this.speed); - if (this.myCube.ticksExisted % 5 == 0) { + /*if (this.myCube.ticksExisted % 5 == 0) { //System.out.println("Centering cube on symbol. Dist = " + dist); //System.out.println("heading to " + this.xPosition + ", " + this.yPosition + ", " + this.zPosition); - } + }*/ return dist > 0.1F && this.isCourseTraversable(); } diff --git a/src/main/java/twilightforest/entity/ai/EntityAITFAvoidFrontalAttack.java b/src/main/java/twilightforest/entity/ai/EntityAITFAvoidFrontalAttack.java index 23d1de6d22..788ae28a43 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAITFAvoidFrontalAttack.java +++ b/src/main/java/twilightforest/entity/ai/EntityAITFAvoidFrontalAttack.java @@ -118,9 +118,9 @@ public void resetTask() protected Vec3 findCirclePoint(Entity circler, Entity toCircle, double radius, double rotation) { // compute angle - double vecx = circler.posX - toCircle.posX; - double vecz = circler.posZ - toCircle.posZ; - float rangle = (float)(Math.atan2(vecz, vecx)); + float vecx = (float)(circler.posX - toCircle.posX); + float vecz = (float)(circler.posZ - toCircle.posZ); + float rangle = org.bogdang.modifications.math.TrigMath2.atan2(vecz, vecx); // add a little, so he circles rangle += rotation; @@ -140,9 +140,9 @@ protected Vec3 findCirclePoint(Entity circler, Entity toCircle, double radius, d */ public boolean isTargetLookingAtMe(EntityLivingBase attackTarget) { // find angle of approach - double dx = me.posX - attackTarget.posX; - double dz = me.posZ - attackTarget.posZ; - float angle = (float)((Math.atan2(dz, dx) * 180D) / 3.1415927410125732D) - 90F; + float dx = (float)(me.posX - attackTarget.posX); + float dz = (float)(me.posZ - attackTarget.posZ); + float angle = ((org.bogdang.modifications.math.TrigMath2.atan2(dz, dx) * 180F) / (float)Math.PI) - 90F; float difference = MathHelper.abs((attackTarget.rotationYaw - angle) % 360); diff --git a/src/main/java/twilightforest/entity/ai/EntityAITFBreathAttack.java b/src/main/java/twilightforest/entity/ai/EntityAITFBreathAttack.java index f96879f289..f1629f15b1 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAITFBreathAttack.java +++ b/src/main/java/twilightforest/entity/ai/EntityAITFBreathAttack.java @@ -171,13 +171,13 @@ else if (interceptPos != null) * Face the head towards a specific Vector */ public void faceVec(double xCoord, double yCoord, double zCoord, float yawConstraint, float pitchConstraint) { - double xOffset = xCoord - entityHost.posX; - double zOffset = zCoord - entityHost.posZ; - double yOffset = (entityHost.posY + 0.25) - yCoord; + float xOffset = (float)(xCoord - entityHost.posX); + float zOffset = (float)(zCoord - entityHost.posZ); + float yOffset = (float)((entityHost.posY + 0.25) - yCoord); - double distance = MathHelper.sqrt_double(xOffset * xOffset + zOffset * zOffset); - float xyAngle = (float)((Math.atan2(zOffset, xOffset) * 180D) / Math.PI) - 90F; - float zdAngle = (float)(-((Math.atan2(yOffset, distance) * 180D) / Math.PI)); + float distance = MathHelper.sqrt_float(xOffset * xOffset + zOffset * zOffset); + float xyAngle = ((org.bogdang.modifications.math.TrigMath2.atan2(zOffset, xOffset) * 180F) / (float)Math.PI) - 90F; + float zdAngle = (-((org.bogdang.modifications.math.TrigMath2.atan2(yOffset, distance) * 180F) / (float)Math.PI)); entityHost.rotationPitch = -updateRotation(entityHost.rotationPitch, zdAngle, pitchConstraint); entityHost.rotationYaw = updateRotation(entityHost.rotationYaw, xyAngle, yawConstraint); diff --git a/src/main/java/twilightforest/entity/ai/EntityAITFChargeAttack.java b/src/main/java/twilightforest/entity/ai/EntityAITFChargeAttack.java index 400d8706af..91c0962e5e 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAITFChargeAttack.java +++ b/src/main/java/twilightforest/entity/ai/EntityAITFChargeAttack.java @@ -166,9 +166,9 @@ public void resetTask() protected Vec3 findChargePoint(Entity attacker, Entity target, double overshoot) { // compute angle - double vecx = target.posX - attacker.posX; - double vecz = target.posZ - attacker.posZ; - float rangle = (float)(Math.atan2(vecz, vecx)); + float vecx = (float)(target.posX - attacker.posX); + float vecz = (float)(target.posZ - attacker.posZ); + float rangle = org.bogdang.modifications.math.TrigMath2.atan2(vecz, vecx); double distance = MathHelper.sqrt_double(vecx * vecx + vecz * vecz); diff --git a/src/main/java/twilightforest/entity/ai/EntityAITFHoverBeam.java b/src/main/java/twilightforest/entity/ai/EntityAITFHoverBeam.java index d0f7764528..6d08e0bdf1 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAITFHoverBeam.java +++ b/src/main/java/twilightforest/entity/ai/EntityAITFHoverBeam.java @@ -252,9 +252,9 @@ private void makeNewHoverSpot(EntityLivingBase target) { } } - if (tries == 99) { + /*if (tries == 99) { //System.out.println("Found no spots, giving up"); - } + }*/ this.hoverPosX = hx; this.hoverPosY = hy; diff --git a/src/main/java/twilightforest/entity/ai/EntityAITFHoverSummon.java b/src/main/java/twilightforest/entity/ai/EntityAITFHoverSummon.java index b45c864e05..b00865c210 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAITFHoverSummon.java +++ b/src/main/java/twilightforest/entity/ai/EntityAITFHoverSummon.java @@ -74,9 +74,9 @@ public boolean continueExecuting() { // check visibility boolean isVisible = this.canEntitySee(this.attacker, hoverPosX, hoverPosY, hoverPosZ); - if (!isVisible) { + /*if (!isVisible) { //System.out.println("Hover spot is no longer visible"); - } + }*/ return isVisible; } diff --git a/src/main/java/twilightforest/entity/ai/EntityAITFHoverThenDrop.java b/src/main/java/twilightforest/entity/ai/EntityAITFHoverThenDrop.java index f6ded10a8a..7169b5465a 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAITFHoverThenDrop.java +++ b/src/main/java/twilightforest/entity/ai/EntityAITFHoverThenDrop.java @@ -189,7 +189,7 @@ private void makeNewHoverSpot(EntityLivingBase target) { } if (tries == 99) { - System.out.println("Found no spots, giving up"); + cpw.mods.fml.common.FMLLog.info("Found no spots, giving up"); } this.hoverPosX = hx; diff --git a/src/main/java/twilightforest/entity/ai/EntityAITFRedcapBase.java b/src/main/java/twilightforest/entity/ai/EntityAITFRedcapBase.java index 1a892cf37d..93042a621f 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAITFRedcapBase.java +++ b/src/main/java/twilightforest/entity/ai/EntityAITFRedcapBase.java @@ -23,9 +23,9 @@ public abstract class EntityAITFRedcapBase extends EntityAIBase */ public boolean isTargetLookingAtMe(EntityLivingBase attackTarget) { // find angle of approach - double dx = entityObj.posX - attackTarget.posX; - double dz = entityObj.posZ - attackTarget.posZ; - float angle = (float)((Math.atan2(dz, dx) * 180D) / Math.PI) - 90F; + float dx = (float)(entityObj.posX - attackTarget.posX); + float dz = (float)(entityObj.posZ - attackTarget.posZ); + float angle = ((org.bogdang.modifications.math.TrigMath2.atan2(dz, dx) * 180F) / (float)Math.PI) - 90F; float difference = MathHelper.abs((attackTarget.rotationYaw - angle) % 360); diff --git a/src/main/java/twilightforest/entity/ai/EntityAITFRedcapShy.java b/src/main/java/twilightforest/entity/ai/EntityAITFRedcapShy.java index e3c59a58e0..112984f03e 100644 --- a/src/main/java/twilightforest/entity/ai/EntityAITFRedcapShy.java +++ b/src/main/java/twilightforest/entity/ai/EntityAITFRedcapShy.java @@ -23,7 +23,7 @@ public class EntityAITFRedcapShy extends EntityAITFRedcapBase { public EntityAITFRedcapShy(EntityTFRedcap entityTFRedcap, float moveSpeed) { this.entityObj = entityTFRedcap; this.speed = moveSpeed; - this.lefty = (new Random()).nextBoolean(); + this.lefty = (new org.bogdang.modifications.random.XSTR()).nextBoolean(); this.setMutexBits(1); } @@ -118,9 +118,9 @@ public void resetTask() protected Vec3 findCirclePoint(Entity circler, Entity toCircle, double radius, double rotation) { // compute angle - double vecx = circler.posX - toCircle.posX; - double vecz = circler.posZ - toCircle.posZ; - float rangle = (float)(Math.atan2(vecz, vecx)); + float vecx = (float)(circler.posX - toCircle.posX); + float vecz = (float)(circler.posZ - toCircle.posZ); + float rangle = org.bogdang.modifications.math.TrigMath2.atan2(vecz, vecx); // add a little, so he circles rangle += rotation; diff --git a/src/main/java/twilightforest/entity/ai/EntityTFRavenLookHelper.java b/src/main/java/twilightforest/entity/ai/EntityTFRavenLookHelper.java index fb56d6de01..a548d42421 100644 --- a/src/main/java/twilightforest/entity/ai/EntityTFRavenLookHelper.java +++ b/src/main/java/twilightforest/entity/ai/EntityTFRavenLookHelper.java @@ -12,9 +12,9 @@ public class EntityTFRavenLookHelper extends EntityLookHelper private float field_46149_b; private float field_46150_c; private boolean field_46147_d = false; - private double posX; - private double posY; - private double posZ; + private float posX; + private float posY; + private float posZ; public EntityTFRavenLookHelper(EntityLiving par1EntityLiving) { @@ -27,18 +27,18 @@ public EntityTFRavenLookHelper(EntityLiving par1EntityLiving) */ public void setLookPositionWithEntity(Entity par1Entity, float par2, float par3) { - this.posX = par1Entity.posX; + this.posX = (float)par1Entity.posX; if (par1Entity instanceof EntityLiving) { - this.posY = par1Entity.posY + (double)((EntityLiving)par1Entity).getEyeHeight(); + this.posY = (float)par1Entity.posY + ((EntityLiving)par1Entity).getEyeHeight(); } else { - this.posY = (par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) / 2.0D; + this.posY = (float)(par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) / 2.0F; } - this.posZ = par1Entity.posZ; + this.posZ = (float)par1Entity.posZ; this.field_46149_b = par2; this.field_46150_c = par3; this.field_46147_d = true; @@ -50,9 +50,9 @@ public void setLookPositionWithEntity(Entity par1Entity, float par2, float par3) @Override public void setLookPosition(double par1, double par3, double par5, float par7, float par8) { - this.posX = par1; - this.posY = par3; - this.posZ = par5; + this.posX = (float)par1; + this.posY = (float)par3; + this.posZ = (float)par5; this.field_46149_b = par7; this.field_46150_c = par8; this.field_46147_d = true; @@ -69,12 +69,12 @@ public void onUpdateLook() if (this.field_46147_d) { this.field_46147_d = false; - double var1 = this.posX - this.entity.posX; - double var3 = this.posY - (this.entity.posY + this.entity.getEyeHeight()); - double var5 = this.posZ - this.entity.posZ; - double var7 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); - float var9 = (float)(Math.atan2(var5, var1) * 180.0D / Math.PI) - 30.0F; - float var10 = (float)(-(Math.atan2(var3, var7) * 180.0D / Math.PI)); + float var1 = this.posX - (float)this.entity.posX; + float var3 = this.posY - (float)(this.entity.posY + this.entity.getEyeHeight()); + float var5 = this.posZ - (float)this.entity.posZ; + float var7 = MathHelper.sqrt_float(var1 * var1 + var5 * var5); + float var9 = (org.bogdang.modifications.math.TrigMath2.atan2(var5, var1) * 180.0F / (float)Math.PI) - 30.0F; + float var10 = (-(org.bogdang.modifications.math.TrigMath2.atan2(var3, var7) * 180.0F / (float)Math.PI)); this.entity.rotationPitch = this.updateRotation(this.entity.rotationPitch, var10, this.field_46150_c); this.entity.rotationYawHead = this.updateRotation(this.entity.rotationYawHead, var9, this.field_46149_b); } diff --git a/src/main/java/twilightforest/entity/boss/EntityTFFallingIce.java b/src/main/java/twilightforest/entity/boss/EntityTFFallingIce.java index b97f4abbf5..a9729e2bfd 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFFallingIce.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFFallingIce.java @@ -25,8 +25,8 @@ public EntityTFFallingIce(World par1World) { super(par1World); this.setSize(2.98F, 2.98F); - this.hurtAmount = 10; - this.hurtMax = 30; + this.hurtAmount = 10.0f*1.5f; + this.hurtMax = (int)(30*1.5); } public EntityTFFallingIce(World par1World, int x, int y, int z) { diff --git a/src/main/java/twilightforest/entity/boss/EntityTFHydra.java b/src/main/java/twilightforest/entity/boss/EntityTFHydra.java index 9949562da9..41232313db 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFHydra.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFHydra.java @@ -37,13 +37,13 @@ public class EntityTFHydra extends EntityLiving implements IBossDisplayData, IEn private static int TICKS_BEFORE_HEALING = 1000; private static int HEAD_RESPAWN_TICKS = 100; - private static int HEAD_MAX_DAMAGE = 120; - private static float ARMOR_MULTIPLIER = 8.0F; - private static int MAX_HEALTH = 360; + private static int HEAD_MAX_DAMAGE = (int)(120*1.5); + private static float ARMOR_MULTIPLIER = 8.0F*1.5F; + private static int MAX_HEALTH = (int)(360*1.5); private static float HEADS_ACTIVITY_FACTOR = 0.3F; - private static int SECONDARY_FLAME_CHANCE = 10; - private static int SECONDARY_MORTAR_CHANCE = 16; + private static int SECONDARY_FLAME_CHANCE = (int)(10*1.5); + private static int SECONDARY_MORTAR_CHANCE = (int)(16*1.5); private static final int DATA_SPAWNHEADS = 17; private static final int DATA_BOSSHEALTH = 18; @@ -113,8 +113,8 @@ public EntityTFHydra(World world, double x, double y, double z) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(MAX_HEALTH); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(MAX_HEALTH+twilightforest.TwilightForestMod.Scatter.nextInt(MAX_HEALTH/3)-twilightforest.TwilightForestMod.Scatter.nextInt(MAX_HEALTH/3)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.28D*1.5D); // movement speed } @@ -154,7 +154,7 @@ public void onLivingUpdate() // update health if (!this.worldObj.isRemote) { - this.dataWatcher.updateObject(DATA_BOSSHEALTH, Integer.valueOf((int)this.getHealth())); + this.dataWatcher.updateObject(DATA_BOSSHEALTH, (int)this.getHealth()); } else { @@ -269,16 +269,18 @@ else if (this.isClientWorld()) double dx, dy, dz; // body goes behind the actual position of the hydra - angle = (((renderYawOffset + 180) * 3.141593F) / 180F); + angle = (((renderYawOffset + 180) * (float)Math.PI) / 180F); - dx = posX - MathHelper.sin(angle) * 3.0; + float msin = MathHelper.sin(angle); + dx = posX - msin * 3.0; dy = posY + 0.1; - dz = posZ + MathHelper.cos(angle) * 3.0; + float mcos = MathHelper.cos(angle); + dz = posZ + mcos * 3.0; body.setPosition(dx, dy, dz); - dx = posX - MathHelper.sin(angle) * 10.5; + dx = posX - msin * 10.5; dy = posY + 0.1; - dz = posZ + MathHelper.cos(angle) * 10.5; + dz = posZ + mcos * 10.5; tail.setPosition(dx, dy, dz); //worldObj.spawnParticle("mobSpell", body.posX, body.posY, body.posZ, 0.2, 0.2, 0.2); @@ -326,8 +328,8 @@ else if (this.isClientWorld()) protected void entityInit() { super.entityInit(); - dataWatcher.addObject(DATA_SPAWNHEADS, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(DATA_BOSSHEALTH, new Integer(MAX_HEALTH)); + dataWatcher.addObject(DATA_SPAWNHEADS, (byte)0); + this.dataWatcher.addObject(DATA_BOSSHEALTH, (MAX_HEALTH)); } @@ -340,11 +342,11 @@ public void setSpawnHeads(boolean flag) { if (flag) { - dataWatcher.updateObject(DATA_SPAWNHEADS, Byte.valueOf((byte)127)); + dataWatcher.updateObject(DATA_SPAWNHEADS, ((byte)127)); } else { - dataWatcher.updateObject(DATA_SPAWNHEADS, Byte.valueOf((byte)0)); + dataWatcher.updateObject(DATA_SPAWNHEADS, (byte)0); } } diff --git a/src/main/java/twilightforest/entity/boss/EntityTFHydraHead.java b/src/main/java/twilightforest/entity/boss/EntityTFHydraHead.java index 096b4fbe70..a42306045e 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFHydraHead.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFHydraHead.java @@ -39,8 +39,8 @@ protected void onDeathUpdate() { protected void entityInit() { super.entityInit(); - dataWatcher.addObject(18, Byte.valueOf((byte)0)); - dataWatcher.addObject(19, Byte.valueOf((byte)0)); + dataWatcher.addObject(18, (byte)0); + dataWatcher.addObject(19, (byte)0); } @@ -69,13 +69,13 @@ public void setMouthOpen(float openness) int openByte = Math.round(openness * 255); openByte &= 0xFF; - dataWatcher.updateObject(18, Byte.valueOf((byte)openByte)); + dataWatcher.updateObject(18, ((byte)openByte)); } public void setState(int state) { state &= 0xFF; - dataWatcher.updateObject(19, Byte.valueOf((byte)state)); + dataWatcher.updateObject(19, ((byte)state)); } } diff --git a/src/main/java/twilightforest/entity/boss/EntityTFHydraMortar.java b/src/main/java/twilightforest/entity/boss/EntityTFHydraMortar.java index 43ba8eae74..97d9de0130 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFHydraMortar.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFHydraMortar.java @@ -16,8 +16,8 @@ public class EntityTFHydraMortar extends EntityThrowable { - private static final int BURN_FACTOR = 5; - private static final int DIRECT_DAMAGE = 18; + private static final int BURN_FACTOR = (int)(5*1.5); + private static final int DIRECT_DAMAGE = (int)(18*1.5); public EntityLivingBase playerReflects = null; diff --git a/src/main/java/twilightforest/entity/boss/EntityTFIceBomb.java b/src/main/java/twilightforest/entity/boss/EntityTFIceBomb.java index 7f6b5c1443..722a55aa1f 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFIceBomb.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFIceBomb.java @@ -168,9 +168,9 @@ private void hitNearbyEntities() { worldObj.setBlock(ix, iy + 1, iz, Blocks.ice); } else { - entity.attackEntityFrom(DamageSource.magic, 1); - int chillLevel = 2; - ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20 * 5, chillLevel, true)); + entity.attackEntityFrom(DamageSource.magic, 1*1.5f); + int chillLevel = (int)(2*1.5); + ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, (int)(20 * 5 *1.5), chillLevel, true)); } } diff --git a/src/main/java/twilightforest/entity/boss/EntityTFIceCrystal.java b/src/main/java/twilightforest/entity/boss/EntityTFIceCrystal.java index 407e8c31cb..72e3e99f43 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFIceCrystal.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFIceCrystal.java @@ -43,9 +43,9 @@ public EntityTFIceCrystal(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(15/3)-twilightforest.TwilightForestMod.Scatter.nextInt(15/3)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D*1.5D); } diff --git a/src/main/java/twilightforest/entity/boss/EntityTFKnightPhantom.java b/src/main/java/twilightforest/entity/boss/EntityTFKnightPhantom.java index f63fc676e1..ba84a136d4 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFKnightPhantom.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFKnightPhantom.java @@ -32,8 +32,8 @@ public class EntityTFKnightPhantom extends EntityFlying implements IMob { - private static final float CIRCLE_SMALL_RADIUS = 2.5F; - private static final float CIRCLE_LARGE_RADIUS = 8.5F; + private static final float CIRCLE_SMALL_RADIUS = 2.5F*1.5F; + private static final float CIRCLE_LARGE_RADIUS = 8.5F*1.5F; private static final int FLAG_CHARGING = 17; int number; int ticksProgress; @@ -48,6 +48,7 @@ public class EntityTFKnightPhantom extends EntityFlying implements IMob private int chargePosZ; public enum Formation { HOVER, LARGE_CLOCKWISE, SMALL_CLOCKWISE, LARGE_ANTICLOCKWISE, SMALL_ANTICLOCKWISE, CHARGE_PLUSX, CHARGE_MINUSX, CHARGE_PLUSZ, CHARGE_MINUSZ, WAITING_FOR_LEADER, ATTACK_PLAYER_START, ATTACK_PLAYER_ATTACK}; + public static final Formation[] FVALUES = Formation.values(); public EntityTFKnightPhantom(World par1World) { super(par1World); @@ -73,7 +74,7 @@ public EntityTFKnightPhantom(World par1World) { protected void entityInit() { super.entityInit(); - dataWatcher.addObject(FLAG_CHARGING, Byte.valueOf((byte)0)); + dataWatcher.addObject(FLAG_CHARGING, (byte)0); } /** @@ -83,9 +84,9 @@ protected void entityInit() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(35.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(35.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(18)-twilightforest.TwilightForestMod.Scatter.nextInt(18)); // max health this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); // initialize this value - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D*1.5D); // attack damage } /** @@ -343,7 +344,7 @@ public boolean attackEntityAsMob(Entity par1Entity) i += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)par1Entity); } - boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), f); + boolean flag = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), f*1.1F); if (flag) { @@ -361,10 +362,10 @@ public boolean attackEntityAsMob(Entity par1Entity) par1Entity.setFire(j * 4); } - if (par1Entity instanceof EntityLivingBase) + /*if (par1Entity instanceof EntityLivingBase) { //EnchantmentThorns.func_151367_b(this, (EntityLivingBase)par1Entity, this.rand); - } + }*/ } return flag; @@ -391,7 +392,7 @@ private float getAttackDamage() { * @param targetedEntity */ protected void launchAxeAt(Entity targetedEntity) { - float bodyFacingAngle = ((renderYawOffset * 3.141593F) / 180F); + float bodyFacingAngle = ((renderYawOffset * (float)Math.PI) / 180F); double sx = posX + (MathHelper.cos(bodyFacingAngle) * 1); double sy = posY + (height * 0.82); double sz = posZ + (MathHelper.sin(bodyFacingAngle) * 1); @@ -418,7 +419,7 @@ protected void launchPicks() for (int i = 0; i < 8; i++) { - float throwAngle = i * 3.14159165F / 4F; + float throwAngle = i * (float)Math.PI / 4F; double sx = posX + (MathHelper.cos(throwAngle) * 1); @@ -559,13 +560,13 @@ private List getNearbyKnights() { protected void pickRandomFormation() { switch (rand.nextInt(8)) { - case 0: - currentFormation = Formation.SMALL_CLOCKWISE; - break; + //case 0: + //currentFormation = Formation.SMALL_CLOCKWISE; + //break; case 1: - currentFormation = Formation.SMALL_ANTICLOCKWISE; + //currentFormation = Formation.SMALL_ANTICLOCKWISE; //currentFormation = Formation.LARGE_ANTICLOCKWISE; - break; + //break; case 2: currentFormation = Formation.SMALL_ANTICLOCKWISE; break; @@ -581,6 +582,7 @@ protected void pickRandomFormation() { case 6: currentFormation = Formation.CHARGE_MINUSZ; break; + case 0: case 7: currentFormation = Formation.SMALL_CLOCKWISE; //currentFormation = Formation.LARGE_CLOCKWISE; @@ -670,11 +672,11 @@ public void setChargingAtPlayer(boolean flag) { if (flag) { - dataWatcher.updateObject(FLAG_CHARGING, Byte.valueOf((byte)127)); + dataWatcher.updateObject(FLAG_CHARGING, ((byte)127)); } else { - dataWatcher.updateObject(FLAG_CHARGING, Byte.valueOf((byte)0)); + dataWatcher.updateObject(FLAG_CHARGING, (byte)0); } } @@ -699,7 +701,7 @@ protected String getDeathSound() private void switchToFormationByNumber(int formationNumber) { - currentFormation = Formation.values()[formationNumber]; + currentFormation = FVALUES[formationNumber]; this.ticksProgress = 0; } @@ -763,10 +765,10 @@ public int getMaxTicksForFormation() private Vec3 getDestination() { - if (!this.hasHome()) + /*if (!this.hasHome()) { // hmmm - } + }*/ switch (currentFormation) { @@ -820,7 +822,7 @@ private Vec3 getMoveAcrossPosition(boolean plus, boolean alongX) { double dx = this.getHomePosition().posX + (alongX ? offset0 : offset1); - double dy = this.getHomePosition().posY + Math.cos(this.ticksProgress / 7F + this.getNumber()); + double dy = this.getHomePosition().posY + org.bogdang.modifications.math.MathHelperLite.cos(this.ticksProgress / 7F + this.getNumber()); double dz = this.getHomePosition().posZ + (alongX ? offset1 : offset0); return Vec3.createVectorHelper(dx, dy, dz); } @@ -835,9 +837,9 @@ protected Vec3 getCirclePosition(float distance, boolean clockwise) { angle += (60F * this.getNumber()); - double dx = this.getHomePosition().posX + Math.cos((angle) * Math.PI / 180.0D) * distance; - double dy = this.getHomePosition().posY + Math.cos(this.ticksProgress / 7F + this.getNumber()); - double dz = this.getHomePosition().posZ + Math.sin((angle) * Math.PI / 180.0D) * distance; + double dx = this.getHomePosition().posX + org.bogdang.modifications.math.MathHelperLite.cos((angle) * Math.PI / 180.0D) * distance; + double dy = this.getHomePosition().posY + org.bogdang.modifications.math.MathHelperLite.cos(this.ticksProgress / 7F + this.getNumber()); + double dz = this.getHomePosition().posZ + org.bogdang.modifications.math.MathHelperLite.sin((angle) * Math.PI / 180.0D) * distance; return Vec3.createVectorHelper(dx, dy, dz); } @@ -845,7 +847,7 @@ private Vec3 getHoverPosition(float distance) { // bound this by distance so we don't hover in walls if we get knocked into them double dx = this.lastTickPosX; - double dy = this.getHomePosition().posY + Math.cos(this.ticksProgress / 7F + this.getNumber()); + double dy = this.getHomePosition().posY + org.bogdang.modifications.math.MathHelperLite.cos(this.ticksProgress / 7F + this.getNumber()); double dz = this.lastTickPosZ; // let's just bound this by 2D distance @@ -868,7 +870,7 @@ private Vec3 getHoverPosition(float distance) { private Vec3 getLoiterPosition() { double dx = this.getHomePosition().posX; - double dy = this.getHomePosition().posY + Math.cos(this.ticksProgress / 7F + this.getNumber()); + double dy = this.getHomePosition().posY + org.bogdang.modifications.math.MathHelperLite.cos(this.ticksProgress / 7F + this.getNumber()); double dz = this.getHomePosition().posZ; return Vec3.createVectorHelper(dx, dy, dz); } diff --git a/src/main/java/twilightforest/entity/boss/EntityTFLich.java b/src/main/java/twilightforest/entity/boss/EntityTFLich.java index ae4b66581c..04fba7c32d 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFLich.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFLich.java @@ -27,6 +27,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; import twilightforest.TFFeature; import twilightforest.entity.EntityTFSwarmSpider; import twilightforest.item.TFItems; @@ -49,11 +50,11 @@ public class EntityTFLich extends EntityMob implements IBossDisplayData { EntityTFLich masterLich; private static final ItemStack heldItems[] = {new ItemStack(TFItems.scepterTwilight, 1), new ItemStack(TFItems.scepterZombie, 1), new ItemStack(Items.golden_sword, 1)}; - public static final int MAX_SHADOW_CLONES = 2; - public static final int INITIAL_SHIELD_STRENGTH = 5; - public static final int MAX_ACTIVE_MINIONS = 3; - public static final int INITIAL_MINIONS_TO_SUMMON = 9; - public static final int MAX_HEALTH = 100; + public static final int MAX_SHADOW_CLONES = (int)(2*1.5); + public static final int INITIAL_SHIELD_STRENGTH = (int)(5*1.5); + public static final int MAX_ACTIVE_MINIONS = (int)(3*1.5); + public static final int INITIAL_MINIONS_TO_SUMMON = (int)(9*1.5); + public static final int MAX_HEALTH = (int)(100*1.5); /** @@ -95,11 +96,11 @@ public EntityTFLich(World world, EntityTFLich otherLich) { protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(DATA_ISCLONE, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(DATA_SHIELDSTRENGTH, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(DATA_MINIONSLEFT, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(DATA_BOSSHEALTH, new Integer(EntityTFLich.MAX_HEALTH)); - this.dataWatcher.addObject(DATA_ATTACKTYPE, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(DATA_ISCLONE, (byte)0); + this.dataWatcher.addObject(DATA_SHIELDSTRENGTH, (byte)0); + this.dataWatcher.addObject(DATA_MINIONSLEFT, (byte)0); + this.dataWatcher.addObject(DATA_BOSSHEALTH, (EntityTFLich.MAX_HEALTH)); + this.dataWatcher.addObject(DATA_ATTACKTYPE, (byte)0); } @@ -111,9 +112,9 @@ protected void entityInit() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(MAX_HEALTH); // max health - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); // attack damage - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.800000011920929D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(MAX_HEALTH+twilightforest.TwilightForestMod.Scatter.nextInt(MAX_HEALTH/3)-twilightforest.TwilightForestMod.Scatter.nextInt(MAX_HEALTH/3)); // max health + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D*1.5D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.800000011920929D*1.5D); // movement speed } @@ -248,7 +249,7 @@ else if (getMinionsToSummon() > 0) { @Override public void onLivingUpdate() { // determine the hand position - float angle = ((renderYawOffset * 3.141593F) / 180F); + float angle = ((renderYawOffset * (float)Math.PI) / 180F); double dx = posX + (MathHelper.cos(angle) * 0.65); double dy = posY + (height * 0.94); @@ -290,7 +291,7 @@ public void onLivingUpdate() { // update health if (!this.worldObj.isRemote) { - this.dataWatcher.updateObject(DATA_BOSSHEALTH, Integer.valueOf((int)this.getHealth())); + this.dataWatcher.updateObject(DATA_BOSSHEALTH, (int)this.getHealth()); } super.onLivingUpdate(); @@ -504,7 +505,7 @@ else if (f < 20F && canEntityBeSeen(targetedEntity)) { * @param targetedEntity */ protected void launchBoltAt(Entity targetedEntity) { - float bodyFacingAngle = ((renderYawOffset * 3.141593F) / 180F); + float bodyFacingAngle = ((renderYawOffset * (float)Math.PI) / 180F); double sx = posX + (MathHelper.cos(bodyFacingAngle) * 0.65); double sy = posY + (height * 0.82); double sz = posZ + (MathHelper.sin(bodyFacingAngle) * 0.65); @@ -527,7 +528,7 @@ protected void launchBoltAt(Entity targetedEntity) { * @param targetedEntity */ protected void launchBombAt(Entity targetedEntity) { - float bodyFacingAngle = ((renderYawOffset * 3.141593F) / 180F); + float bodyFacingAngle = ((renderYawOffset * (float)Math.PI) / 180F); double sx = posX + (MathHelper.cos(bodyFacingAngle) * 0.65); double sy = posY + (height * 0.82); double sz = posZ + (MathHelper.sin(bodyFacingAngle) * 0.65); @@ -898,9 +899,9 @@ protected void makeTeleportTrail(double srcX, double srcY, double srcZ, double d float f = (rand.nextFloat() - 0.5F) * 0.2F; float f1 = (rand.nextFloat() - 0.5F) * 0.2F; float f2 = (rand.nextFloat() - 0.5F) * 0.2F; - double tx = srcX + (destX - srcX) * trailFactor + (rand.nextDouble() - 0.5D) * width * 2D; - double ty = srcY + (destY - srcY) * trailFactor + rand.nextDouble() * height; - double tz = srcZ + (destZ - srcZ) * trailFactor + (rand.nextDouble() - 0.5D) * width * 2D; + double tx = srcX + (destX - srcX) * trailFactor + (rand.nextFloat() - 0.5D) * width * 2D; + double ty = srcY + (destY - srcY) * trailFactor + rand.nextFloat() * height; + double tz = srcZ + (destZ - srcZ) * trailFactor + (rand.nextFloat() - 0.5D) * width * 2D; worldObj.spawnParticle("spell", tx, ty, tz, f, f1, f2); } } @@ -960,11 +961,11 @@ public void setShadowClone(boolean par1) if (par1) { - this.dataWatcher.updateObject(DATA_ISCLONE, Byte.valueOf((byte)(var2 | 2))); + this.dataWatcher.updateObject(DATA_ISCLONE, ((byte)(var2 | 2))); } else { - this.dataWatcher.updateObject(DATA_ISCLONE, Byte.valueOf((byte)(var2 & -3))); + this.dataWatcher.updateObject(DATA_ISCLONE, ((byte)(var2 & -3))); } } @@ -973,7 +974,7 @@ public byte getShieldStrength() { } public void setShieldStrength(int shieldStrength) { - this.dataWatcher.updateObject(DATA_SHIELDSTRENGTH, Byte.valueOf((byte) shieldStrength)); + this.dataWatcher.updateObject(DATA_SHIELDSTRENGTH, ((byte) shieldStrength)); } public byte getMinionsToSummon() { @@ -981,7 +982,7 @@ public byte getMinionsToSummon() { } public void setMinionsToSummon(int minionsToSummon) { - this.dataWatcher.updateObject(DATA_MINIONSLEFT, Byte.valueOf((byte) minionsToSummon)); + this.dataWatcher.updateObject(DATA_MINIONSLEFT, ((byte) minionsToSummon)); } public byte getNextAttackType() { @@ -989,7 +990,7 @@ public byte getNextAttackType() { } public void setNextAttackType(int attackType) { - this.dataWatcher.updateObject(DATA_ATTACKTYPE, Byte.valueOf((byte) attackType)); + this.dataWatcher.updateObject(DATA_ATTACKTYPE, ((byte) attackType)); } /** diff --git a/src/main/java/twilightforest/entity/boss/EntityTFLichBolt.java b/src/main/java/twilightforest/entity/boss/EntityTFLichBolt.java index 1880937bdb..7513c76822 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFLichBolt.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFLichBolt.java @@ -46,9 +46,9 @@ public void onUpdate() { public void makeTrail() { for (int i = 0; i < 5; i++) { - double dx = posX + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dy = posY + 0.5 * (rand.nextDouble() - rand.nextDouble()); - double dz = posZ + 0.5 * (rand.nextDouble() - rand.nextDouble()); + double dx = posX + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dy = posY + 0.5 * (rand.nextFloat() - rand.nextFloat()); + double dz = posZ + 0.5 * (rand.nextFloat() - rand.nextFloat()); double s1 = ((rand.nextFloat() * 0.5F) + 0.5F) * 0.17F; double s2 = ((rand.nextFloat() * 0.5F) + 0.5F) * 0.80F; @@ -135,12 +135,12 @@ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { boolean passThrough = false; // pass through other lich bolts - if (par1MovingObjectPosition.entityHit != null && (par1MovingObjectPosition.entityHit instanceof EntityTFLichBolt || par1MovingObjectPosition.entityHit instanceof EntityTFLichBomb)) { + if ((par1MovingObjectPosition.entityHit instanceof EntityTFLichBolt || par1MovingObjectPosition.entityHit instanceof EntityTFLichBomb)) { passThrough = true; } // only damage living things - if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit instanceof EntityLivingBase) + if (par1MovingObjectPosition.entityHit instanceof EntityLivingBase) { if (par1MovingObjectPosition.entityHit instanceof EntityTFLich) { EntityTFLich lich = (EntityTFLich)par1MovingObjectPosition.entityHit; @@ -149,16 +149,16 @@ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { } } // if we're not set to pass, damage what we hit - if (!passThrough && par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, this.getThrower()), 6)) + if (!passThrough) { - ; + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, this.getThrower()), 6); } } // if we don't pass through, then stop and die if (!passThrough) { for (int i = 0; i < 8; ++i) { - this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(Items.ender_pearl), this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextDouble() * 0.2D, rand.nextGaussian() * 0.05D); + this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(Items.ender_pearl), this.posX, this.posY, this.posZ, rand.nextGaussian() * 0.05D, rand.nextFloat() * 0.2D, rand.nextGaussian() * 0.05D); } if (!this.worldObj.isRemote) diff --git a/src/main/java/twilightforest/entity/boss/EntityTFLichBomb.java b/src/main/java/twilightforest/entity/boss/EntityTFLichBomb.java index dc83eb42a9..0961aa8ba8 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFLichBomb.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFLichBomb.java @@ -41,9 +41,9 @@ public void onUpdate() { public void makeTrail() { for (int i = 0; i < 1; i++) { - double sx = 0.5 * (rand.nextDouble() - rand.nextDouble()) + this.motionX; - double sy = 0.5 * (rand.nextDouble() - rand.nextDouble()) + this.motionY; - double sz = 0.5 * (rand.nextDouble() - rand.nextDouble()) + this.motionZ; + double sx = 0.5 * (rand.nextFloat() - rand.nextFloat()) + this.motionX; + double sy = 0.5 * (rand.nextFloat() - rand.nextFloat()) + this.motionY; + double sz = 0.5 * (rand.nextFloat() - rand.nextFloat()) + this.motionZ; double dx = posX + sx; diff --git a/src/main/java/twilightforest/entity/boss/EntityTFLichMinion.java b/src/main/java/twilightforest/entity/boss/EntityTFLichMinion.java index 48a5ecebf4..b3e67742ef 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFLichMinion.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFLichMinion.java @@ -14,6 +14,7 @@ import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import twilightforest.TFAchievementPage; +import twilightforest.TwilightForestMod; @@ -47,14 +48,14 @@ public EntityTFLichMinion(World par1World, EntityTFLich entityTFLich) { public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { EntityLivingBase prevTarget = getAttackTarget(); - if (super.attackEntityFrom(par1DamageSource, par2)) { + if (super.attackEntityFrom(par1DamageSource, par2*1.5f)) { if (par1DamageSource.getEntity() instanceof EntityTFLich) { // return to previous target setAttackTarget(prevTarget); setRevengeTarget(prevTarget); // but speed up - addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 4)); - addPotionEffect(new PotionEffect(Potion.damageBoost.id, 200, 1)); + addPotionEffect(new PotionEffect(Potion.moveSpeed.id, (int)(200*1.5), 4)); + addPotionEffect(new PotionEffect(Potion.damageBoost.id, (int)(200*1.5), 1)); } return true; } @@ -104,7 +105,7 @@ private void findNewMaster() { @Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); - if (par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { + if (worldObj.provider.dimensionId == TwilightForestMod.dimensionID && par1DamageSource.getSourceOfDamage() instanceof EntityPlayer) { ((EntityPlayer)par1DamageSource.getSourceOfDamage()).triggerAchievement(TFAchievementPage.twilightHunter); } } diff --git a/src/main/java/twilightforest/entity/boss/EntityTFMinoshroom.java b/src/main/java/twilightforest/entity/boss/EntityTFMinoshroom.java index b4813c1da2..e7a64916cc 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFMinoshroom.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFMinoshroom.java @@ -27,7 +27,7 @@ public EntityTFMinoshroom(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(120.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(120.0D*1.5F+twilightforest.TwilightForestMod.Scatter.nextInt(60)-twilightforest.TwilightForestMod.Scatter.nextInt(60)); // max health } /** diff --git a/src/main/java/twilightforest/entity/boss/EntityTFNaga.java b/src/main/java/twilightforest/entity/boss/EntityTFNaga.java index fd278fc451..f0b34b3d1f 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFNaga.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFNaga.java @@ -34,7 +34,7 @@ public class EntityTFNaga extends EntityMob implements IMob, IBossDisplayData, IEntityMultiPart { - private static int TICKS_BEFORE_HEALING = 600; + private static int TICKS_BEFORE_HEALING = (int)(600*0.75); private static int MAX_SEGMENTS = 12; @@ -107,25 +107,25 @@ public float getMaxHealthPerDifficulty() { if (worldObj != null) { if (worldObj.difficultySetting == EnumDifficulty.EASY) { - return 120; + return 180+twilightforest.TwilightForestMod.Scatter.nextInt(60)-twilightforest.TwilightForestMod.Scatter.nextInt(60); } else if (worldObj.difficultySetting == EnumDifficulty.NORMAL) { - return 200; + return 300+twilightforest.TwilightForestMod.Scatter.nextInt(100)-twilightforest.TwilightForestMod.Scatter.nextInt(100); } else if (worldObj.difficultySetting == EnumDifficulty.HARD) { - return 250; + return 375+twilightforest.TwilightForestMod.Scatter.nextInt(120)-twilightforest.TwilightForestMod.Scatter.nextInt(120); } else { //???? - return 200; + return 300+twilightforest.TwilightForestMod.Scatter.nextInt(100)-twilightforest.TwilightForestMod.Scatter.nextInt(100); } } else { // why is the world null? - return 200; + return 300+twilightforest.TwilightForestMod.Scatter.nextInt(100)-twilightforest.TwilightForestMod.Scatter.nextInt(100); } } @@ -145,9 +145,9 @@ protected boolean canDespawn() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getMaxHealthPerDifficulty()); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(2.0D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); // attack damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getMaxHealthPerDifficulty()*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt((int)(getMaxHealthPerDifficulty()*0.5f))-twilightforest.TwilightForestMod.Scatter.nextInt((int)(getMaxHealthPerDifficulty()*0.5f))); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(2.0D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D*1.5D); // attack damage } @@ -265,7 +265,7 @@ public void onUpdate() { // // if (!this.worldObj.isRemote) // { -// this.dataWatcher.updateObject(DATA_BOSSHEALTH, Integer.valueOf((int)this.getHealth())); +// this.dataWatcher.updateObject(DATA_BOSSHEALTH, (int)this.getHealth()); // } // else // { @@ -397,14 +397,14 @@ else if (!targetEntity.isEntityAlive()) isJumping = false; if(vec3d != null) { - double d1 = vec3d.xCoord - posX; - double d2 = vec3d.zCoord - posZ; + float d1 = (float)(vec3d.xCoord - posX); + float d2 = (float)(vec3d.zCoord - posZ); - double dist = MathHelper.sqrt_double(d1 * d1 + d2 * d2); + float dist = MathHelper.sqrt_float(d1 * d1 + d2 * d2); int i = MathHelper.floor_double(boundingBox.minY + 0.5D); double d3 = vec3d.yCoord - i; - float f2 = (float)((Math.atan2(d2, d1) * 180D) / 3.1415927410125732D) - 90F; + float f2 = ((org.bogdang.modifications.math.TrigMath2.atan2(d2, d1) * 180F) / (float)Math.PI) - 90F; float f3 = f2 - rotationYaw; moveForward = getMoveSpeed(); this.setAIMoveSpeed(0.5f); @@ -412,7 +412,7 @@ else if (!targetEntity.isEntityAlive()) //this.moveForward = (float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getBaseValue(); // slither! - if (dist > 4 && chargeCount == 0) { + if (dist > 4f && chargeCount == 0) { moveStrafing = MathHelper.cos(this.ticksExisted * 0.3F) * getMoveSpeed() * 0.6F; } @@ -750,9 +750,9 @@ public boolean canBePushed() { protected Vec3 findCirclePoint(Entity toCircle, double radius, double rotation) { // compute angle - double vecx = posX - toCircle.posX; - double vecz = posZ - toCircle.posZ; - float rangle = (float)(Math.atan2(vecz, vecx)); + float vecx = (float)(posX - toCircle.posX); + float vecz = (float)(posZ - toCircle.posZ); + float rangle = (org.bogdang.modifications.math.TrigMath2.atan2(vecz, vecx)); // add a little, so he circles (clockwise) rangle += clockwise ? rotation : -rotation; @@ -849,7 +849,7 @@ protected void attackEntity(Entity toAttack, float f) if (getMoveSpeed() > 0.8) { // charging, apply extra pushback - toAttack.addVelocity(-MathHelper.sin((rotationYaw * 3.141593F) / 180F) * 1.0F, 0.10000000000000001D, MathHelper.cos((rotationYaw * 3.141593F) / 180F) * 1.0F); + toAttack.addVelocity(-MathHelper.sin((rotationYaw * (float)Math.PI) / 180F) * 1.0F, 0.10000000000000001D, MathHelper.cos((rotationYaw * (float)Math.PI) / 180F) * 1.0F); } } } @@ -1056,7 +1056,7 @@ protected void moveSegments() { // also weight the position so that the segments straighten out a little bit, and the front ones straighten more - float angle = (((leader.rotationYaw + 180) * 3.141593F) / 180F); + float angle = (((leader.rotationYaw + 180) * (float)Math.PI) / 180F); double straightenForce = 0.05D + (1.0 / (float)(i + 1)) * 0.5D; @@ -1097,14 +1097,14 @@ protected void moveSegments() { body[i].motionY = f * diff.yCoord; body[i].motionZ = f * diff.zCoord; - double distance = (double)MathHelper.sqrt_double(diff.xCoord * diff.xCoord + diff.zCoord * diff.zCoord); + float distance = MathHelper.sqrt_double(diff.xCoord * diff.xCoord + diff.zCoord * diff.zCoord); if (i == 0) { diff.yCoord -= 0.15D; } - body[i].setRotation((float) (Math.atan2(diff.zCoord, diff.xCoord) * 180.0D / Math.PI) + 90.0F, -(float)(Math.atan2(diff.yCoord, distance) * 180.0D / Math.PI)); + body[i].setRotation( (org.bogdang.modifications.math.TrigMath2.atan2((float)diff.zCoord, (float)diff.xCoord) * 180.0F / (float)Math.PI) + 90.0F, -(org.bogdang.modifications.math.TrigMath2.atan2((float)diff.yCoord, (float)distance) * 180.0F / (float)Math.PI)); diff --git a/src/main/java/twilightforest/entity/boss/EntityTFSnowQueen.java b/src/main/java/twilightforest/entity/boss/EntityTFSnowQueen.java index c9379d38b6..5f97738bef 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFSnowQueen.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFSnowQueen.java @@ -42,14 +42,15 @@ public class EntityTFSnowQueen extends EntityMob implements IBossDisplayData, IEntityMultiPart, IBreathAttacker { - private static final int MAX_SUMMONS = 6; + private static final int MAX_SUMMONS = (int)(6*1.5); private static final int BEAM_FLAG = 21; private static final int PHASE_FLAG = 22; - private static final int MAX_DAMAGE_WHILE_BEAMING = 25; - private static final float BREATH_DAMAGE = 4.0F; + private static final int MAX_DAMAGE_WHILE_BEAMING = (int)(25*1.5); + private static final float BREATH_DAMAGE = 4.0F*1.5F; public enum Phase { SUMMON, DROP, BEAM }; + public static final Phase[] PVALUES = Phase.values(); public Entity[] iceArray; @@ -96,17 +97,17 @@ public boolean canBePushed() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(7.0D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D*1.5); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(7.0D*1.5); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D*1.5); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(100)-twilightforest.TwilightForestMod.Scatter.nextInt(100)); } protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(BEAM_FLAG, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(PHASE_FLAG, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(BEAM_FLAG, (byte)0); + this.dataWatcher.addObject(PHASE_FLAG, (byte)0); } /** @@ -206,8 +207,8 @@ public void onLivingUpdate() double dy = 0;//look.yCoord; double dz = look.zCoord; - double spread = 2 + this.getRNG().nextDouble() * 2.5; - double velocity = 2.0 + this.getRNG().nextDouble() * 0.15; + double spread = 2 + this.getRNG().nextFloat() * 2.5; + double velocity = 2.0 + this.getRNG().nextFloat() * 0.15; // beeeam dx += this.getRNG().nextGaussian() * 0.0075D * spread; @@ -432,8 +433,8 @@ private float getIceShieldAngle(int i) { */ public Vec3 getIceShieldPosition(float angle, float distance) { - double var1 = Math.cos((angle) * Math.PI / 180.0D) * distance; - double var3 = Math.sin((angle) * Math.PI / 180.0D) * distance; + double var1 = org.bogdang.modifications.math.MathHelperLite.cos((angle) * Math.PI / 180.0D) * distance; + double var3 = org.bogdang.modifications.math.MathHelperLite.sin((angle) * Math.PI / 180.0D) * distance; return Vec3.createVectorHelper(this.posX + var1, this.posY + this.getShieldYOffset(), this.posZ + var3); } @@ -518,17 +519,17 @@ public boolean isBreathing() { } public void setBreathing(boolean flag) { - this.getDataWatcher().updateObject(BEAM_FLAG, Byte.valueOf((byte)(flag ? 1 : 0))); + this.getDataWatcher().updateObject(BEAM_FLAG, ((byte)(flag ? 1 : 0))); } public Phase getCurrentPhase() { - return Phase.values()[this.getDataWatcher().getWatchableObjectByte(PHASE_FLAG)]; + return PVALUES[this.getDataWatcher().getWatchableObjectByte(PHASE_FLAG)]; } public void setCurrentPhase(Phase currentPhase) { - this.getDataWatcher().updateObject(PHASE_FLAG, Byte.valueOf((byte) currentPhase.ordinal())); + this.getDataWatcher().updateObject(PHASE_FLAG, ((byte) currentPhase.ordinal())); // set variables for current phase if (currentPhase == Phase.SUMMON) { @@ -676,9 +677,10 @@ public void incrementSuccessfulDrops() { @Override public void doBreathAttack(Entity target) { - if (target.attackEntityFrom(DamageSource.causeMobDamage(this), BREATH_DAMAGE)) { + target.attackEntityFrom(DamageSource.causeMobDamage(this), BREATH_DAMAGE); + /*if (target.attackEntityFrom(DamageSource.causeMobDamage(this), BREATH_DAMAGE)) { // slow target? - } + }*/ } diff --git a/src/main/java/twilightforest/entity/boss/EntityTFThrownAxe.java b/src/main/java/twilightforest/entity/boss/EntityTFThrownAxe.java index db0fc7ae81..0feb796011 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFThrownAxe.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFThrownAxe.java @@ -8,7 +8,7 @@ public class EntityTFThrownAxe extends EntityThrowable { - private static final float PROJECTILE_DAMAGE = 6; + private static final float PROJECTILE_DAMAGE = 6*1.5f; public EntityTFThrownAxe(World par1World, EntityLivingBase par2EntityLivingBase) { super(par1World, par2EntityLivingBase); diff --git a/src/main/java/twilightforest/entity/boss/EntityTFThrownPick.java b/src/main/java/twilightforest/entity/boss/EntityTFThrownPick.java index d3b6382cd0..3248a5d90a 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFThrownPick.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFThrownPick.java @@ -8,7 +8,7 @@ public class EntityTFThrownPick extends EntityThrowable { - private static final float PROJECTILE_DAMAGE = 3; + private static final float PROJECTILE_DAMAGE = 3*1.5F; public EntityTFThrownPick(World par1World, EntityLivingBase par2EntityLivingBase) { super(par1World, par2EntityLivingBase); diff --git a/src/main/java/twilightforest/entity/boss/EntityTFUrGhast.java b/src/main/java/twilightforest/entity/boss/EntityTFUrGhast.java index 0bba892f06..eff1908415 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFUrGhast.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFUrGhast.java @@ -96,15 +96,15 @@ public EntityTFUrGhast(World par1World) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250*1.5+twilightforest.TwilightForestMod.Scatter.nextInt(375/3)-twilightforest.TwilightForestMod.Scatter.nextInt(375/3)); // max health } @Override protected void entityInit() { super.entityInit(); -// this.dataWatcher.addObject(DATA_BOSSHEALTH, new Integer(this.getMaxHealth())); - this.dataWatcher.addObject(DATA_TANTRUM, Byte.valueOf((byte) 0)); +// this.dataWatcher.addObject(DATA_BOSSHEALTH, (this.getMaxHealth())); + this.dataWatcher.addObject(DATA_TANTRUM, ((byte) 0)); } /** @@ -276,9 +276,9 @@ private void spawnMinionGhastsAt(int x, int y, int z) { { EntityTFMiniGhast minion = new EntityTFMiniGhast(worldObj); - double sx = x + ((rand.nextDouble() - rand.nextDouble()) * rangeXZ); - double sy = y + (rand.nextDouble() * rangeY); - double sz = z + ((rand.nextDouble() - rand.nextDouble()) * rangeXZ); + double sx = x + ((rand.nextFloat() - rand.nextFloat()) * rangeXZ); + double sy = y + (rand.nextFloat() * rangeY); + double sz = z + ((rand.nextFloat() - rand.nextFloat()) * rangeXZ); minion.setLocationAndAngles(sx, sy, sz, this.worldObj.rand.nextFloat() * 360.0F, 0.0F); minion.makeBossMinion(); @@ -452,11 +452,11 @@ else if (!this.isAggressive && this.targetedEntity instanceof EntityPlayer) // ignore player, move normally this.isAggressive = false; this.targetedEntity = null; - this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI; + this.rotationYaw = -(org.bogdang.modifications.math.TrigMath2.atan2((float)this.motionX, (float)this.motionZ)) * 180.0F / (float)Math.PI; // changing the pitch with movement looks goofy and un-ghast-like //double dist = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotationPitch = 0;//(float) (-((Math.atan2(this.motionY, dist) * 180D) / Math.PI));; + this.rotationPitch = 0;//(float) (-((org.bogdang.modifications.math.TrigMath2.atan2(this.motionY, dist) * 180D) / Math.PI));; } @@ -471,7 +471,7 @@ else if (!this.isAggressive && this.targetedEntity instanceof EntityPlayer) if (currentAggroStatus != newAggroStatus) { - this.dataWatcher.updateObject(16, Byte.valueOf(newAggroStatus)); + this.dataWatcher.updateObject(16, newAggroStatus); } } @@ -490,7 +490,7 @@ private void doTantrumDamageEffects() { if (worldObj.canBlockSeeTheSky(dx, dy, dz)) { - player.attackEntityFrom(DamageSource.anvil, 3); + player.attackEntityFrom(DamageSource.anvil, 3*1.5f); } } @@ -508,7 +508,7 @@ private void doTantrumDamageEffects() { */ private void shedTear() { - TwilightForestMod.proxy.spawnParticle(this.worldObj, "bosstear", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0, 0, 0); + TwilightForestMod.proxy.spawnParticle(this.worldObj, "bosstear", this.posX + (this.rand.nextFloat() - 0.5D) * (double)this.width, this.posY + this.rand.nextFloat() * (double)this.height - 0.25D, this.posZ + (this.rand.nextFloat() - 0.5D) * (double)this.width, 0, 0, 0); } /** @@ -796,7 +796,7 @@ public boolean isInTantrum() */ public void setInTantrum(boolean par1) { - this.dataWatcher.updateObject(DATA_TANTRUM, par1 ? Byte.valueOf((byte)-1) : Byte.valueOf((byte)0)); + this.dataWatcher.updateObject(DATA_TANTRUM, par1 ? ((byte)-1) : (byte)0); // can we just reset this each time it is called? this.damageUntilNextPhase = 48; diff --git a/src/main/java/twilightforest/entity/boss/EntityTFUrGhastFireball.java b/src/main/java/twilightforest/entity/boss/EntityTFUrGhastFireball.java index 8bca4dedb7..b54f8e562c 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFUrGhastFireball.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFUrGhastFireball.java @@ -24,7 +24,7 @@ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { - par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 16); + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 16*1.5f); } this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, (float)this.field_92057_e, true, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); diff --git a/src/main/java/twilightforest/entity/boss/EntityTFYetiAlpha.java b/src/main/java/twilightforest/entity/boss/EntityTFYetiAlpha.java index 875546d1ef..9daa6d1f6f 100644 --- a/src/main/java/twilightforest/entity/boss/EntityTFYetiAlpha.java +++ b/src/main/java/twilightforest/entity/boss/EntityTFYetiAlpha.java @@ -85,8 +85,8 @@ protected boolean isAIEnabled() protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(RAMPAGE_FLAG, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(TIRED_FLAG, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(RAMPAGE_FLAG, (byte)0); + this.dataWatcher.addObject(TIRED_FLAG, (byte)0); } /** @@ -96,10 +96,10 @@ protected void entityInit() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D); // max health - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.38D); // movement speed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D*1.5D+twilightforest.TwilightForestMod.Scatter.nextInt(100)-twilightforest.TwilightForestMod.Scatter.nextInt(100)); // max health + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.38D*1.5D); // movement speed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D*1.5D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D*1.5D); } /** @@ -163,7 +163,7 @@ public void onLivingUpdate() { for (int i = 0; i < 20; i++) { - this.worldObj.spawnParticle("splash", this.posX + (this.rand.nextDouble() - 0.5D) * this.width * 0.5, this.posY + this.getEyeHeight(), this.posZ + (this.rand.nextDouble() - 0.5D) * this.width * 0.5, (rand.nextFloat() - 0.5F) * 0.75F, 0, (rand.nextFloat() - 0.5F) * 0.75F); + this.worldObj.spawnParticle("splash", this.posX + (this.rand.nextFloat() - 0.5D) * this.width * 0.5, this.posY + this.getEyeHeight(), this.posZ + (this.rand.nextFloat() - 0.5D) * this.width * 0.5, (rand.nextFloat() - 0.5F) * 0.75F, 0, (rand.nextFloat() - 0.5F) * 0.75F); } } @@ -171,9 +171,9 @@ public void onLivingUpdate() private void addSnowEffect(float rotation, float hgt) { - double px = 3F * Math.cos(rotation); + double px = 3F * org.bogdang.modifications.math.MathHelperLite.cos(rotation); double py = hgt % 5F; - double pz = 3F * Math.sin(rotation); + double pz = 3F * org.bogdang.modifications.math.MathHelperLite.sin(rotation); TwilightForestMod.proxy.spawnParticle(this.worldObj, "snowstuff", this.lastTickPosX + px, this.lastTickPosY + py, this.lastTickPosZ + pz, 0, 0, 0); } @@ -296,8 +296,8 @@ public Vec3 getRiderPosition() { float distance = 0.4F; - double var1 = Math.cos((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; - double var3 = Math.sin((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; + double var1 = org.bogdang.modifications.math.MathHelperLite.cos((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; + double var3 = org.bogdang.modifications.math.MathHelperLite.sin((this.rotationYaw + 90) * Math.PI / 180.0D) * distance; return Vec3.createVectorHelper(this.posX + var1, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + var3); } @@ -466,7 +466,7 @@ public boolean canRampage() { */ public void setRampaging(boolean par1) { - this.getDataWatcher().updateObject(RAMPAGE_FLAG, Byte.valueOf((byte)(par1 ? 1 : 0))); + this.getDataWatcher().updateObject(RAMPAGE_FLAG, ((byte)(par1 ? 1 : 0))); } /** @@ -482,7 +482,7 @@ public boolean isRampaging() */ public void setTired(boolean par1) { - this.getDataWatcher().updateObject(TIRED_FLAG, Byte.valueOf((byte)(par1 ? 1 : 0))); + this.getDataWatcher().updateObject(TIRED_FLAG, ((byte)(par1 ? 1 : 0))); this.canRampage = false; } diff --git a/src/main/java/twilightforest/entity/boss/HydraHeadContainer.java b/src/main/java/twilightforest/entity/boss/HydraHeadContainer.java index 41931e643a..082e832313 100644 --- a/src/main/java/twilightforest/entity/boss/HydraHeadContainer.java +++ b/src/main/java/twilightforest/entity/boss/HydraHeadContainer.java @@ -24,9 +24,9 @@ public class HydraHeadContainer { // balancing factors - private static int FLAME_BURN_FACTOR = 3; - private static int FLAME_DAMAGE = 19; - private static int BITE_DAMAGE = 48; + private static int FLAME_BURN_FACTOR = (int)(3*1.5); + private static int FLAME_DAMAGE = (int)(19*1.5); + private static int BITE_DAMAGE = (int)(48*1.5); private static double FLAME_BREATH_TRACKING_SPEED = 0.04D; public static final int NEXT_AUTOMATIC = -1; @@ -619,8 +619,8 @@ protected void addMouthParticles() { if (headEntity.getState() == STATE_FLAME_BEGINNING) { - headEntity.worldObj.spawnParticle("flame", px + headEntity.getRNG().nextDouble() - 0.5, py + headEntity.getRNG().nextDouble() - 0.5, pz + headEntity.getRNG().nextDouble() - 0.5, 0, 0, 0); - headEntity.worldObj.spawnParticle("smoke", px + headEntity.getRNG().nextDouble() - 0.5, py + headEntity.getRNG().nextDouble() - 0.5, pz + headEntity.getRNG().nextDouble() - 0.5, 0, 0, 0); + headEntity.worldObj.spawnParticle("flame", px + headEntity.getRNG().nextFloat() - 0.5, py + headEntity.getRNG().nextFloat() - 0.5, pz + headEntity.getRNG().nextFloat() - 0.5, 0, 0, 0); + headEntity.worldObj.spawnParticle("smoke", px + headEntity.getRNG().nextFloat() - 0.5, py + headEntity.getRNG().nextFloat() - 0.5, pz + headEntity.getRNG().nextFloat() - 0.5, 0, 0, 0); } if (headEntity.getState() == STATE_FLAME_BREATHING) @@ -632,8 +632,8 @@ protected void addMouthParticles() { double dy = look.yCoord; double dz = look.zCoord; - double spread = 5 + headEntity.getRNG().nextDouble() * 2.5; - double velocity = 1.0 + headEntity.getRNG().nextDouble(); + double spread = 5 + headEntity.getRNG().nextFloat() * 2.5; + double velocity = 1.0 + headEntity.getRNG().nextFloat(); // spread flame dx += headEntity.getRNG().nextGaussian() * 0.007499999832361937D * spread; @@ -649,12 +649,12 @@ protected void addMouthParticles() { if (headEntity.getState() == STATE_BITE_BEGINNING || headEntity.getState() == STATE_BITE_READY) { - headEntity.worldObj.spawnParticle("splash", px + headEntity.getRNG().nextDouble() - 0.5, py + headEntity.getRNG().nextDouble() - 0.5, pz + headEntity.getRNG().nextDouble() - 0.5, 0, 0, 0); + headEntity.worldObj.spawnParticle("splash", px + headEntity.getRNG().nextFloat() - 0.5, py + headEntity.getRNG().nextFloat() - 0.5, pz + headEntity.getRNG().nextFloat() - 0.5, 0, 0, 0); } if (headEntity.getState() == STATE_MORTAR_BEGINNING) { - headEntity.worldObj.spawnParticle("largesmoke", px + headEntity.getRNG().nextDouble() - 0.5, py + headEntity.getRNG().nextDouble() - 0.5, pz + headEntity.getRNG().nextDouble() - 0.5, 0, 0, 0); + headEntity.worldObj.spawnParticle("largesmoke", px + headEntity.getRNG().nextFloat() - 0.5, py + headEntity.getRNG().nextFloat() - 0.5, pz + headEntity.getRNG().nextFloat() - 0.5, 0, 0, 0); } } @@ -728,7 +728,7 @@ protected void setNeckPosition() { } - vector.rotateAroundY((-(hydraObj.renderYawOffset + neckRotation) * 3.141593F) / 180F); + vector.rotateAroundY((-(hydraObj.renderYawOffset + neckRotation) * (float)Math.PI) / 180F); setNeckPositon(hydraObj.posX + vector.xCoord, hydraObj.posY + vector.yCoord, hydraObj.posZ + vector.zCoord, hydraObj.renderYawOffset, 0); } @@ -764,8 +764,8 @@ protected void setHeadPosition() { } vector = Vec3.createVectorHelper(0, 0, neckLength); // -53 = 3.3125 - vector.rotateAroundX((xRotation * 3.141593F + xSwing) / 180F); - vector.rotateAroundY((-(hydraObj.renderYawOffset + yRotation + ySwing) * 3.141593F) / 180F); + vector.rotateAroundX((xRotation * (float)Math.PI + xSwing) / 180F); + vector.rotateAroundY((-(hydraObj.renderYawOffset + yRotation + ySwing) * (float)Math.PI) / 180F); dx = hydraObj.posX + vector.xCoord; dy = hydraObj.posY + vector.yCoord + 3; @@ -1030,7 +1030,7 @@ protected void setNeckPositon(double startX, double startY, double startZ, float { // if we are looking down, don't raise the first neck position, it looks weird Vec3 vector = Vec3.createVectorHelper(0, 0, -1.0); - vector.rotateAroundY((-endYaw * 3.141593F) / 180F); + vector.rotateAroundY((-endYaw * (float)Math.PI) / 180F); endX += vector.xCoord; endY += vector.yCoord; endZ += vector.zCoord; @@ -1085,7 +1085,7 @@ protected void faceIdle(float yawConstraint, float pitchConstraint) { //headEntity.rotationPitch = hydraObj.rotationPitch; //headEntity.rotationYaw = hydraObj.rotationYaw; - float angle = (((hydraObj.rotationYaw) * 3.141593F) / 180F); + float angle = (((hydraObj.rotationYaw) * (float)Math.PI) / 180F); float distance = 30.0F; double dx = hydraObj.posX - MathHelper.sin(angle) * distance; @@ -1122,13 +1122,13 @@ public void faceEntity(Entity entity, float yawConstraint, float pitchConstraint * Face this head towards a specific Vector */ public void faceVec(double xCoord, double yCoord, double zCoord, float yawConstraint, float pitchConstraint) { - double xOffset = xCoord - headEntity.posX; - double zOffset = zCoord - headEntity.posZ; - double yOffset = (headEntity.posY + 1.0) - yCoord; + float xOffset = (float)(xCoord - headEntity.posX); + float zOffset = (float)(zCoord - headEntity.posZ); + float yOffset = (float)((headEntity.posY + 1.0) - yCoord); - double distance = MathHelper.sqrt_double(xOffset * xOffset + zOffset * zOffset); - float xyAngle = (float)((Math.atan2(zOffset, xOffset) * 180D) / Math.PI) - 90F; - float zdAngle = (float)(-((Math.atan2(yOffset, distance) * 180D) / Math.PI)); + float distance = MathHelper.sqrt_float(xOffset * xOffset + zOffset * zOffset); + float xyAngle = ((org.bogdang.modifications.math.TrigMath2.atan2(zOffset, xOffset) * 180F) / (float)Math.PI) - 90F; + float zdAngle = (-((org.bogdang.modifications.math.TrigMath2.atan2(yOffset, distance) * 180F) / (float)Math.PI)); headEntity.rotationPitch = -updateRotation(headEntity.rotationPitch, zdAngle, pitchConstraint); headEntity.rotationYaw = updateRotation(headEntity.rotationYaw, xyAngle, yawConstraint); diff --git a/src/main/java/twilightforest/entity/passive/EntityTFBunny.java b/src/main/java/twilightforest/entity/passive/EntityTFBunny.java index fdbcd1a371..c08b462c0c 100644 --- a/src/main/java/twilightforest/entity/passive/EntityTFBunny.java +++ b/src/main/java/twilightforest/entity/passive/EntityTFBunny.java @@ -54,7 +54,7 @@ public EntityTFBunny(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(3.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(3.0D+twilightforest.TwilightForestMod.Scatter.nextInt(3)-twilightforest.TwilightForestMod.Scatter.nextInt(3)); // max health this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); } @@ -62,7 +62,7 @@ protected void applyEntityAttributes() protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(16, (byte)0); } /** @@ -125,7 +125,7 @@ public int getBunnyType() public void setBunnyType(int par1) { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)par1)); + this.dataWatcher.updateObject(16, ((byte)par1)); } diff --git a/src/main/java/twilightforest/entity/passive/EntityTFMobileFirefly.java b/src/main/java/twilightforest/entity/passive/EntityTFMobileFirefly.java index 0e8b4461e8..de85f70831 100644 --- a/src/main/java/twilightforest/entity/passive/EntityTFMobileFirefly.java +++ b/src/main/java/twilightforest/entity/passive/EntityTFMobileFirefly.java @@ -76,7 +76,7 @@ protected void collideWithEntity(Entity par1Entity) {} protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(6.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(6.0D+twilightforest.TwilightForestMod.Scatter.nextInt(6)-twilightforest.TwilightForestMod.Scatter.nextInt(6)); // max health } /** @@ -122,7 +122,7 @@ protected void updateAITasks() this.motionX += (Math.signum(var1) * 0.5D - this.motionX) * speed; this.motionY += (Math.signum(var3) * 0.699999988079071D - this.motionY) * speed * 2; this.motionZ += (Math.signum(var5) * 0.5D - this.motionZ) * speed; - float var7 = (float)(Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) - 90.0F; + float var7 = (org.bogdang.modifications.math.TrigMath2.atan2((float)this.motionZ, (float)this.motionX) * 180.0F / (float)Math.PI) - 90.0F; float var8 = MathHelper.wrapAngleTo180_float(var7 - this.rotationYaw); this.moveForward = 0.5F; this.rotationYaw += var8; @@ -192,6 +192,6 @@ public int getBrightnessForRender(float par1) public float getGlowBrightness() { - return (float)Math.sin(this.ticksExisted / 7.0) + 1F; + return (float)org.bogdang.modifications.math.MathHelperLite.sin(this.ticksExisted / 7.0) + 1F; } } diff --git a/src/main/java/twilightforest/entity/passive/EntityTFPenguin.java b/src/main/java/twilightforest/entity/passive/EntityTFPenguin.java index 1db58913d2..7bbdaf9499 100644 --- a/src/main/java/twilightforest/entity/passive/EntityTFPenguin.java +++ b/src/main/java/twilightforest/entity/passive/EntityTFPenguin.java @@ -89,7 +89,7 @@ public void onDeath(DamageSource par1DamageSource) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D); } } diff --git a/src/main/java/twilightforest/entity/passive/EntityTFQuestRam.java b/src/main/java/twilightforest/entity/passive/EntityTFQuestRam.java index 5e1c281d79..dd6d3da183 100644 --- a/src/main/java/twilightforest/entity/passive/EntityTFQuestRam.java +++ b/src/main/java/twilightforest/entity/passive/EntityTFQuestRam.java @@ -64,7 +64,7 @@ public EntityAnimal createChild(EntityAgeable entityanimal) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(70.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(70.0D+twilightforest.TwilightForestMod.Scatter.nextInt(25)-twilightforest.TwilightForestMod.Scatter.nextInt(25)); // max health this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); } @@ -72,8 +72,8 @@ protected void applyEntityAttributes() protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(16, Integer.valueOf(0)); - this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(16, (int)0); + this.dataWatcher.addObject(17, (byte)0); } @@ -209,7 +209,7 @@ public void onLivingUpdate() // for (int var1 = 0; var1 < 2; ++var1) // { -// this.worldObj.spawnParticle("mobSpell", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.44, 0.625, this.rand.nextDouble()); +// this.worldObj.spawnParticle("mobSpell", this.posX + (this.rand.nextFloat() - 0.5D) * (double)this.width, this.posY + this.rand.nextFloat() * (double)this.height, this.posZ + (this.rand.nextFloat() - 0.5D) * (double)this.width, 0.44, 0.625, this.rand.nextFloat()); // } checkAndAnimateColors(); } @@ -259,7 +259,7 @@ public int getColorFlags() */ public void setColorFlags(int par1) { - this.dataWatcher.updateObject(16, Integer.valueOf(par1)); + this.dataWatcher.updateObject(16, par1); } /** @@ -295,7 +295,7 @@ public boolean getRewarded() */ public void setRewarded(boolean par1) { - this.dataWatcher.updateObject(17, par1 ? Byte.valueOf((byte)1) : Byte.valueOf((byte)0)); + this.dataWatcher.updateObject(17, par1 ? ((byte)1) : (byte)0); } @@ -308,7 +308,7 @@ public void animateAddColor(int color, int iterations) { //EntitySheep.fleeceColorTable[i][0] for (int i = 0; i < iterations; i++) { - this.worldObj.spawnParticle("mobSpell", this.posX + (this.rand.nextDouble() - 0.5D) * this.width * 1.5, this.posY + this.rand.nextDouble() * this.height * 1.5, this.posZ + (this.rand.nextDouble() - 0.5D) * this.width * 1.5, EntitySheep.fleeceColorTable[color][0], EntitySheep.fleeceColorTable[color][1], EntitySheep.fleeceColorTable[color][2]); + this.worldObj.spawnParticle("mobSpell", this.posX + (this.rand.nextFloat() - 0.5D) * this.width * 1.5, this.posY + this.rand.nextFloat() * this.height * 1.5, this.posZ + (this.rand.nextFloat() - 0.5D) * this.width * 1.5, EntitySheep.fleeceColorTable[color][0], EntitySheep.fleeceColorTable[color][1], EntitySheep.fleeceColorTable[color][2]); } //TODO: it would be nice to play a custom sound diff --git a/src/main/java/twilightforest/entity/passive/EntityTFRaven.java b/src/main/java/twilightforest/entity/passive/EntityTFRaven.java index b9d5d3545f..91de006b15 100644 --- a/src/main/java/twilightforest/entity/passive/EntityTFRaven.java +++ b/src/main/java/twilightforest/entity/passive/EntityTFRaven.java @@ -49,7 +49,7 @@ public EntityTFRaven(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D+twilightforest.TwilightForestMod.Scatter.nextInt(10)-twilightforest.TwilightForestMod.Scatter.nextInt(10)); // max health this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000001192092896D); } diff --git a/src/main/java/twilightforest/entity/passive/EntityTFSquirrel.java b/src/main/java/twilightforest/entity/passive/EntityTFSquirrel.java index 34d53efdf0..01564f7b5e 100644 --- a/src/main/java/twilightforest/entity/passive/EntityTFSquirrel.java +++ b/src/main/java/twilightforest/entity/passive/EntityTFSquirrel.java @@ -48,7 +48,7 @@ public EntityTFSquirrel(World par1World) { protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1.0D+twilightforest.TwilightForestMod.Scatter.nextInt(5)); // max health this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D); } diff --git a/src/main/java/twilightforest/entity/passive/EntityTFTinyBird.java b/src/main/java/twilightforest/entity/passive/EntityTFTinyBird.java index 0fc2b2ee2e..dafef10541 100644 --- a/src/main/java/twilightforest/entity/passive/EntityTFTinyBird.java +++ b/src/main/java/twilightforest/entity/passive/EntityTFTinyBird.java @@ -61,8 +61,8 @@ public EntityTFTinyBird(World par1World) { protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(DATA_BIRDTYPE, Byte.valueOf((byte)0)); - this.dataWatcher.addObject(DATA_BIRDFLAGS, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(DATA_BIRDTYPE, (byte)0); + this.dataWatcher.addObject(DATA_BIRDFLAGS, (byte)0); } /** @@ -72,7 +72,7 @@ protected void entityInit() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1.0D); // max health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1.0D+twilightforest.TwilightForestMod.Scatter.nextInt(5)); // max health this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000001192092896D); } @@ -128,7 +128,7 @@ public int getBirdType() public void setBirdType(int par1) { - this.dataWatcher.updateObject(DATA_BIRDTYPE, Byte.valueOf((byte)par1)); + this.dataWatcher.updateObject(DATA_BIRDTYPE, ((byte)par1)); } /** @@ -272,7 +272,7 @@ protected void updateAITasks() this.motionX += (Math.signum(d0) * 0.5D - this.motionX) * 0.10000000149011612D; this.motionY += (Math.signum(d1) * 0.699999988079071D - this.motionY) * 0.10000000149011612D; this.motionZ += (Math.signum(d2) * 0.5D - this.motionZ) * 0.10000000149011612D; - float f = (float)(Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) - 90.0F; + float f = (org.bogdang.modifications.math.TrigMath2.atan2((float)this.motionZ, (float)this.motionX) * 180.0F / (float)Math.PI) - 90.0F; float f1 = MathHelper.wrapAngleTo180_float(f - this.rotationYaw); this.moveForward = 0.5F; this.rotationYaw += f1; @@ -331,11 +331,11 @@ public void setIsBirdLanded(boolean par1) if (par1) { - this.dataWatcher.updateObject(DATA_BIRDFLAGS, Byte.valueOf((byte)(b0 | 1))); + this.dataWatcher.updateObject(DATA_BIRDFLAGS, ((byte)(b0 | 1))); } else { - this.dataWatcher.updateObject(DATA_BIRDFLAGS, Byte.valueOf((byte)(b0 & -2))); + this.dataWatcher.updateObject(DATA_BIRDFLAGS, ((byte)(b0 & -2))); } } diff --git a/src/main/java/twilightforest/item/ItemBlockTFHugeLilyPad.java b/src/main/java/twilightforest/item/ItemBlockTFHugeLilyPad.java index 80ec19f5ee..06f97355fc 100644 --- a/src/main/java/twilightforest/item/ItemBlockTFHugeLilyPad.java +++ b/src/main/java/twilightforest/item/ItemBlockTFHugeLilyPad.java @@ -16,7 +16,7 @@ public class ItemBlockTFHugeLilyPad extends ItemLilyPad { - Random rand = new Random(); + Random rand = new org.bogdang.modifications.random.XSTR(); public ItemBlockTFHugeLilyPad(Block block) { super(block); diff --git a/src/main/java/twilightforest/item/ItemTFIronwoodArmor.java b/src/main/java/twilightforest/item/ItemTFIronwoodArmor.java index ede394840f..6854f791b9 100644 --- a/src/main/java/twilightforest/item/ItemTFIronwoodArmor.java +++ b/src/main/java/twilightforest/item/ItemTFIronwoodArmor.java @@ -59,8 +59,8 @@ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) istack.addEnchantment(Enchantment.aquaAffinity, 1); break; case 1: - istack.addEnchantment(Enchantment.protection, 1); - break; + //istack.addEnchantment(Enchantment.protection, 1); + //break; case 2: istack.addEnchantment(Enchantment.protection, 1); break; diff --git a/src/main/java/twilightforest/item/ItemTFMagicMap.java b/src/main/java/twilightforest/item/ItemTFMagicMap.java index 567ffb11b3..76738f88f7 100644 --- a/src/main/java/twilightforest/item/ItemTFMagicMap.java +++ b/src/main/java/twilightforest/item/ItemTFMagicMap.java @@ -275,7 +275,7 @@ public Packet func_150911_c(ItemStack par1ItemStack, World par2World, EntityPlay */ public String getItemStackDisplayName(ItemStack par1ItemStack) { - return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(par1ItemStack) + ".name") + " #" + par1ItemStack.getItemDamage()).trim(); + return (String.valueOf(StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(par1ItemStack) + ".name") + " #" + par1ItemStack.getItemDamage())).trim(); } /** diff --git a/src/main/java/twilightforest/item/ItemTFMazeMap.java b/src/main/java/twilightforest/item/ItemTFMazeMap.java index f22afdc804..1be0765a41 100644 --- a/src/main/java/twilightforest/item/ItemTFMazeMap.java +++ b/src/main/java/twilightforest/item/ItemTFMazeMap.java @@ -311,7 +311,7 @@ public Packet func_150911_c(ItemStack par1ItemStack, World par2World, EntityPlay */ public String getItemStackDisplayName(ItemStack par1ItemStack) { - return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(par1ItemStack) + ".name") + " #" + par1ItemStack.getItemDamage()).trim(); + return (String.valueOf(StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(par1ItemStack) + ".name") + " #" + par1ItemStack.getItemDamage())).trim(); } /** diff --git a/src/main/java/twilightforest/item/ItemTFSpawnEgg.java b/src/main/java/twilightforest/item/ItemTFSpawnEgg.java index 4249fa115d..e82f634203 100644 --- a/src/main/java/twilightforest/item/ItemTFSpawnEgg.java +++ b/src/main/java/twilightforest/item/ItemTFSpawnEgg.java @@ -47,12 +47,12 @@ public int getColorFromItemStack(ItemStack par1ItemStack, int par2) @SideOnly(Side.CLIENT) public String getItemStackDisplayName(ItemStack par1ItemStack) { - String prefix = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); + String prefix = (String.valueOf(StatCollector.translateToLocal(this.getUnlocalizedName() + ".name"))).trim(); String entityname = TFCreatures.getStringFromID(par1ItemStack.getItemDamage()); if (entityname != null) { - prefix = prefix + " " + StatCollector.translateToLocal(String.format("entity.%s.%s.name", TwilightForestMod.ID, entityname)); + prefix = String.valueOf(new StringBuilder().append(prefix).append(' ').append(StatCollector.translateToLocal(String.format("entity.%s.%s.name", TwilightForestMod.ID, entityname)))); } return prefix; @@ -84,18 +84,18 @@ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, Entity entity = spawnCreature(par3World, par1ItemStack.getItemDamage(), (double)par4 + 0.5D, (double)par5 + var12, (double)par6 + 0.5D); - if (entity != null) - { + //if (entity != null) + //{ if (entity instanceof EntityLiving && par1ItemStack.hasDisplayName()) { ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); } - if (!par2EntityPlayer.capabilities.isCreativeMode) + if (entity != null && !par2EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } - } + //} return true; } diff --git a/src/main/java/twilightforest/item/ItemTFYetiArmor.java b/src/main/java/twilightforest/item/ItemTFYetiArmor.java index 509d38a6e2..33d43ca06b 100644 --- a/src/main/java/twilightforest/item/ItemTFYetiArmor.java +++ b/src/main/java/twilightforest/item/ItemTFYetiArmor.java @@ -69,11 +69,11 @@ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) ItemStack istack = new ItemStack(par1, 1, 0); switch (this.armorType) { case 0: - istack.addEnchantment(Enchantment.protection, 2); - break; + //istack.addEnchantment(Enchantment.protection, 2); + //break; case 1: - istack.addEnchantment(Enchantment.protection, 2); - break; + //istack.addEnchantment(Enchantment.protection, 2); + //break; case 2: istack.addEnchantment(Enchantment.protection, 2); break; diff --git a/src/main/java/twilightforest/structures/ComponentTFHedgeMaze.java b/src/main/java/twilightforest/structures/ComponentTFHedgeMaze.java index c8154da04a..42ef066154 100644 --- a/src/main/java/twilightforest/structures/ComponentTFHedgeMaze.java +++ b/src/main/java/twilightforest/structures/ComponentTFHedgeMaze.java @@ -160,7 +160,7 @@ void decorate3x3Rooms(World world, int[] rcoords, StructureBoundingBox sbb) void decorate3x3Room(World world, int x, int z, StructureBoundingBox sbb) { // make a new RNG for this room! - Random roomRNG = new Random(world.getSeed() ^ x + z); + Random roomRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() ^ x + z); // a few jack-o-lanterns roomJackO(world, roomRNG, x, z, 8, sbb); diff --git a/src/main/java/twilightforest/structures/ComponentTFHillMaze.java b/src/main/java/twilightforest/structures/ComponentTFHillMaze.java index fe4a1f0c0b..7369fe41c3 100644 --- a/src/main/java/twilightforest/structures/ComponentTFHillMaze.java +++ b/src/main/java/twilightforest/structures/ComponentTFHillMaze.java @@ -147,7 +147,7 @@ void decorate3x3Rooms(World world, int[] rcoords, StructureBoundingBox sbb) void decorate3x3Room(World world, int x, int z, StructureBoundingBox sbb) { // make a new RNG for this room! - Random roomRNG = new Random(world.getSeed() ^ x + z); + Random roomRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() ^ x + z); // all rooms should have 1 spawner roomSpawner(world, roomRNG, x, z, 8, sbb); diff --git a/src/main/java/twilightforest/structures/ComponentTFHollowHill.java b/src/main/java/twilightforest/structures/ComponentTFHollowHill.java index 7faed360c6..4acb638eb5 100644 --- a/src/main/java/twilightforest/structures/ComponentTFHollowHill.java +++ b/src/main/java/twilightforest/structures/ComponentTFHollowHill.java @@ -129,13 +129,13 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox } // level 3 hills get 2 mid-air wraith spawners - if (hillSize == 3) + /*if (hillSize == 3) { // int[] dest = getEmptyCoordsInHill(hy + 10, 20); // placeWraithSpawner(dest[0], hy + 10, dest[1]); // dest = getEmptyCoordsInHill(hy + 10, 20); // placeWraithSpawner(dest[0], hy + 10, dest[1]); - } + }*/ @@ -148,7 +148,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox protected void generateTreasureChest(World world, int x, int y, int z, StructureBoundingBox sbb) { // generate an RNG for this chest //TODO: MOAR RANDOM! - Random chestRNG = new Random(world.getSeed() + x * z); + Random chestRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + x * z); // try placing it placeTreasureAtCurrentPosition(world, chestRNG, x, y, z, this.hillSize == 3 ? TFTreasure.hill3 : (this.hillSize == 2 ? TFTreasure.hill2 : TFTreasure.hill1), sbb); @@ -170,7 +170,7 @@ protected void generateOreStalactite(World world, int x, int y, int z, Structure { // generate an RNG for this stalactite //TODO: MOAR RANDOM! - Random stalRNG = new Random(world.getSeed() + dx * dz); + Random stalRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + dx * dz); // make the actual stalactite TFGenCaveStalactite stalag = TFGenCaveStalactite.makeRandomOreStalactite(stalRNG, hillSize); @@ -190,7 +190,7 @@ protected void generateBlockStalactite(World world, Block blockToGenerate, float { // generate an RNG for this stalactite //TODO: MOAR RANDOM! - Random stalRNG = new Random(world.getSeed() + dx * dz); + Random stalRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + dx * dz); if (hillSize == 1) { length *= 1.9F; diff --git a/src/main/java/twilightforest/structures/ComponentTFNagaCourtyard.java b/src/main/java/twilightforest/structures/ComponentTFNagaCourtyard.java index 648cc3568d..a17e14b785 100644 --- a/src/main/java/twilightforest/structures/ComponentTFNagaCourtyard.java +++ b/src/main/java/twilightforest/structures/ComponentTFNagaCourtyard.java @@ -270,7 +270,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox } // make a new rand here because we keep getting different results and this actually matters... or should the pillars be different StructureComponents? - Random pillarRand = new Random(world.getSeed() + this.boundingBox.minX * this.boundingBox.minZ); + Random pillarRand = new org.bogdang.modifications.random.XSTR(world.getSeed() + this.boundingBox.minX * this.boundingBox.minZ); // pick a few spots and make pillars for (int i = 0; i < 20; i++) { diff --git a/src/main/java/twilightforest/structures/StructureTFComponent.java b/src/main/java/twilightforest/structures/StructureTFComponent.java index 5e2b198f00..437ec9981b 100644 --- a/src/main/java/twilightforest/structures/StructureTFComponent.java +++ b/src/main/java/twilightforest/structures/StructureTFComponent.java @@ -58,8 +58,8 @@ public static StructureBoundingBox getComponentToAddBoundingBox(int x, int y, in default: return new StructureBoundingBox(x + minX, y + minY, z + minZ, x + maxX + minX, y + maxY + minY, z + maxZ + minZ); - case 0: // '\0' - return new StructureBoundingBox(x + minX, y + minY, z + minZ, x + maxX + minX, y + maxY + minY, z + maxZ + minZ); + //case 0: // '\0' + //return new StructureBoundingBox(x + minX, y + minY, z + minZ, x + maxX + minX, y + maxY + minY, z + maxZ + minZ); case 1: // '\001' return new StructureBoundingBox(x - maxZ + minZ, y + minY, z + minX, x + minZ, y + maxY + minY, z + maxX + minX); @@ -82,8 +82,8 @@ public static StructureBoundingBox getComponentToAddBoundingBox2(int x, int y, i default: return new StructureBoundingBox(x + minX, y + minY, z + minZ, x + maxX + minX, y + maxY + minY, z + maxZ + minZ); - case 0: // '\0' - return new StructureBoundingBox(x + minX, y + minY, z + minZ, x + maxX + minX, y + maxY + minY, z + maxZ + minZ); + //case 0: // '\0' + //return new StructureBoundingBox(x + minX, y + minY, z + minZ, x + maxX + minX, y + maxY + minY, z + maxZ + minZ); case 1: // '\001' return new StructureBoundingBox(x - maxZ - minZ, y + minY, z + minX, x - minZ, y + maxY + minY, z + maxX + minX); diff --git a/src/main/java/twilightforest/structures/TFFinalCastlePieces.java b/src/main/java/twilightforest/structures/TFFinalCastlePieces.java index b03c0a7cca..6a3680084e 100644 --- a/src/main/java/twilightforest/structures/TFFinalCastlePieces.java +++ b/src/main/java/twilightforest/structures/TFFinalCastlePieces.java @@ -194,10 +194,10 @@ private void buildTowerMaze(List list, Random rand, int x, int y, int z, int how // check if we've successfully built the end tower if (this.isMazeComplete(list, type)) { - System.out.println("Tower maze type " + type + " complete!"); + cpw.mods.fml.common.FMLLog.info("Tower maze type " + type + " complete!"); } else { // TODO: add limit on retrying, in case of infinite loop? - System.out.println("Tower maze type " + type + " INCOMPLETE, retrying!"); + cpw.mods.fml.common.FMLLog.info("Tower maze type " + type + " INCOMPLETE, retrying!"); list.clear(); list.addAll(before); this.buildTowerMaze(list, rand, x, y, z, howFar, direction, type, dest); @@ -914,7 +914,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox return false; } - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); this.fillWithAir(world, sbb, 0, 0, 0, this.size - 1, this.height - 1, this.size - 1); int forceFieldMeta = this.getForceFieldMeta(decoRNG); @@ -1013,7 +1013,7 @@ public void buildComponent(StructureComponent parent, List list, Random rand) { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); fillWithRandomizedBlocks(world, sbb, 0, 0, 0, 8, 49, 8, false, rand, deco.randomBlocks); @@ -1125,7 +1125,7 @@ public void buildComponent(StructureComponent parent, List list, Random rand) { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); fillWithRandomizedBlocks(world, sbb, 0, 0, 0, 12, 59, 12, false, rand, deco.randomBlocks); @@ -1178,7 +1178,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox this.height = this.boundingBox.getYSize(); this.width = (this.coordBaseMode == 0 || this.coordBaseMode == 2) ? this.boundingBox.getZSize() : this.boundingBox.getXSize(); - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); if (mural == null) { // only make it once @@ -1763,9 +1763,9 @@ private boolean buildEndTowerTowards(List list, Random rand, ChunkCoordinates de private boolean isWithinRange(int centerX, int centerZ, int posX, int posZ, int range) { boolean inRange = Math.abs(centerX - posX) < range && Math.abs(centerZ - posZ) < range; - if (!inRange) { + /*if (!inRange) { // System.out.println("Tested range, center is at " + centerX + ", " + centerZ + " and tower is " + posX + ", " + posZ + " so distance is " + Math.max(Math.abs(centerX - posX), Math.abs(centerZ - posZ))); - } + }*/ return inRange; } @@ -1828,7 +1828,7 @@ protected ChunkCoordinates offsetTowerCCoords(int x, int y, int z, int howFar, i @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // walls fillWithRandomizedBlocks(world, sbb, 0, 0, 0, this.size - 1, this.height - 1, this.size - 1, false, rand, deco.randomBlocks); @@ -2333,7 +2333,7 @@ protected MazeTower13 makeNewDamagedTower(Random rand, int direction, ChunkCoord @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { super.addComponentParts(world, rand, sbb); - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); this.destroyTower(world, decoRNG, sbb); @@ -2962,7 +2962,7 @@ public Foundation13Thorns(Random rand, int i, StructureTFComponent sideTower) { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { // thorns - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); for (int i = 0; i < 4; i++) { this.makeThornVine(world, decoRNG, i, sbb); @@ -3023,7 +3023,7 @@ private void makeThornVine(World world, Random decoRNG, int rotation, StructureB } private void makeThornBranch(World world, int x, int y, int z, int rotation, StructureBoundingBox sbb) { - Random rand = new Random(world.getSeed() + (x * 321534781) ^ (y * 756839) + z); + Random rand = new org.bogdang.modifications.random.XSTR(world.getSeed() + (x * 321534781) ^ (y * 756839) + z); // pick a direction int dir = rand.nextInt(4); diff --git a/src/main/java/twilightforest/structures/TFMaze.java b/src/main/java/twilightforest/structures/TFMaze.java index bc76b5c25e..35862725d0 100644 --- a/src/main/java/twilightforest/structures/TFMaze.java +++ b/src/main/java/twilightforest/structures/TFMaze.java @@ -99,7 +99,7 @@ public TFMaze(int cellsWidth, int cellsDepth) this.rawDepth = depth * 2 + 1; storage = new int [rawWidth * rawDepth]; - rand = new Random(); + rand = new org.bogdang.modifications.random.XSTR(); } /** @@ -146,7 +146,7 @@ public int getWall(int sx, int sz, int dx, int dz) return getRaw(sx * 2 + 1, sz * 2 + 0); } - System.out.println("Wall check out of bounds; s = " + sx + ", " + sz + "; d = " + dx + ", " + dz); + cpw.mods.fml.common.FMLLog.info("Wall check out of bounds; s = " + sx + ", " + sz + "; d = " + dx + ", " + dz); return OUT_OF_BOUNDS; } diff --git a/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerBossTrap.java b/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerBossTrap.java index b2c23e28a8..a9723f880f 100644 --- a/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerBossTrap.java +++ b/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerBossTrap.java @@ -64,7 +64,7 @@ public void makeARoof(StructureComponent parent, List list, @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // make walls makeEncasedWalls(world, rand, sbb, 0, 0, 0, size - 1, height - 1, size - 1); diff --git a/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerMain.java b/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerMain.java index 4a92d7821c..0fc5029f11 100644 --- a/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerMain.java +++ b/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerMain.java @@ -277,7 +277,7 @@ public void makeARoof(StructureComponent parent, List list, @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // make walls makeEncasedWalls(world, rand, sbb, 0, 0, 0, size - 1, height - 1, size - 1); @@ -604,7 +604,7 @@ private void decorateReappearingMaze(World world, Random decoRNG, StructureBound TFMaze maze = new TFMaze(mazeSize, mazeSize); // set the seed to a fixed value based on this maze's x and z - maze.setSeed(world.getSeed() + this.boundingBox.minX * 90342903 + y * 90342903 ^ this.boundingBox.minZ); + maze.setSeed(world.getSeed() + this.boundingBox.minX * 90342903L + y * 90342903L ^ this.boundingBox.minZ); // tell it not to make outside walls by making them "ROOMS" for (int i = 0; i < 13; i++) @@ -788,14 +788,14 @@ private void decorateUnbuilderMaze(World world, Random decoRNG, StructureBoundin { for (int z = 3; z < size - 1; z++) { - if (x % 2 == 1 && z % 2 == 1) + if ((x & 1) == 1 && (z & 1) == 1) { for (int py = 1; py < 5; py++) { placeBlockRotated(world, deco.pillarID, deco.pillarMeta, x, y + py, z, rotation, sbb); } } - else if (x % 2 == 1 || z % 2 == 1) + else if ((x & 1) == 1 || (z & 1) == 1) { for (int py = 1; py < 5; py++) { @@ -1526,7 +1526,7 @@ protected void makeBuilderPlatforms(World world, Random rand, StructureBoundingB makeBuilderPlatform(world, rand, rotation, y + 5, z, true, sbb); - if (y % 2 == 1) + if ((y & 1) == 1) { // reverter blocks int sx = pickFrom(rand, 5, 9, 13); diff --git a/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerWing.java b/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerWing.java index f5c7e1c299..d35fe4bcd5 100644 --- a/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerWing.java +++ b/src/main/java/twilightforest/structures/darktower/ComponentTFDarkTowerWing.java @@ -306,7 +306,7 @@ protected boolean makeTowerBalcony(List list, Random rand, i @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // make walls makeEncasedWalls(world, rand, sbb, 0, 0, 0, size - 1, height - 1, size - 1); @@ -387,7 +387,7 @@ protected void destroyTower(World world, Random decoRNG, int x, int y, int z, in private void netherTransformBlob(World world, Random inRand, int sx, int sy, int sz, int rad, StructureBoundingBox sbb) { - Random rand = new Random(inRand.nextLong()); + Random rand = new org.bogdang.modifications.random.XSTR(inRand.nextLong()); // then trace out a quadrant for (byte dx = 0; dx <= rad; dx++) diff --git a/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeLargeBranch.java b/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeLargeBranch.java index 10ed21efc1..94e3a25ffe 100644 --- a/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeLargeBranch.java +++ b/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeLargeBranch.java @@ -38,8 +38,8 @@ public void buildComponent(StructureComponent structurecomponent, List list, Ran for(int i = 0; i <= numMedBranches; i++) { - double outVar = (rand.nextDouble() * 0.3) + 0.3; - double angleVar = rand.nextDouble() * 0.225 * ((i & 1) == 0 ? 1.0 : -1.0); + double outVar = (rand.nextFloat() * 0.3) + 0.3; + double angleVar = rand.nextFloat() * 0.225 * ((i & 1) == 0 ? 1.0 : -1.0); ChunkCoordinates bsrc = TFGenerator.translateCoords(src.posX, src.posY, src.posZ, length * outVar, angle, tilt); makeMedBranch(list, rand, index + 2 + i, bsrc.posX, bsrc.posY, bsrc.posZ, length * 0.6, angle + angleVar, tilt, leafy); @@ -49,8 +49,8 @@ public void buildComponent(StructureComponent structurecomponent, List list, Ran // int numSmallBranches = rand.nextInt(2) + 1; // for(int i = 0; i <= numSmallBranches; i++) { // -// double outVar = (rand.nextDouble() * 0.25) + 0.25; -// double angleVar = rand.nextDouble() * 0.25 * ((i & 1) == 0 ? 1.0 : -1.0); +// double outVar = (rand.nextFloat() * 0.25) + 0.25; +// double angleVar = rand.nextFloat() * 0.25 * ((i & 1) == 0 ? 1.0 : -1.0); // ChunkCoordinates bsrc = TFGenerator.translateCoords(src.posX, src.posY, src.posZ, length * outVar, angle, tilt); // // makeSmallBranch(list, rand, index + numMedBranches + 1 + i, bsrc.posX, bsrc.posY, bsrc.posZ, Math.max(length * 0.3, 2), angle + angleVar, tilt, leafy); @@ -107,7 +107,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox } // make 1-2 small branches near the base - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); int numSmallBranches = decoRNG.nextInt(2) + 1; for(int i = 0; i <= numSmallBranches; i++) { diff --git a/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeMedBranch.java b/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeMedBranch.java index 4d13425134..a3a9958fb8 100644 --- a/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeMedBranch.java +++ b/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeMedBranch.java @@ -106,7 +106,7 @@ public void buildComponent(StructureComponent structurecomponent, List list, Ran // int numLeafBalls = Math.min(rand.nextInt(3) + 1, (int)(length / 5)); // for(int i = 0; i < numLeafBalls; i++) { // -// double slength = (rand.nextDouble() * 0.6 + 0.2) * length; +// double slength = (rand.nextFloat() * 0.6 + 0.2) * length; // int[] bdst = TFGenerator.translate(src.posX, src.posY, src.posZ, slength, angle, tilt); // // //drawBlob(bdst[0], bdst[1], bdst[2], 2, leafBlock, false); @@ -130,8 +130,8 @@ public void buildComponent(StructureComponent structurecomponent, List list, Ran // for(int i = 0; i < numShoots; i++) { // // angleVar = (angleInc * i) - 0.4; -// outVar = (rand.nextDouble() * 0.8) + 0.2; -// tiltVar = (rand.nextDouble() * 0.75) + 0.15; +// outVar = (rand.nextFloat() * 0.8) + 0.2; +// tiltVar = (rand.nextFloat() * 0.75) + 0.15; // // ChunkCoordinates bSrc = TFGenerator.translateCoords(src.posX, src.posY, src.posZ, length * outVar, angle, tilt); // double slength = length * 0.4; @@ -162,7 +162,7 @@ public boolean addComponentParts(World world, Random random, StructureBoundingBo drawBresehnam(world, sbb, rSrc.posX, rSrc.posY, rSrc.posZ, rDest.posX, rDest.posY, rDest.posZ, TFBlocks.log, 12); drawBresehnam(world, sbb, rSrc.posX, rSrc.posY + 1, rSrc.posZ, rDest.posX, rDest.posY, rDest.posZ, TFBlocks.log, 12); - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // and several small branches int numShoots = Math.min(decoRNG.nextInt(3) + 1, (int)(length / 5)); @@ -173,8 +173,8 @@ public boolean addComponentParts(World world, Random random, StructureBoundingBo for(int i = 0; i < numShoots; i++) { angleVar = (angleInc * i) - 0.4; - outVar = (decoRNG.nextDouble() * 0.8) + 0.2; - tiltVar = (decoRNG.nextDouble() * 0.75) + 0.15; + outVar = (decoRNG.nextFloat() * 0.8) + 0.2; + tiltVar = (decoRNG.nextFloat() * 0.75) + 0.15; ChunkCoordinates bSrc = TFGenerator.translateCoords(rSrc.posX, rSrc.posY, rSrc.posZ, length * outVar, angle, tilt); double slength = length * 0.4; diff --git a/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeTrunk.java b/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeTrunk.java index 4910bdfe3c..533dc93834 100644 --- a/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeTrunk.java +++ b/src/main/java/twilightforest/structures/hollowtree/ComponentTFHollowTreeTrunk.java @@ -72,8 +72,8 @@ public void buildComponent(StructureComponent structurecomponent, List list, Ran // 3-5 couple branches on the way up... int numBranches = rand.nextInt(3) + 3; for (int i = 0; i <= numBranches; i++) { - int branchHeight = (int)(height * rand.nextDouble() * 0.9) + (height / 10); - double branchRotation = rand.nextDouble(); + int branchHeight = (int)(height * rand.nextFloat() * 0.9) + (height / 10); + double branchRotation = rand.nextFloat(); makeSmallBranch(list, rand, index + i + 1, branchHeight, 4, branchRotation, 0.35D, true); } @@ -119,7 +119,7 @@ protected int buildBranchRing(List list, Random rand, int index, int branchHeigh //let's do this! int numBranches = rand.nextInt(maxBranches - minBranches + 1) + minBranches; double branchRotation = 1.0 / numBranches; - double branchOffset = rand.nextDouble(); + double branchOffset = rand.nextFloat(); for (int i = 0; i <= numBranches; i++) { int dHeight; @@ -234,8 +234,8 @@ public boolean addComponentParts(World world, Random random, StructureBoundingBo // fireflies & cicadas int numInsects = random.nextInt(3 * radius) + random.nextInt(3 * radius) + 10; for (int i = 0; i <= numInsects; i++) { - int fHeight = (int)(height * random.nextDouble() * 0.9) + (height / 10); - double fAngle = random.nextDouble(); + int fHeight = (int)(height * random.nextFloat() * 0.9) + (height / 10); + double fAngle = random.nextFloat(); addInsect(world, fHeight, fAngle, random, sbb); } diff --git a/src/main/java/twilightforest/structures/icetower/ComponentTFIceTowerWing.java b/src/main/java/twilightforest/structures/icetower/ComponentTFIceTowerWing.java index 2098268095..ccd877350d 100644 --- a/src/main/java/twilightforest/structures/icetower/ComponentTFIceTowerWing.java +++ b/src/main/java/twilightforest/structures/icetower/ComponentTFIceTowerWing.java @@ -197,7 +197,7 @@ protected int getYByStairs(int rx, Random rand, int direction) { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // make walls //fillWithMetadataBlocks(world, sbb, 0, 0, 0, size - 1, height - 1, size - 1, deco.blockID, deco.blockMeta, Blocks.air, 0, false); @@ -529,13 +529,13 @@ private void decoratePlatform(World world, Random rand, int bottom, int top, int // one flight for (int z = 6; z < 10; z++) { int y = bottom - 2 + (z / 2); - this.placeBlockRotated(world, deco.platformID, deco.platformMeta + ((z % 2 == 1) ? 8 : 0), 1, y, z, ladderDownDir, sbb); + this.placeBlockRotated(world, deco.platformID, deco.platformMeta + (((z & 1) == 1) ? 8 : 0), 1, y, z, ladderDownDir, sbb); } // two flight for (int x = 2; x < 6; x++) { int y = bottom + 2 + (x / 2); - this.placeBlockRotated(world, deco.platformID, deco.platformMeta + ((x % 2 == 1) ? 8 : 0), x, y, 9, ladderDownDir, sbb); + this.placeBlockRotated(world, deco.platformID, deco.platformMeta + (((x & 1) == 1) ? 8 : 0), x, y, 9, ladderDownDir, sbb); } // connector this.placeBlockRotated(world, deco.platformID, deco.platformMeta, 5, bottom + 5, 8, ladderDownDir, sbb); @@ -546,7 +546,7 @@ private void decoratePlatform(World world, Random rand, int bottom, int top, int for (int x = 5; x < 10; x++) { int y = bottom + 4 + (x / 2); - this.placeBlockRotated(world, deco.platformID, deco.platformMeta + ((x % 2 == 1) ? 8 : 0), x, y, 1, ladderUpDir, sbb); + this.placeBlockRotated(world, deco.platformID, deco.platformMeta + (((x & 1) == 1) ? 8 : 0), x, y, 1, ladderUpDir, sbb); if (x > 6) { this.placeBlockRotated(world, Blocks.air, 0, x, top, 1, ladderUpDir, sbb); } @@ -555,7 +555,7 @@ private void decoratePlatform(World world, Random rand, int bottom, int top, int for (int z = 2; z < 5; z++) { int y = bottom + 8 + (z / 2); this.placeBlockRotated(world, Blocks.air, 0, 9, top, z, ladderUpDir, sbb); - this.placeBlockRotated(world, deco.platformID, deco.platformMeta + ((z % 2 == 1) ? 8 : 0), 9, y, z, ladderUpDir, sbb); + this.placeBlockRotated(world, deco.platformID, deco.platformMeta + (((z & 1) == 1) ? 8 : 0), 9, y, z, ladderUpDir, sbb); } // treasure! @@ -570,13 +570,13 @@ private void decorateQuadPillarStairs(World world, Random rand, int bottom, int // one flight for (int z = 6; z < 9; z++) { int y = bottom - 2 + (z / 2); - this.placeBlockRotated(world, deco.platformID, deco.platformMeta + ((z % 2 == 1) ? 8 : 0), 2, y, z, ladderDownDir, sbb); + this.placeBlockRotated(world, deco.platformID, deco.platformMeta + (((z & 1) == 1) ? 8 : 0), 2, y, z, ladderDownDir, sbb); } // two flight for (int x = 3; x < 9; x++) { int y = bottom + 1 + (x / 2); - this.placeBlockRotated(world, deco.platformID, deco.platformMeta + ((x % 2 == 1) ? 8 : 0), x, y, 8, ladderDownDir, sbb); + this.placeBlockRotated(world, deco.platformID, deco.platformMeta + (((x & 1) == 1) ? 8 : 0), x, y, 8, ladderDownDir, sbb); } // three flight for (int z = 7; z > 1; z--) { @@ -584,13 +584,13 @@ private void decorateQuadPillarStairs(World world, Random rand, int bottom, int if (z < 4) { this.placeBlockRotated(world, Blocks.air, 0, 8, top, z, ladderDownDir, sbb); } - this.placeBlockRotated(world, deco.platformID, deco.platformMeta + ((z % 2 == 1) ? 8 : 0), 8, y, z, ladderDownDir, sbb); + this.placeBlockRotated(world, deco.platformID, deco.platformMeta + (((z & 1) == 1) ? 8 : 0), 8, y, z, ladderDownDir, sbb); } // last flight for (int x = 7; x > 3; x--) { int y = top + 1 - ((x - 1) / 2); this.placeBlockRotated(world, Blocks.air, 0, x, top, 2, ladderDownDir, sbb); - this.placeBlockRotated(world, deco.platformID, deco.platformMeta + ((x % 2 == 1) ? 8 : 0), x, y, 2, ladderDownDir, sbb); + this.placeBlockRotated(world, deco.platformID, deco.platformMeta + (((x & 1) == 1) ? 8 : 0), x, y, 2, ladderDownDir, sbb); } // treasure! diff --git a/src/main/java/twilightforest/structures/lichtower/ComponentTFTowerWing.java b/src/main/java/twilightforest/structures/lichtower/ComponentTFTowerWing.java index a8ab89190f..f4d169c06f 100644 --- a/src/main/java/twilightforest/structures/lichtower/ComponentTFTowerWing.java +++ b/src/main/java/twilightforest/structures/lichtower/ComponentTFTowerWing.java @@ -445,7 +445,7 @@ protected void makeOpeningMarkers(World world, Random rand, int numMarkers, Stru * @param sbb */ protected void decorateThisTower(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) * (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781) * (this.boundingBox.minZ * 756839)); if (size > 3) { // only decorate towers with more than one available square inside. diff --git a/src/main/java/twilightforest/structures/mushroomtower/ComponentTFMushroomTowerWing.java b/src/main/java/twilightforest/structures/mushroomtower/ComponentTFMushroomTowerWing.java index f1cc0a07e7..f7db472566 100644 --- a/src/main/java/twilightforest/structures/mushroomtower/ComponentTFMushroomTowerWing.java +++ b/src/main/java/twilightforest/structures/mushroomtower/ComponentTFMushroomTowerWing.java @@ -361,7 +361,7 @@ protected int getYByStairs(int rx, Random rand, int direction) { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // // clear inside // fillWithAir(world, sbb, 1, 1, 1, size - 2, height - 2, size - 2); diff --git a/src/main/java/twilightforest/structures/mushroomtower/ComponentTFTowerRoofMushroom.java b/src/main/java/twilightforest/structures/mushroomtower/ComponentTFTowerRoofMushroom.java index ecd8aa80d6..377f3b733d 100644 --- a/src/main/java/twilightforest/structures/mushroomtower/ComponentTFTowerRoofMushroom.java +++ b/src/main/java/twilightforest/structures/mushroomtower/ComponentTFTowerRoofMushroom.java @@ -49,7 +49,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox for (int y = 0; y <= height; y++) { - int radius = (int)(MathHelper.sin((y + height/1.2F) / (height * 2.05F) * 3.14F) * this.size / 2F); + int radius = (int)(MathHelper.sin((y + height/1.2F) / (height * 2.05F) * (float)Math.PI) * this.size / 2F); int hollow = MathHelper.floor_float(radius * .9F); if ((height - y) < 3) diff --git a/src/main/java/twilightforest/structures/stronghold/ComponentTFStrongholdAtrium.java b/src/main/java/twilightforest/structures/stronghold/ComponentTFStrongholdAtrium.java index 688b7075d5..b2b7b18b3d 100644 --- a/src/main/java/twilightforest/structures/stronghold/ComponentTFStrongholdAtrium.java +++ b/src/main/java/twilightforest/structures/stronghold/ComponentTFStrongholdAtrium.java @@ -190,10 +190,10 @@ private void spawnATree(World world, int treeNum, int x, int y, int z, Structure break; } - if (i == 99) + /*if (i == 99) { //System.out.println("Never generated " + treeGen); - } + }*/ } } } diff --git a/src/main/java/twilightforest/structures/stronghold/ComponentTFStrongholdFoundry.java b/src/main/java/twilightforest/structures/stronghold/ComponentTFStrongholdFoundry.java index a2a7b4b82b..0d1f4bb5e0 100644 --- a/src/main/java/twilightforest/structures/stronghold/ComponentTFStrongholdFoundry.java +++ b/src/main/java/twilightforest/structures/stronghold/ComponentTFStrongholdFoundry.java @@ -128,7 +128,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox this.fillWithRandomizedBlocks(world, sbb, 15, 1, 16, 15, 24, 16, false, rand, deco.randomBlocks); // suspended mass - Random massRandom = new Random(rand.nextLong()); + Random massRandom = new org.bogdang.modifications.random.XSTR(rand.nextLong()); for (int x = 4; x < 14; x++) { diff --git a/src/main/java/twilightforest/structures/stronghold/StructureTFStrongholdComponent.java b/src/main/java/twilightforest/structures/stronghold/StructureTFStrongholdComponent.java index 8c47720323..a87d8a4919 100644 --- a/src/main/java/twilightforest/structures/stronghold/StructureTFStrongholdComponent.java +++ b/src/main/java/twilightforest/structures/stronghold/StructureTFStrongholdComponent.java @@ -211,7 +211,7 @@ protected void addNewUpperComponent(StructureComponent parent, List list, Random // is it clear? - if (attempted != null && StructureComponent.findIntersecting(list, attempted.getBoundingBox()) == null) + if (/*attempted != null && */StructureComponent.findIntersecting(list, attempted.getBoundingBox()) == null) { // if so, add it list.add(attempted); diff --git a/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveConnect.java b/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveConnect.java index 937a012b3b..54dc9fde90 100644 --- a/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveConnect.java +++ b/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveConnect.java @@ -82,7 +82,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox // clear inside hollowCaveMiddle(world, sbb, rand, 0, 0, 0, this.size - 1, this.height - 1, this.size - 1); - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // wall decorations for (int i = 0; i < 4; i++) { @@ -91,7 +91,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox } } - decoRNG.setSeed(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + decoRNG.setSeed(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // stone stalactites! for (int i = 0; i < 32; i++) { @@ -106,7 +106,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox } // possible treasure - decoRNG.setSeed(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + decoRNG.setSeed(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); if (this.countExits() == 1 && decoRNG.nextInt(3) == 0) { // treasure! makeTreasureCrate(world, decoRNG, sbb); diff --git a/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveGarden.java b/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveGarden.java index 0d552f011a..bac8a9169b 100644 --- a/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveGarden.java +++ b/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveGarden.java @@ -48,7 +48,7 @@ public boolean addComponentParts(World world, Random rand, StructureBoundingBox } else { // clear inside hollowCaveMiddle(world, sbb, rand, 0, 0, 0, this.size - 1, this.height - 1, this.size - 1); - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // treasure! makeTreasureCrate(world, rand, sbb); diff --git a/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveMain.java b/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveMain.java index 6c2e6af811..3abdec642d 100644 --- a/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveMain.java +++ b/src/main/java/twilightforest/structures/trollcave/ComponentTFTrollCaveMain.java @@ -114,7 +114,7 @@ protected boolean makeSmallerCave(List list, Random rand, in @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb) { - Random decoRNG = new Random(world.getSeed() + (this.boundingBox.minX * 321534781) ^ (this.boundingBox.minZ * 756839)); + Random decoRNG = new org.bogdang.modifications.random.XSTR(world.getSeed() + (this.boundingBox.minX * 321534781L) ^ (this.boundingBox.minZ * 756839L)); // clear inside hollowCaveMiddle(world, sbb, rand, 0, 0, 0, this.size - 1, this.height - 1, this.size - 1); diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFBossSpawner.java b/src/main/java/twilightforest/tileentity/TileEntityTFBossSpawner.java index 6a9233f439..ea035c7426 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFBossSpawner.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFBossSpawner.java @@ -7,6 +7,7 @@ import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.EnumDifficulty; +import net.minecraft.util.AxisAlignedBB; public abstract class TileEntityTFBossSpawner extends TileEntity { @@ -15,11 +16,22 @@ public abstract class TileEntityTFBossSpawner extends TileEntity { protected int counter; protected Entity displayCreature = null; + protected AxisAlignedBB aabb; public TileEntityTFBossSpawner() { ; } + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Is there a player in our detection range? diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFCReactorActive.java b/src/main/java/twilightforest/tileentity/TileEntityTFCReactorActive.java index 1571a9ec53..8d1beeeb49 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFCReactorActive.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFCReactorActive.java @@ -8,6 +8,7 @@ import twilightforest.block.BlockTFTowerTranslucent; import twilightforest.block.TFBlocks; import twilightforest.entity.EntityTFMiniGhast; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFCReactorActive extends TileEntity { @@ -15,10 +16,21 @@ public class TileEntityTFCReactorActive extends TileEntity { int secX, secY, secZ; int terX, terY, terZ; + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } public TileEntityTFCReactorActive() { - Random rand = new Random(); + Random rand = new org.bogdang.modifications.random.XSTR(); // determine the two smaller bursts this.secX = 3 * (rand.nextBoolean() ? 1 : -1); diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFCicada.java b/src/main/java/twilightforest/tileentity/TileEntityTFCicada.java index 413708b67b..70a0f3681d 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFCicada.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFCicada.java @@ -1,6 +1,7 @@ package twilightforest.tileentity; import twilightforest.TwilightForestMod; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFCicada extends TileEntityTFCritter { @@ -13,6 +14,17 @@ public class TileEntityTFCicada extends TileEntityTFCritter { public int singDuration; public boolean singing; public int singDelay; + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFCinderFurnace.java b/src/main/java/twilightforest/tileentity/TileEntityTFCinderFurnace.java index 26eacda821..1adc30e696 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFCinderFurnace.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFCinderFurnace.java @@ -26,6 +26,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.oredict.OreDictionary; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFCinderFurnace extends TileEntity implements ISidedInventory { @@ -47,6 +48,17 @@ public class TileEntityTFCinderFurnace extends TileEntity implements ISidedInven /** The number of ticks that the current item has been cooking for */ public int furnaceCookTime; private String customName; + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } @Override public int getSizeInventory() { diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFCritter.java b/src/main/java/twilightforest/tileentity/TileEntityTFCritter.java index 648e6c8883..29438fd0a2 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFCritter.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFCritter.java @@ -2,12 +2,24 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; public abstract class TileEntityTFCritter extends TileEntity { public TileEntityTFCritter() { super(); } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFFirefly.java b/src/main/java/twilightforest/tileentity/TileEntityTFFirefly.java index 122711c6c4..c0f6e30825 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFFirefly.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFFirefly.java @@ -1,6 +1,7 @@ package twilightforest.tileentity; import twilightforest.entity.passive.EntityTFTinyFirefly; +import net.minecraft.util.AxisAlignedBB; @@ -14,6 +15,17 @@ public class TileEntityTFFirefly extends TileEntityTFCritter { public float glowIntensity; public boolean glowing; public int glowDelay; + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFFlameJet.java b/src/main/java/twilightforest/tileentity/TileEntityTFFlameJet.java index 1251e7f669..5c21f4ba26 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFFlameJet.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFFlameJet.java @@ -10,6 +10,7 @@ import twilightforest.TwilightForestMod; import twilightforest.block.BlockTFFireJet; import twilightforest.block.TFBlocks; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFFlameJet extends TileEntity { @@ -23,6 +24,17 @@ public TileEntityTFFlameJet() { public TileEntityTFFlameJet(int parNextMeta) { this.nextMeta = parNextMeta; } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count @@ -46,13 +58,13 @@ else if (counter % 2 == 0) worldObj.spawnParticle("largesmoke", this.xCoord + 0.5, this.yCoord + 1.0, this.zCoord + 0.5, 0.0D, 0.0D, 0.0D); TwilightForestMod.proxy.spawnParticle(this.worldObj, "largeflame", this.xCoord + 0.5, this.yCoord + 1.0, this.zCoord + 0.5, 0.0D, 0.5D, 0.0D); // TwilightForestMod.proxy.spawnParticle("largeflame", this.xCoord + 0.5, this.yCoord + 1.0, this.zCoord + 0.5, -// Math.cos(counter / 4.0) * 0.2, 0.35D, Math.sin(counter / 4.0) * 0.2); +// org.bogdang.modifications.math.MathHelperLite.cos(counter / 4.0) * 0.2, 0.35D, org.bogdang.modifications.math.MathHelperLite.sin(counter / 4.0) * 0.2); // TwilightForestMod.proxy.spawnParticle("largeflame", this.xCoord + 0.5, this.yCoord + 1.0, this.zCoord + 0.5, -// Math.cos(counter / 4.0 + Math.PI) * 0.2, 0.35D, Math.sin(counter / 4.0 + Math.PI) * 0.2); -// TwilightForestMod.proxy.spawnParticle("largeflame", this.xCoord + 0.5 + Math.cos(counter / 4.0), this.yCoord + 1.0, this.zCoord + 0.5 + Math.sin(counter / 4.0), -// Math.sin(counter / 4.0) * 0.05, 0.35D, Math.cos(counter / 4.0) * 0.05); -// TwilightForestMod.proxy.spawnParticle("largeflame", this.xCoord + 0.5 + Math.cos(counter / 4.0 + Math.PI), this.yCoord + 1.0, this.zCoord + 0.5 + Math.sin(counter / 4.0 + Math.PI), -// Math.sin(counter / 4.0 + Math.PI) * 0.05, 0.35D, Math.cos(counter / 4.0 + Math.PI) * 0.05); +// org.bogdang.modifications.math.MathHelperLite.cos(counter / 4.0 + Math.PI) * 0.2, 0.35D, org.bogdang.modifications.math.MathHelperLite.sin(counter / 4.0 + Math.PI) * 0.2); +// TwilightForestMod.proxy.spawnParticle("largeflame", this.xCoord + 0.5 + org.bogdang.modifications.math.MathHelperLite.cos(counter / 4.0), this.yCoord + 1.0, this.zCoord + 0.5 + org.bogdang.modifications.math.MathHelperLite.sin(counter / 4.0), +// org.bogdang.modifications.math.MathHelperLite.sin(counter / 4.0) * 0.05, 0.35D, org.bogdang.modifications.math.MathHelperLite.cos(counter / 4.0) * 0.05); +// TwilightForestMod.proxy.spawnParticle("largeflame", this.xCoord + 0.5 + org.bogdang.modifications.math.MathHelperLite.cos(counter / 4.0 + Math.PI), this.yCoord + 1.0, this.zCoord + 0.5 + org.bogdang.modifications.math.MathHelperLite.sin(counter / 4.0 + Math.PI), +// org.bogdang.modifications.math.MathHelperLite.sin(counter / 4.0 + Math.PI) * 0.05, 0.35D, org.bogdang.modifications.math.MathHelperLite.cos(counter / 4.0 + Math.PI) * 0.05); TwilightForestMod.proxy.spawnParticle(this.worldObj, "largeflame", this.xCoord - 0.5, this.yCoord + 1.0, this.zCoord + 0.5, 0.05D, 0.5D, 0.0D); TwilightForestMod.proxy.spawnParticle(this.worldObj, "largeflame", this.xCoord + 0.5, this.yCoord + 1.0, this.zCoord - 0.5, 0.0D, 0.5D, 0.05D); diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFGhastTrapActive.java b/src/main/java/twilightforest/tileentity/TileEntityTFGhastTrapActive.java index 4939811cba..085a380845 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFGhastTrapActive.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFGhastTrapActive.java @@ -12,12 +12,24 @@ import twilightforest.block.TFBlocks; import twilightforest.entity.EntityTFTowerGhast; import twilightforest.entity.boss.EntityTFUrGhast; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFGhastTrapActive extends TileEntity { public int counter = 0; - public Random rand = new Random(); + public Random rand = new org.bogdang.modifications.random.XSTR(); + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } public boolean canUpdate() diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFGhastTrapInactive.java b/src/main/java/twilightforest/tileentity/TileEntityTFGhastTrapInactive.java index b7a23a9bd8..78567d39d1 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFGhastTrapInactive.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFGhastTrapInactive.java @@ -11,13 +11,25 @@ import twilightforest.block.BlockTFTowerDevice; import twilightforest.block.TFBlocks; import twilightforest.entity.EntityTFMiniGhast; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFGhastTrapInactive extends TileEntity { int counter; - Random rand = new Random(); + Random rand = new org.bogdang.modifications.random.XSTR(); ArrayList dyingGhasts = new ArrayList(); + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Determines if this TileEntity requires update calls. diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFHydraSpawner.java b/src/main/java/twilightforest/tileentity/TileEntityTFHydraSpawner.java index e26fd45263..c596aaa58d 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFHydraSpawner.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFHydraSpawner.java @@ -3,6 +3,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import twilightforest.entity.TFCreatures; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFHydraSpawner extends TileEntityTFBossSpawner { @@ -10,6 +11,17 @@ public class TileEntityTFHydraSpawner extends TileEntityTFBossSpawner { public TileEntityTFHydraSpawner() { this.mobID = TFCreatures.getSpawnerNameFor("Hydra"); } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Get a temporary copy of the creature we're going to summon for display purposes diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFKnightPhantomsSpawner.java b/src/main/java/twilightforest/tileentity/TileEntityTFKnightPhantomsSpawner.java index 06bc55a66e..55f2d977b4 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFKnightPhantomsSpawner.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFKnightPhantomsSpawner.java @@ -4,12 +4,24 @@ import net.minecraft.entity.player.EntityPlayer; import twilightforest.entity.TFCreatures; import twilightforest.entity.boss.EntityTFKnightPhantom; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFKnightPhantomsSpawner extends TileEntityTFBossSpawner { public TileEntityTFKnightPhantomsSpawner() { this.mobID = TFCreatures.getSpawnerNameFor("Knight Phantom"); } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } @Override public boolean anyPlayerInRange() @@ -33,9 +45,9 @@ protected void spawnMyBoss() { float angle = 60F * i; float distance = 4F; - double rx = xCoord + 0.5D + Math.cos((angle) * Math.PI / 180.0D) * distance; + double rx = xCoord + 0.5D + org.bogdang.modifications.math.MathHelperLite.cos((angle) * Math.PI / 180.0D) * distance; double ry = yCoord + 0.5D; - double rz = zCoord + 0.5D + Math.sin((angle) * Math.PI / 180.0D) * distance; + double rz = zCoord + 0.5D + org.bogdang.modifications.math.MathHelperLite.sin((angle) * Math.PI / 180.0D) * distance; myCreature.setLocationAndAngles(rx, ry, rz, worldObj.rand.nextFloat() * 360F, 0.0F); diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFLichSpawner.java b/src/main/java/twilightforest/tileentity/TileEntityTFLichSpawner.java index bcd3d4160b..dfe131efa5 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFLichSpawner.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFLichSpawner.java @@ -2,12 +2,24 @@ import net.minecraft.entity.player.EntityPlayer; import twilightforest.entity.TFCreatures; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFLichSpawner extends TileEntityTFBossSpawner { public TileEntityTFLichSpawner() { this.mobID = TFCreatures.getSpawnerNameFor("Twilight Lich"); } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } @Override public boolean anyPlayerInRange() diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFMoonworm.java b/src/main/java/twilightforest/tileentity/TileEntityTFMoonworm.java index c1d175aaa5..3169accfcb 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFMoonworm.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFMoonworm.java @@ -1,5 +1,6 @@ package twilightforest.tileentity; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFMoonworm extends TileEntityTFCritter { @@ -16,6 +17,17 @@ public TileEntityTFMoonworm() { yawDelay = 0; desiredYaw = 0; } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFNagaSpawner.java b/src/main/java/twilightforest/tileentity/TileEntityTFNagaSpawner.java index 1893becf46..7e77edddf6 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFNagaSpawner.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFNagaSpawner.java @@ -3,12 +3,24 @@ import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLiving; import twilightforest.entity.TFCreatures; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFNagaSpawner extends TileEntityTFBossSpawner { public TileEntityTFNagaSpawner() { this.mobID = TFCreatures.getSpawnerNameFor("Naga"); } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } public boolean anyPlayerInRange() { diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFPoppingJet.java b/src/main/java/twilightforest/tileentity/TileEntityTFPoppingJet.java index f623f717fd..f4fb736d91 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFPoppingJet.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFPoppingJet.java @@ -4,6 +4,7 @@ import net.minecraft.tileentity.TileEntity; import twilightforest.block.BlockTFFireJet; import twilightforest.block.TFBlocks; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFPoppingJet extends TileEntity { @@ -13,6 +14,17 @@ public class TileEntityTFPoppingJet extends TileEntity { public TileEntityTFPoppingJet() { this(BlockTFFireJet.META_JET_FLAME); } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } public TileEntityTFPoppingJet(int parNextMeta) { this.nextMeta = parNextMeta; diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFReverter.java b/src/main/java/twilightforest/tileentity/TileEntityTFReverter.java index 72d36e08f8..efd1ec44bc 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFReverter.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFReverter.java @@ -7,6 +7,7 @@ import net.minecraft.tileentity.TileEntity; import twilightforest.block.BlockTFTowerTranslucent; import twilightforest.block.TFBlocks; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFReverter extends TileEntity { @@ -15,7 +16,7 @@ public class TileEntityTFReverter extends TileEntity public int radius = 4; public int diameter = 2 * radius + 1; public double requiredPlayerRange = 16; - public Random rand = new Random(); + public Random rand = new org.bogdang.modifications.random.XSTR(); private int tickCount; private boolean slowScan; @@ -23,6 +24,17 @@ public class TileEntityTFReverter extends TileEntity private Block[] blockData; private byte[] metaData; + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Determines if this TileEntity requires update calls. @@ -290,7 +302,6 @@ else if (this.rand.nextInt(REVERT_CHANCE) == 0) replaceMeta = BlockTFTowerTranslucent.META_REVERTER_REPLACEMENT; } - worldObj.setBlock(x, y, z, replaceBlockID, replaceMeta, 2); // play a little animation if (thereBlockID == Blocks.air) @@ -303,6 +314,8 @@ else if (replaceBlockID == Blocks.air) thereBlockID.dropBlockAsItem(worldObj, x, y, z, thereMeta, 0); } + + worldObj.setBlock(x, y, z, replaceBlockID, replaceMeta, 2); } return true; diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFSmoker.java b/src/main/java/twilightforest/tileentity/TileEntityTFSmoker.java index f06ecb5421..d0104cf323 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFSmoker.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFSmoker.java @@ -2,10 +2,22 @@ import net.minecraft.tileentity.TileEntity; import twilightforest.TwilightForestMod; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFSmoker extends TileEntity { public long counter = 0; + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count @@ -16,7 +28,7 @@ public void updateEntity() { if (++counter % 4 == 0) { TwilightForestMod.proxy.spawnParticle(this.worldObj, "hugesmoke", this.xCoord + 0.5, this.yCoord + 0.95, this.zCoord + 0.5, - Math.cos(counter / 10.0) * 0.05, 0.25D, Math.sin(counter / 10.0) * 0.05); + org.bogdang.modifications.math.MathHelperLite.cos(counter / 10.0) * 0.05, 0.25D, org.bogdang.modifications.math.MathHelperLite.sin(counter / 10.0) * 0.05); } } } diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFSnowQueenSpawner.java b/src/main/java/twilightforest/tileentity/TileEntityTFSnowQueenSpawner.java index d05fe04505..026e6be65a 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFSnowQueenSpawner.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFSnowQueenSpawner.java @@ -3,12 +3,24 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import twilightforest.entity.TFCreatures; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFSnowQueenSpawner extends TileEntityTFBossSpawner { public TileEntityTFSnowQueenSpawner() { this.mobID = TFCreatures.getSpawnerNameFor("Snow Queen"); } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } @Override public boolean anyPlayerInRange() diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFTowerBossSpawner.java b/src/main/java/twilightforest/tileentity/TileEntityTFTowerBossSpawner.java index 79aad70480..4e89c7382e 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFTowerBossSpawner.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFTowerBossSpawner.java @@ -3,12 +3,24 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import twilightforest.entity.TFCreatures; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFTowerBossSpawner extends TileEntityTFBossSpawner { public TileEntityTFTowerBossSpawner() { this.mobID = TFCreatures.getSpawnerNameFor("Tower Boss"); } + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } @Override public boolean anyPlayerInRange() diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFTowerBuilder.java b/src/main/java/twilightforest/tileentity/TileEntityTFTowerBuilder.java index 51e99362ff..6e2825aad4 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFTowerBuilder.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFTowerBuilder.java @@ -9,6 +9,7 @@ import twilightforest.block.BlockTFTowerDevice; import twilightforest.block.BlockTFTowerTranslucent; import twilightforest.block.TFBlocks; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFTowerBuilder extends TileEntity { @@ -29,6 +30,17 @@ public class TileEntityTFTowerBuilder extends TileEntity protected Block blockBuiltID = TFBlocks.towerTranslucent; protected int blockBuiltMeta = BlockTFTowerTranslucent.META_BUILT_INACTIVE; + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } public TileEntityTFTowerBuilder() { diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFTrophy.java b/src/main/java/twilightforest/tileentity/TileEntityTFTrophy.java index 7f8aee7ef9..00eac891a4 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFTrophy.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFTrophy.java @@ -1,11 +1,23 @@ package twilightforest.tileentity; import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.AxisAlignedBB; public class TileEntityTFTrophy extends TileEntitySkull { public int ticksExisted; + protected AxisAlignedBB aabb; + + @Override + public void validate() { + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return aabb; + } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count diff --git a/src/main/java/twilightforest/world/ChunkProviderTwilightForest.java b/src/main/java/twilightforest/world/ChunkProviderTwilightForest.java index f66673bf17..1d6aea5c2e 100644 --- a/src/main/java/twilightforest/world/ChunkProviderTwilightForest.java +++ b/src/main/java/twilightforest/world/ChunkProviderTwilightForest.java @@ -92,7 +92,7 @@ public ChunkProviderTwilightForest(World world, long l, boolean flag) { ravineGenerator = new TFGenRavine(); unusedIntArray32x32 = new int[32][32]; worldObj = world; - rand = new Random(l); + rand = new org.bogdang.modifications.random.XSTR(l); //noiseGen1 = new NoiseGeneratorOctaves(rand, 16); //noiseGen2 = new NoiseGeneratorOctaves(rand, 16); //noiseGen3 = new NoiseGeneratorOctaves(rand, 8); @@ -444,10 +444,10 @@ public void deformTerrainForFeature(int cx, int cz, Block[] blockStorage, byte[] } else if (nearFeature == TFFeature.yetiCave) { // yeti lairs are square deformTerrainForYetiLair(blockStorage, nearFeature, x, z, dx, dz); - } else if (nearFeature == TFFeature.trollCave) { + }/* else if (nearFeature == TFFeature.trollCave) { // troll cloud, more like //deformTerrainForTrollCloud(blockStorage, metaStorage, nearFeature, x, z, dx, dz); - } + }*/ } } @@ -698,7 +698,7 @@ private void deformTerrainForTrollCloud2(Block[] storage, byte[] metaStorage, TF int regionX = (cx + 8) >> 4; int regionZ = (cx + 8) >> 4; - long seed = (long)(regionX * 3129871) ^ (long)regionZ * 116129781L; + long seed = (regionX * 3129871L) ^ (long)regionZ * 116129781L; seed = seed * seed * 42317861L + seed * 7L; int num0 = (int) (seed >> 12 & 3L); @@ -765,7 +765,7 @@ private void deformTerrainForTrollCloud2(Block[] storage, byte[] metaStorage, TF } private float pseudoRand(int bx, int bz) { - Random rand = new Random(this.worldObj.getSeed() + (bx * 321534781) ^ (bz * 756839)); + Random rand = new org.bogdang.modifications.random.XSTR(this.worldObj.getSeed() + (bx * 321534781L) ^ (bz * 756839L)); rand.setSeed(rand.nextLong()); return rand.nextFloat(); } diff --git a/src/main/java/twilightforest/world/TFGenCanopyMushroom.java b/src/main/java/twilightforest/world/TFGenCanopyMushroom.java index 8123f9b7f2..17b9b9ca26 100644 --- a/src/main/java/twilightforest/world/TFGenCanopyMushroom.java +++ b/src/main/java/twilightforest/world/TFGenCanopyMushroom.java @@ -61,7 +61,7 @@ public boolean generate(World world, Random random, int x, int y, int z) // make 3-4 branches int numBranches = 3 + random.nextInt(2); - double offset = random.nextDouble(); + double offset = random.nextFloat(); for (int b = 0; b < numBranches; b++) { buildBranch(world, x, y, z, treeHeight - 5 + b, 9, 0.3 * b + offset, 0.2, false, random); @@ -114,7 +114,7 @@ void buildBranch(World world, int x, int y, int z, int height, double length, do // do this here until that bug with the lighting is fixed if (trunk) { // add a firefly (torch) to the trunk - addFirefly(world, x, y, z, 3 + treeRNG.nextInt(7), treeRNG.nextDouble()); + addFirefly(world, x, y, z, 3 + treeRNG.nextInt(7), treeRNG.nextFloat()); } drawMushroomCircle(world, dest.posX, dest.posY, dest.posZ, 4, leafBlock); diff --git a/src/main/java/twilightforest/world/TFGenCanopyOak.java b/src/main/java/twilightforest/world/TFGenCanopyOak.java index 65cfb9ddc1..0697a5c553 100644 --- a/src/main/java/twilightforest/world/TFGenCanopyOak.java +++ b/src/main/java/twilightforest/world/TFGenCanopyOak.java @@ -144,7 +144,7 @@ void buildBranch(World world, int x, int y, int z, int height, double length, do if (trunk) { // add a firefly (torch) to the trunk - addFirefly(world, x, y, z, 3 + treeRNG.nextInt(7), treeRNG.nextDouble()); + addFirefly(world, x, y, z, 3 + treeRNG.nextInt(7), treeRNG.nextFloat()); } int blobSize = 2;// + treeRNG.nextInt(2); diff --git a/src/main/java/twilightforest/world/TFGenCanopyTree.java b/src/main/java/twilightforest/world/TFGenCanopyTree.java index 0e3b87db1f..c3d25e1092 100644 --- a/src/main/java/twilightforest/world/TFGenCanopyTree.java +++ b/src/main/java/twilightforest/world/TFGenCanopyTree.java @@ -133,7 +133,7 @@ void buildBranch(World world, int x, int y, int z, int height, double length, do if (trunk) { // add a firefly (torch) to the trunk - addFirefly(world, x, y, z, 3 + treeRNG.nextInt(7), treeRNG.nextDouble()); + addFirefly(world, x, y, z, 3 + treeRNG.nextInt(7), treeRNG.nextFloat()); } makeLeafCircle(world, dest.posX, dest.posY - 1, dest.posZ, 3, leafBlock, leafMeta, true); diff --git a/src/main/java/twilightforest/world/TFGenCaveStalactite.java b/src/main/java/twilightforest/world/TFGenCaveStalactite.java index a57e88e196..76d970fecc 100644 --- a/src/main/java/twilightforest/world/TFGenCaveStalactite.java +++ b/src/main/java/twilightforest/world/TFGenCaveStalactite.java @@ -20,6 +20,7 @@ public class TFGenCaveStalactite extends TFGenerator { public static TFGenCaveStalactite iron = new TFGenCaveStalactite(Blocks.iron_ore, 0.7F, 8, 1); public static TFGenCaveStalactite coal = new TFGenCaveStalactite(Blocks.coal_ore, 0.8F, 12, 1); public static TFGenCaveStalactite glowstone = new TFGenCaveStalactite(Blocks.glowstone, 0.5F, 8, 1); + public static TFGenCaveStalactite stone = new TFGenCaveStalactite(Blocks.stone, 0.5F, 8, 1); //Bogdan-G: for no treasure public Block blockID; @@ -68,7 +69,7 @@ public static TFGenCaveStalactite makeRandomOreStalactite(Random rand, int hillS { if (hillSize >= 3 || (hillSize >= 2 && rand.nextInt(5) == 0)) { - int s3 = rand.nextInt(13); + int s3 = rand.nextInt(20);//Bogdan-G: decrease ore for stalactite, old:13 if (s3 == 0 || s3 == 1) { return diamond; @@ -84,7 +85,7 @@ else if (s3 == 4) } if (hillSize >= 2 || (hillSize >= 1 && rand.nextInt(5) == 0)) { - int s2 = rand.nextInt(6); + int s2 = rand.nextInt(10);//Bogdan-G: decrease ore for stalactite, old:6 if (s2 == 0) { return gold; @@ -96,7 +97,7 @@ else if (s2 == 1 || s2 == 2) } // fall through to size 1 - int s1 = rand.nextInt(5); + int s1 = rand.nextInt(10);//Bogdan-G: decrease ore for stalactite, old:5 if (s1 == 0 || s1 == 1) { return iron; @@ -105,10 +106,14 @@ else if (s1 == 2 || s1 == 3) { return coal; } - else + else if (s1 == 6) { return glowstone; } + else + { + return stone; + } } /** diff --git a/src/main/java/twilightforest/world/TFGenCaves.java b/src/main/java/twilightforest/world/TFGenCaves.java index 58a9d7ab1c..144d41fe77 100644 --- a/src/main/java/twilightforest/world/TFGenCaves.java +++ b/src/main/java/twilightforest/world/TFGenCaves.java @@ -34,8 +34,8 @@ protected void generateCaveNode(long caveSeed, int centerX, int centerZ, Block[] double offsetCenterZ = (double)(centerZ * 16 + 8); float var23 = 0.0F; float var24 = 0.0F; - Random caveRNG = new Random(caveSeed); - Random mossRNG = new Random(caveSeed); + Random caveRNG = new org.bogdang.modifications.random.XSTR(caveSeed); + Random mossRNG = new org.bogdang.modifications.random.XSTR(caveSeed); // if (isHighlands) { // //System.out.println("Saying highlands and it's not"); @@ -179,20 +179,23 @@ protected void generateCaveNode(long caveSeed, int centerX, int centerZ, Block[] for (genX = minX; genX < maxX; ++genX) { double var59 = ((double)(genX + centerX * 16) + 0.5D - randX) / sizeVar; + double var59d = var59*var59; for (genZ = minZ; genZ < maxZ; ++genZ) { double var46 = ((double)(genZ + centerZ * 16) + 0.5D - randZ) / sizeVar; + double var46d = var46*var46; int caveIndex = (genX * 16 + genZ) * TFWorld.CHUNKHEIGHT + minY; boolean hitGrass = false; - if (var59 * var59 + var46 * var46 < 1.0D) + if (var59d + var46d < 1.0D) { for (int caveY = minY - 1; caveY >= maxY; --caveY) { double var51 = ((double)caveY + 0.5D - randY) / scaledSize; + double var51d = var51*var51; - if (var51 > -0.7D && var59 * var59 + var51 * var51 + var46 * var46 < 20.0D) + if (var51 > -0.7D && var59d + var51d + var46d < 20.0D) { Block blockAt = blockStorage[caveIndex]; @@ -203,7 +206,7 @@ protected void generateCaveNode(long caveSeed, int centerX, int centerZ, Block[] if (blockAt != null && (blockAt == Blocks.stone || blockAt == TFBlocks.trollSteinn || blockAt.getMaterial() == Material.ground || blockAt.getMaterial() == Material.grass)) { - if (var59 * var59 + var51 * var51 + var46 * var46 < 0.85D) { + if (var59d + var51d + var46d < 0.85D) { blockStorage[caveIndex] = caveY < 10 ? Blocks.water : Blocks.air; } else { diff --git a/src/main/java/twilightforest/world/TFGenDarkCanopyTree.java b/src/main/java/twilightforest/world/TFGenDarkCanopyTree.java index cdc410537b..938ea1df6c 100644 --- a/src/main/java/twilightforest/world/TFGenDarkCanopyTree.java +++ b/src/main/java/twilightforest/world/TFGenDarkCanopyTree.java @@ -93,7 +93,7 @@ else if (materialUnder == Material.rock || materialUnder == Material.sand) { // roots! int numRoots = 3 + random.nextInt(2); - offset = random.nextDouble(); + offset = random.nextFloat(); for (int b = 0; b < numRoots; b++) { buildRoot(world, x, y, z, offset, b); @@ -139,7 +139,7 @@ void buildBranch(World world, int x, int y, int z, int height, double length, do if (Math.abs(x - dest.posX) + 2 > 7 || Math.abs(z - dest.posZ) + 2 > 7 ) { - System.out.println("getting branch too far. x = " + (x - dest.posX + 2) + ", z = " + (z - dest.posZ + 2)); + cpw.mods.fml.common.FMLLog.info("getting branch too far. x = " + (x - dest.posX + 2) + ", z = " + (z - dest.posZ + 2)); } leafAround(world, dest.posX, dest.posY, dest.posZ); diff --git a/src/main/java/twilightforest/world/TFGenFallenSmallLog.java b/src/main/java/twilightforest/world/TFGenFallenSmallLog.java index 60de90504b..300c65f9b5 100644 --- a/src/main/java/twilightforest/world/TFGenFallenSmallLog.java +++ b/src/main/java/twilightforest/world/TFGenFallenSmallLog.java @@ -40,30 +40,39 @@ public boolean generate(World world, Random rand, int x, int y, int z) { int logMeta; int logMetaBranch; + //need back; parametr?, FB - dead store fall through, overwritten, normal logic?//fix? + //test bug gen, back, back switch (rand.nextInt(7)) { - case 0: + //case 0://include in default default: logID = TFBlocks.log; logMeta = 0; + break; case 1: logID = TFBlocks.log; logMeta = 1; + break; case 2: logID = TFBlocks.log; - logMeta = 2; + logMeta = 2; + break; case 3: logID = Blocks.log; logMeta = 0; + break; case 4: logID = Blocks.log; logMeta = 1; + break; case 5: logID = Blocks.log; logMeta = 2; + break; case 6: logID = Blocks.log; logMeta = 3; + break; } logMetaBranch = logMeta; diff --git a/src/main/java/twilightforest/world/TFGenHollowTree.java b/src/main/java/twilightforest/world/TFGenHollowTree.java index 07cd4cbc6f..2051c4e65f 100644 --- a/src/main/java/twilightforest/world/TFGenHollowTree.java +++ b/src/main/java/twilightforest/world/TFGenHollowTree.java @@ -102,16 +102,16 @@ public boolean generate(World world, Random random, int x, int y, int z) { // fireflies int numFireflies = random.nextInt(3 * diameter) + 5; for (int i = 0; i <= numFireflies; i++) { - int fHeight = (int)(height * random.nextDouble() * 0.9) + (height / 10); - double fAngle = random.nextDouble(); + int fHeight = (int)(height * random.nextFloat() * 0.9) + (height / 10); + double fAngle = random.nextFloat(); addFirefly(world, x, y, z, diameter, fHeight, fAngle); } // cicadas numFireflies = random.nextInt(3 * diameter) + 5; for (int i = 0; i <= numFireflies; i++) { - int fHeight = (int)(height * random.nextDouble() * 0.9) + (height / 10); - double fAngle = random.nextDouble(); + int fHeight = (int)(height * random.nextFloat() * 0.9) + (height / 10); + double fAngle = random.nextFloat(); addCicada(world, x, y, z, diameter, fHeight, fAngle); } @@ -122,8 +122,8 @@ public boolean generate(World world, Random random, int x, int y, int z) { // 3-5 couple branches on the way up... int numBranches = random.nextInt(3) + 3; for (int i = 0; i <= numBranches; i++) { - int branchHeight = (int)(height * random.nextDouble() * 0.9) + (height / 10); - double branchRotation = random.nextDouble(); + int branchHeight = (int)(height * random.nextFloat() * 0.9) + (height / 10); + double branchRotation = random.nextFloat(); makeSmallBranch(world, random, x, y, z, diameter, branchHeight, 4, branchRotation, 0.35D, true); } @@ -193,7 +193,7 @@ protected void buildBranchRing(World world, Random random, int x, int y, int z, int numBranches = random.nextInt(maxBranches - minBranches) + minBranches; ; double branchRotation = 1.0 / (numBranches + 1); - double branchOffset = random.nextDouble(); + double branchOffset = random.nextFloat(); for (int i = 0; i <= numBranches; i++) { int dHeight; @@ -268,10 +268,10 @@ protected void buildTrunk(World world, Random random, int x, int y, int z, int d // fill it with lava! - if (dist <= hollow) { + /*if (dist <= hollow) { // just kidding! //world.setBlock(dx + x, dy + y, dz + z, Blocks.lava); - } + }*/ // how about a ladder? is that okay? if (dist == hollow && dx == hollow) { @@ -313,7 +313,7 @@ protected void makeMedBranch(World world, Random random, int sx, int sy, int sz, int numLeafBalls = random.nextInt(2) + 1; for(int i = 0; i <= numLeafBalls; i++) { - double slength = random.nextDouble() * 0.6 + 0.2; + double slength = random.nextFloat() * 0.6 + 0.2; int[] bdst = translate(src[0], src[1], src[2], slength, angle, tilt); @@ -336,8 +336,8 @@ protected void makeMedBranch(World world, Random random, int sx, int sy, int sz, for(int i = 0; i <= numShoots; i++) { angleVar = (angleInc * i) - 0.4; - outVar = (random.nextDouble() * 0.8) + 0.2; - tiltVar = (random.nextDouble() * 0.75) + 0.15; + outVar = (random.nextFloat() * 0.8) + 0.2; + tiltVar = (random.nextFloat() * 0.75) + 0.15; int[] bsrc = translate(src[0], src[1], src[2], length * outVar, angle, tilt); double slength = length * 0.4; @@ -430,8 +430,8 @@ protected void makeLargeBranch(World world, Random random, int sx, int sy, int s for (int i = 0; i <= numMedBranches; i++) { - double outVar = (random.nextDouble() * 0.3) + 0.3; - double angleVar = random.nextDouble() * 0.225 * ((i & 1) == 0 ? 1.0 : -1.0); + double outVar = (random.nextFloat() * 0.3) + 0.3; + double angleVar = random.nextFloat() * 0.225 * ((i & 1) == 0 ? 1.0 : -1.0); int[] bsrc = translate(src[0], src[1], src[2], length * outVar, angle, tilt); makeMedBranch(world, random, bsrc[0], bsrc[1], bsrc[2], length * 0.6, angle + angleVar, tilt, leafy); @@ -441,8 +441,8 @@ protected void makeLargeBranch(World world, Random random, int sx, int sy, int s int numSmallBranches = random.nextInt(2) + 1; for(int i = 0; i <= numSmallBranches; i++) { - double outVar = (random.nextDouble() * 0.25) + 0.25; - double angleVar = random.nextDouble() * 0.25 * ((i & 1) == 0 ? 1.0 : -1.0); + double outVar = (random.nextFloat() * 0.25) + 0.25; + double angleVar = random.nextFloat() * 0.25 * ((i & 1) == 0 ? 1.0 : -1.0); int[] bsrc = translate(src[0], src[1], src[2], length * outVar, angle, tilt); makeSmallBranch(world, random, bsrc[0], bsrc[1], bsrc[2], Math.max(length * 0.3, 2), angle + angleVar, tilt, leafy); diff --git a/src/main/java/twilightforest/world/TFGenHugeLilyPad.java b/src/main/java/twilightforest/world/TFGenHugeLilyPad.java index e27f885994..d54b380c60 100644 --- a/src/main/java/twilightforest/world/TFGenHugeLilyPad.java +++ b/src/main/java/twilightforest/world/TFGenHugeLilyPad.java @@ -19,7 +19,7 @@ public class TFGenHugeLilyPad extends WorldGenerator { - private Random rand = new Random(); + private Random rand = new org.bogdang.modifications.random.XSTR(); public boolean generate(World world, Random random, int x, int y, int z) diff --git a/src/main/java/twilightforest/world/TFGenLargeRainboak.java b/src/main/java/twilightforest/world/TFGenLargeRainboak.java index 3e87de971b..c3fa96afab 100644 --- a/src/main/java/twilightforest/world/TFGenLargeRainboak.java +++ b/src/main/java/twilightforest/world/TFGenLargeRainboak.java @@ -21,7 +21,7 @@ public class TFGenLargeRainboak extends TFTreeGenerator static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; /** random seed for GenBigTree */ - Random rand = new Random(); + Random rand = new org.bogdang.modifications.random.XSTR(); /** Reference to the World object. */ World worldObj; diff --git a/src/main/java/twilightforest/world/TFGenMangroveTree.java b/src/main/java/twilightforest/world/TFGenMangroveTree.java index a0ef8cbc99..f88bcfadd4 100644 --- a/src/main/java/twilightforest/world/TFGenMangroveTree.java +++ b/src/main/java/twilightforest/world/TFGenMangroveTree.java @@ -48,7 +48,7 @@ public boolean generate(World world, Random random, int x, int y, int z) // make 0-3 branches int numBranches = random.nextInt(3); - double offset = random.nextDouble(); + double offset = random.nextFloat(); for (int b = 0; b < numBranches; b++) { buildBranch(world, random, x, y, z, 7 + b, 6 + random.nextInt(2), 0.3 * b + offset, 0.25, false); @@ -56,15 +56,15 @@ public boolean generate(World world, Random random, int x, int y, int z) // make 3-5 roots int numRoots = 3 + random.nextInt(2); - offset = random.nextDouble(); + offset = random.nextFloat(); for (int i = 0; i < numRoots; i++) { - double rTilt = 0.75 + (random.nextDouble() * 0.1); + double rTilt = 0.75 + (random.nextFloat() * 0.1); buildRoot(world, x, y, z, 5, 12, 0.4 * i + offset, rTilt); } // add a firefly (torch) to the trunk - addFirefly(world, x, y, z, 5 + random.nextInt(5), random.nextDouble()); + addFirefly(world, x, y, z, 5 + random.nextInt(5), random.nextFloat()); return true; diff --git a/src/main/java/twilightforest/world/TFGenMinersTree.java b/src/main/java/twilightforest/world/TFGenMinersTree.java index d5881edba6..f73a180073 100644 --- a/src/main/java/twilightforest/world/TFGenMinersTree.java +++ b/src/main/java/twilightforest/world/TFGenMinersTree.java @@ -76,7 +76,7 @@ public boolean generate(World world, Random rand, int x, int y, int z) // roots! int numRoots = 3 + rand.nextInt(2); - double offset = rand.nextDouble(); + double offset = rand.nextFloat(); for (int b = 0; b < numRoots; b++) { buildRoot(world, x, y, z, offset, b); diff --git a/src/main/java/twilightforest/world/TFGenRavine.java b/src/main/java/twilightforest/world/TFGenRavine.java index 611a7b3411..9d55a703fd 100644 --- a/src/main/java/twilightforest/world/TFGenRavine.java +++ b/src/main/java/twilightforest/world/TFGenRavine.java @@ -25,7 +25,7 @@ protected void generateRavine(long l, int i, int j, Block blockStorage[], double double d1, double d2, float f, float f1, float f2, int k, int i1, double d3) { - Random random = new Random(l); + Random random = new org.bogdang.modifications.random.XSTR(l); double d4 = i * 16 + 8; double d5 = j * 16 + 8; float f3 = 0.0F; @@ -53,7 +53,7 @@ protected void generateRavine(long l, int i, int j, Block blockStorage[], double for (; k < i1; k++) { - double d6 = 1.5D + (double)(MathHelper.sin(((float)k * 3.141593F) / (float)i1) * f * 1.0F); + double d6 = 1.5D + (double)(MathHelper.sin(((float)k * (float)Math.PI) / (float)i1) * f * 1.0F); double d7 = d6 * d3; d6 *= (double)random.nextFloat() * 0.25D + 0.75D; d7 *= (double)random.nextFloat() * 0.25D + 0.75D; @@ -127,7 +127,7 @@ protected void generateRavine(long l, int i, int j, Block blockStorage[], double { continue; } - if (blockStorage[k3] == Blocks.water || blockStorage[k3] == Blocks.water) + if (blockStorage[k3] == Blocks.water || blockStorage[k3] == Blocks.flowing_water)//what was meant?//fix? { flag1 = true; } @@ -209,7 +209,7 @@ protected void func_151538_a(World world, int centerChunkX, int centerChunkZ, in int i1 = 1; for (int j1 = 0; j1 < i1; j1++) { - float f = rand.nextFloat() * 3.141593F * 2.0F; + float f = rand.nextFloat() * (float)Math.PI * 2.0F; float f1 = ((rand.nextFloat() - 0.5F) * 2.0F) / 8F; float f2 = (rand.nextFloat() * 2.0F + rand.nextFloat()) * 2.0F; generateRavine(rand.nextLong(), currentChunkX, currentChunkZ, shortStorage, d, d1, d2, f2, f, f1, 0, 0, 3D); diff --git a/src/main/java/twilightforest/world/TFGenerator.java b/src/main/java/twilightforest/world/TFGenerator.java index c4ada13f12..83af4b6aae 100644 --- a/src/main/java/twilightforest/world/TFGenerator.java +++ b/src/main/java/twilightforest/world/TFGenerator.java @@ -381,22 +381,18 @@ public void drawLeafBlob(World world, int sx, int sy, int sz, int rad, Block blo */ protected static boolean surroundedByAir(IBlockAccess world, int bx, int by, int bz) { boolean airAround = true; + //Bogdan-G: need 1 set false, yes? if (!world.isAirBlock(bx + 1, by, bz)) { airAround = false; - } - if (!world.isAirBlock(bx - 1, by, bz)) { + } else if (!world.isAirBlock(bx - 1, by, bz)) { airAround = false; - } - if (!world.isAirBlock(bx, by, bz + 1)) { + } else if (!world.isAirBlock(bx, by, bz + 1)) { airAround = false; - } - if (!world.isAirBlock(bx, by, bz - 1)) { + } else if (!world.isAirBlock(bx, by, bz - 1)) { airAround = false; - } - if (!world.isAirBlock(bx, by + 1, bz)) { + } else if (!world.isAirBlock(bx, by + 1, bz)) { airAround = false; - } - if (!world.isAirBlock(bx, by - 1, bz)) { + } else if (!world.isAirBlock(bx, by - 1, bz)) { airAround = false; } @@ -408,19 +404,16 @@ protected static boolean surroundedByAir(IBlockAccess world, int bx, int by, int */ protected static boolean hasAirAround(World world, int bx, int by, int bz) { boolean airAround = false; + //Bogdan-G: need 1 set true, yes? if (world.blockExists(bx + 1, by, bz) && world.getBlock(bx + 1, by, bz) == Blocks.air) { airAround = true; - } - if (world.blockExists(bx - 1, by, bz) && world.getBlock(bx - 1, by, bz) == Blocks.air) { + } else if (world.blockExists(bx - 1, by, bz) && world.getBlock(bx - 1, by, bz) == Blocks.air) { airAround = true; - } - if (world.blockExists(bx, by, bz + 1) && world.getBlock(bx, by, bz + 1) == Blocks.air) { + } else if (world.blockExists(bx, by, bz + 1) && world.getBlock(bx, by, bz + 1) == Blocks.air) { airAround = true; - } - if (world.blockExists(bx, by, bz - 1) && world.getBlock(bx, by, bz - 1) == Blocks.air) { + } else if (world.blockExists(bx, by, bz - 1) && world.getBlock(bx, by, bz - 1) == Blocks.air) { airAround = true; - } - if (world.getBlock(bx, by + 1, bz) == Blocks.air) { + } else if (world.getBlock(bx, by + 1, bz) == Blocks.air) { airAround = true; } @@ -429,16 +422,14 @@ protected static boolean hasAirAround(World world, int bx, int by, int bz) { protected static boolean isNearSolid(World world, int bx, int by, int bz) { boolean nearSolid = false; + //Bogdan-G: need 1 set true, yes? if (world.blockExists(bx + 1, by, bz) && world.getBlock(bx + 1, by, bz).getMaterial().isSolid()) { nearSolid = true; - } - if (world.blockExists(bx - 1, by, bz) && world.getBlock(bx - 1, by, bz).getMaterial().isSolid()) { + } else if (world.blockExists(bx - 1, by, bz) && world.getBlock(bx - 1, by, bz).getMaterial().isSolid()) { nearSolid = true; - } - if (world.blockExists(bx, by, bz + 1) && world.getBlock(bx, by, bz + 1).getMaterial().isSolid()) { + } else if (world.blockExists(bx, by, bz + 1) && world.getBlock(bx, by, bz + 1).getMaterial().isSolid()) { nearSolid = true; - } - if (world.blockExists(bx, by, bz - 1) && world.getBlock(bx, by, bz - 1).getMaterial().isSolid()) { + } else if (world.blockExists(bx, by, bz - 1) && world.getBlock(bx, by, bz - 1).getMaterial().isSolid()) { nearSolid = true; } diff --git a/src/main/java/twilightforest/world/TFWorldChunkManager.java b/src/main/java/twilightforest/world/TFWorldChunkManager.java index 259a9423fa..746e6912fa 100644 --- a/src/main/java/twilightforest/world/TFWorldChunkManager.java +++ b/src/main/java/twilightforest/world/TFWorldChunkManager.java @@ -325,7 +325,7 @@ public boolean isInFeatureChunk(World world, int mapX, int mapZ) { // int regionX = chunkX >> 4; // int regionZ = chunkZ >> 4; // -// long seed = (long)(regionX * 3129871) ^ (long)regionZ * 116129781L; +// long seed = (regionX * 3129871L) ^ (long)regionZ * 116129781L; // seed = seed * seed * 42317861L + seed * 7L; // // int num0 = (int) (seed >> 12 & 3L); diff --git a/src/main/java/twilightforest/world/WorldProviderTwilightForest.java b/src/main/java/twilightforest/world/WorldProviderTwilightForest.java index 90f9cdcbe6..cbf3e0c80c 100644 --- a/src/main/java/twilightforest/world/WorldProviderTwilightForest.java +++ b/src/main/java/twilightforest/world/WorldProviderTwilightForest.java @@ -27,10 +27,18 @@ public class WorldProviderTwilightForest extends WorldProviderSurface { public final String saveFolder; public ChunkProviderTwilightForest chunkProvider; + private boolean firstsetrnd = false; public WorldProviderTwilightForest() { setDimension(TwilightForestMod.dimensionID); saveFolder = "DIM" + TwilightForestMod.dimensionID; + if (!firstsetrnd) { + try{ + long seed = this.getSeed(); + TwilightForestMod.Scatter.setSeed(seed); + firstsetrnd=true; + } catch(Exception e){firstsetrnd=false;} + } } /** @@ -47,7 +55,7 @@ public float[] calcSunriseSunsetColors(float celestialAngle, float f1) { @Override public Vec3 getFogColor(float f, float f1) { - float bright = MathHelper.cos(0.25f * 3.141593F * 2.0F) * 2.0F + 0.5F; + float bright = MathHelper.cos(0.25f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; if(bright < 0.0F) { bright = 0.0F;