Worldgen and random changes

This commit is contained in:
Muramasa 2016-07-28 04:15:24 +01:00 committed by Technus
parent 676e4c4e91
commit ae471ca1a8
17 changed files with 430 additions and 141 deletions

View file

@ -13,6 +13,7 @@ import gregtech.api.enums.*;
import gregtech.api.interfaces.internal.IGT_Mod;
import gregtech.api.objects.ItemData;
import gregtech.api.objects.MaterialStack;
import gregtech.api.objects.XSTR;
import gregtech.api.util.*;
import gregtech.common.GT_DummyWorld;
import gregtech.common.GT_Network;
@ -61,7 +62,7 @@ import java.util.Map.Entry;
//import forestry.factory.tiles.TileSqueezer;
@Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:UndergroundBiomes;")
@Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl;")
public class GT_Mod
implements IGT_Mod {
public static final int VERSION = 509;
@ -244,13 +245,13 @@ public class GT_Mod
gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties.get("havestLevel", "activateHarvestLevelChange", false);
if(gregtechproxy.mChangeHarvestLevels){
gregtechproxy.mGraniteHavestLevel = (int) GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3);
gregtechproxy.mMaxHarvestLevel=(int) Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel",7));
for(Materials tMaterial : Materials.values()){
if(tMaterial!=null&&tMaterial.mToolQuality>0&&tMaterial.mMetaItemSubID<gregtechproxy.mHarvestLevel.length&&tMaterial.mMetaItemSubID>=0){
gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName,tMaterial.mToolQuality);
}
}}
gregtechproxy.mGraniteHavestLevel = (int) GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3);
gregtechproxy.mMaxHarvestLevel=(int) Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel",7));
for(Materials tMaterial : Materials.values()){
if(tMaterial!=null&&tMaterial.mToolQuality>0&&tMaterial.mMetaItemSubID<gregtechproxy.mHarvestLevel.length&&tMaterial.mMetaItemSubID>=0){
gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName,tMaterial.mToolQuality);
}
}}
if (tMainConfig.get("general", "hardermobspawners", true).getBoolean(true)) {
Blocks.mob_spawner.setHardness(500.0F).setResistance(6000000.0F);
@ -389,9 +390,9 @@ public class GT_Mod
e.printStackTrace(GT_Log.err);
}
}
new GT_Bees();
gregtechproxy.onLoad();
if (gregtechproxy.mSortToTheEnd) {
new GT_ItemIterator().run();
@ -678,11 +679,11 @@ public class GT_Mod
}
if(GregTech_API.mOutputRF||GregTech_API.mInputRF){
GT_Utility.checkAvailabilities();
if(!GT_Utility.RF_CHECK){
GregTech_API.mOutputRF = false;
GregTech_API.mInputRF = false;
}
GT_Utility.checkAvailabilities();
if(!GT_Utility.RF_CHECK){
GregTech_API.mOutputRF = false;
GregTech_API.mInputRF = false;
}
}
achievements = new GT_Achievements();
@ -770,34 +771,34 @@ public class GT_Mod
}
}
GT_Log.out.println("GT_Mod: Dungeon Loot");
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("dungeonChest").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("dungeonChest").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("bonusChest").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("bonusChest").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("villageBlacksmith").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("villageBlacksmith").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("strongholdCrossing").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("strongholdCrossing").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("strongholdLibrary").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("strongholdLibrary").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("strongholdCorridor").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("strongholdCorridor").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("pyramidJungleDispenser").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("pyramidJungleDispenser").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("pyramidJungleChest").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("pyramidJungleChest").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("pyramidDesertyChest").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("pyramidDesertyChest").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("mineshaftCorridor").getItems(new Random())) {
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("mineshaftCorridor").getItems(new XSTR())) {
tStacks.add(tContent.theItemId);
}
GT_Log.out.println("GT_Mod: Smelting");

View file

@ -46,7 +46,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Random;
import static gregtech.api.enums.GT_Values.MOD_ID_FR;
import static gregtech.api.enums.GT_Values.MOD_ID_RC;
@ -415,7 +414,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
return true;
}
if (use(aStack, (int) aAmount, null)) {
if (new Random().nextInt(25) == 0) {
if (java.util.concurrent.ThreadLocalRandom.current().nextInt(0, 25) == 0) {
long tNewDamage = getToolDamage(aStack) + aAmount;
setToolDamage(aStack, tNewDamage);
if (tNewDamage >= getToolMaxDamage(aStack)) {

View file

@ -12,6 +12,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.Entity;
@ -264,7 +265,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ);
for (byte i = 0; i < 6; i++)
for (int l = 0; l < 2; ++l)
getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + Math.random(), aY - 0.5 + Math.random(), aZ - 0.5 + Math.random(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0);
getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + (new XSTR()).nextFloat(), aY - 0.5 + (new XSTR()).nextFloat(), aZ - 0.5 + (new XSTR()).nextFloat(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0);
}
}

View file

@ -6,6 +6,7 @@ import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.EntityLivingBase;
@ -149,7 +150,7 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE
if (aIndex == 9) {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ);
for (int l = 0; l < 8; ++l)
getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + Math.random(), aY - 0.5 + Math.random(), aZ - 0.5 + Math.random(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0);
getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + (new XSTR()).nextFloat(), aY - 0.5 + (new XSTR()).nextFloat(), aZ - 0.5 + (new XSTR()).nextFloat(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0);
}
}

View file

@ -0,0 +1,255 @@
package gregtech.api.objects;
/**
* 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
*/
import java.util.Random;
import java.util.concurrent.atomic.AtomicLong;
/**
* 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
* <code>setSeed(System.currentTimeMillis());</code>.
*/
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 <code>setSeed(seed);</code>.
*
* @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:
* <pre> {@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;
* }}</pre>
*
* <p>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.
* <p>
* 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.
* <p>
* 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 <i>low-order</i> 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;
}
}

View file

@ -177,7 +177,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo {
@Override
public ItemStack getGain(ICropTile aCrop) {
int tDrop = 0;
if (mSpecialDrops != null && (tDrop = new Random().nextInt((mSpecialDrops.length*2) + 2)) < mSpecialDrops.length && mSpecialDrops[tDrop] != null) {
if (mSpecialDrops != null && (tDrop = java.util.concurrent.ThreadLocalRandom.current().nextInt(0, (mSpecialDrops.length*2) + 2)) < mSpecialDrops.length && mSpecialDrops[tDrop] != null) {
return GT_Utility.copy(mSpecialDrops[tDrop]);
}
return GT_Utility.copy(mDrop);

View file

@ -21,38 +21,44 @@ public class GT_Worldgen_Boulder extends GT_Worldgen_Ore {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
Block tBlock = aWorld.getBlock(tX, tY - 7, tZ);
if (tBlock != null && tBlock.isOpaqueCube() && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) {
float var6 = aRandom.nextFloat() * (float) Math.PI;
double var7 = ((tX + 8) + MathHelper.sin(var6) * mSize / 8.0F);
double var9 = ((tX + 8) - MathHelper.sin(var6) * mSize / 8.0F);
double var11 = ((tZ + 8) + MathHelper.cos(var6) * mSize / 8.0F);
double var13 = ((tZ + 8) - MathHelper.cos(var6) * mSize / 8.0F);
double var15 = (tY + aRandom.nextInt(3) - 2);
double var17 = (tY + aRandom.nextInt(3) - 2);
float math_pi = 3.141593F;
float var6 = aRandom.nextFloat() * math_pi;
float var1b = mSize / 8.0F;
float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b;
float var8b = -2*var3b;float var9b = -2*var4b;
int var10b = (tX + 8);int var11b = (tZ + 8);
float var7 = (var10b + var3b);
float var11 = (var11b + var4b);
int var5b = aRandom.nextInt(3);int var6b = aRandom.nextInt(3);int var7b = var6b - var5b;
float var15 = (tY + var5b - 2);
float var12b = math_pi / mSize;
for (int var19 = 0; var19 <= mSize; ++var19) {
double var20 = var7 + (var9 - var7) * var19 / mSize;
double var22 = var15 + (var17 - var15) * var19 / mSize;
double var24 = var11 + (var13 - var11) * var19 / mSize;
double var26 = aRandom.nextDouble() * mSize / 16.0D;
double var28 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
float var2b = var19 / mSize;
float var20 = var7 + var8b * var2b;
float var22 = var15 + var7b * var2b;
float var24 = var11 + var9b * var2b;
float var26 = aRandom.nextFloat() * mSize / 16.0F;
float var28 = ((MathHelper.sin(var19 * var12b) + 1.0F) * var26 + 1.0F) / 2.0F;
int var32 = MathHelper.floor_float(var20 - var28);
int var33 = MathHelper.floor_float(var22 - var28);
int var34 = MathHelper.floor_float(var24 - var28);
int var35 = MathHelper.floor_float(var20 + var28);
int var36 = MathHelper.floor_float(var22 + var28);
int var37 = MathHelper.floor_float(var24 + var28);
for (int var38 = var32; var38 <= var35; ++var38) {
double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D) {
float var39 = (var38 + 0.5F - var20) / (var28);
float var13b = var39 * var39;
if (var13b < 1.0F) {
for (int var41 = var33; var41 <= var36; ++var41) {
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D) {
float var42 = (var41 + 0.5F - var22) / (var28);
float var14b = var13b + var42 * var42;
if (var14b < 1.0F) {
for (int var44 = var34; var44 <= var37; ++var44) {
double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
float var45 = (var44 + 0.5F - var24) / (var28);
Block block = aWorld.getBlock(var38, var41, var44);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && !(block instanceof BlockContainer)))) {
if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && !(block instanceof BlockContainer)))) {
aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0);
}
}

View file

@ -20,38 +20,43 @@ public class GT_Worldgen_Ore_Normal extends GT_Worldgen_Ore {
for (int i = 0; i < mAmount; i++) {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) {
float var6 = aRandom.nextFloat() * (float) Math.PI;
double var7 = ((tX + 8) + MathHelper.sin(var6) * mSize / 8.0F);
double var9 = ((tX + 8) - MathHelper.sin(var6) * mSize / 8.0F);
double var11 = ((tZ + 8) + MathHelper.cos(var6) * mSize / 8.0F);
double var13 = ((tZ + 8) - MathHelper.cos(var6) * mSize / 8.0F);
double var15 = (tY + aRandom.nextInt(3) - 2);
double var17 = (tY + aRandom.nextInt(3) - 2);
float math_pi = 3.141593F;float var1b = mSize / 8.0F;
float var6 = aRandom.nextFloat() * math_pi;
float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b;
float var8b = -2*var3b;float var9b = -2*var4b;
int var10b = (tX + 8);int var11b = (tZ + 8);
float var7 = (var10b + var3b);
float var11 = (var11b + var4b);
int var5b = aRandom.nextInt(3);int var6b = aRandom.nextInt(3);int var7b = var6b - var5b;
float var15 = (tY + var5b - 2);
float var12b = math_pi / mSize;
for (int var19 = 0; var19 <= mSize; ++var19) {
double var20 = var7 + (var9 - var7) * var19 / mSize;
double var22 = var15 + (var17 - var15) * var19 / mSize;
double var24 = var11 + (var13 - var11) * var19 / mSize;
double var26 = aRandom.nextDouble() * mSize / 16.0D;
double var28 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
float var2b = var19 / mSize;
float var20 = var7 + var8b * var2b;
float var22 = var15 + var7b * var2b;
float var24 = var11 + var9b * var2b;
float var26 = aRandom.nextFloat() * mSize / 16.0F;
float var28 = ((MathHelper.sin(var19 * var12b) + 1.0F) * var26 + 1.0F) / 2.0F;
int var32 = MathHelper.floor_float(var20 - var28);
int var33 = MathHelper.floor_float(var22 - var28);
int var34 = MathHelper.floor_float(var24 - var28);
int var35 = MathHelper.floor_float(var20 + var28);
int var36 = MathHelper.floor_float(var22 + var28);
int var37 = MathHelper.floor_float(var24 + var28);
for (int var38 = var32; var38 <= var35; ++var38) {
double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D) {
float var39 = (var38 + 0.5F - var20) / (var28);
float var13b = var39 * var39;
if (var13b < 1.0F) {
for (int var41 = var33; var41 <= var36; ++var41) {
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D) {
float var42 = (var41 + 0.5F - var22) / (var28);
float var14b = var13b + var42 * var42;
if (var14b < 1.0F) {
for (int var44 = var34; var44 <= var37; ++var44) {
double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
float var45 = (var44 + 0.5F - var24) / (var28);
Block block = aWorld.getBlock(var38, var41, var44);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && (block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.end_stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.netherrack))))) {
if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld.getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) || (block != null && (block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.end_stone) || block.isReplaceableOreGen(aWorld, var38, var41, var44, Blocks.netherrack))))) {
aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0);
}
}

View file

@ -29,36 +29,45 @@ public class GT_MinableOreGenerator
}
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) {
float var6 = par2Random.nextFloat() * 3.141593F;
double var7 = par3 + 8 + MathHelper.sin(var6) * this.numberOfBlocks / 8.0F;
double var9 = par3 + 8 - MathHelper.sin(var6) * this.numberOfBlocks / 8.0F;
double var11 = par5 + 8 + MathHelper.cos(var6) * this.numberOfBlocks / 8.0F;
double var13 = par5 + 8 - MathHelper.cos(var6) * this.numberOfBlocks / 8.0F;
double var15 = par4 + par2Random.nextInt(3) - 2;
double var17 = par4 + par2Random.nextInt(3) - 2;
float math_pi = 3.141593F;//FB: CNT - CNT_ROUGH_CONSTANT_VALUE
float var6 = par2Random.nextFloat() * math_pi;
float var1s = this.numberOfBlocks / 8.0F;
int var4s = par4 - 2;int var5s = par3 + 8;int var6s = par5 + 8;
float var7s = this.numberOfBlocks / 16.0F;
float var8s = math_pi / this.numberOfBlocks;
float mh_s_0 = MathHelper.sin(var6) * var1s;float mh_c_0 = MathHelper.cos(var6) * var1s;
float var7 = var5s + mh_s_0;
float var11 = var6s + mh_c_0;
int var15r = par2Random.nextInt(3);int var17r = par2Random.nextInt(3);
int mh_n_4=var17r - var15r;
int var15 = var4s + var15r;
float mh_n_0 = -2*mh_s_0;float mh_n_1 = -2*mh_c_0;
for (int var19 = 0; var19 <= this.numberOfBlocks; var19++) {
double var20 = var7 + (var9 - var7) * var19 / this.numberOfBlocks;
double var22 = var15 + (var17 - var15) * var19 / this.numberOfBlocks;
double var24 = var11 + (var13 - var11) * var19 / this.numberOfBlocks;
double var26 = par2Random.nextDouble() * this.numberOfBlocks / 16.0D;
double var28 = (MathHelper.sin(var19 * 3.141593F / this.numberOfBlocks) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * 3.141593F / this.numberOfBlocks) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
float mh_n_2 = var19 / this.numberOfBlocks;
float var20 = var7 + mh_n_0 * mh_n_2;
float var22 = var15 + mh_n_4 * mh_n_2;
float var24 = var11 + mh_n_1 * mh_n_2;
float var26 = par2Random.nextFloat() * var7s;
float var1c = var19 * var8s;
float var28 = ((MathHelper.sin(var1c) + 1.0F) * var26 + 1.0F) / 2.0F;
int var32 = MathHelper.floor_float(var20 - var28);
int var33 = MathHelper.floor_float(var22 - var28);
int var34 = MathHelper.floor_float(var24 - var28);
int var35 = MathHelper.floor_float(var20 + var28);
int var36 = MathHelper.floor_float(var22 + var28);
int var37 = MathHelper.floor_float(var24 + var28);
for (int var38 = var32; var38 <= var35; var38++) {
double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D) {
float var39 = (var38 + 0.5F - var20) / (var28);
float var5c = var39 * var39;
if (var5c < 1.0F) {
for (int var41 = var33; var41 <= var36; var41++) {
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D) {
float var42 = (var41 + 0.5F - var22) / (var28);
float var7c = var5c + var42 * var42;
if (var7c < 1.0F) {
for (int var44 = var34; var44 <= var37; var44++) {
double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
float var45 = (var44 + 0.5F - var24) / (var28);
Block block = par1World.getBlock(var38, var41, var44);
if ((var39 * var39 + var42 * var42 + var45 * var45 < 1.0D) && (((this.allowVoid) && (par1World.getBlock(var38, var41, var44) == Blocks.air)) || ((block != null) && (block.isReplaceableOreGen(par1World, var38, var41, var44, this.mBlock))))) {
if ((var7c + var45 * var45 < 1.0F) && (((this.allowVoid) && (par1World.getBlock(var38, var41, var44) == Blocks.air)) || ((block != null) && (block.isReplaceableOreGen(par1World, var38, var41, var44, this.mBlock))))) {
par1World.setBlock(var38, var41, var44, this.minableBlockId, this.minableBlockMeta, 0);
}
}

View file

@ -6,6 +6,7 @@ import gregtech.api.enums.Materials;
import gregtech.api.world.GT_Worldgen;
import gregtech.common.blocks.GT_TileEntity_Ores;
import gregtech.loaders.misc.GT_Achievements;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
@ -73,22 +74,22 @@ public class GT_Worldgen_GT_Ore_Layer
for (int tZ = cZ; tZ <= eZ; tZ++) {
if (this.mSecondaryMeta > 0) {
for (int i = tMinY - 1; i < tMinY + 2; i++) {
if ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0)) {
if ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false);
}
}
}
if ((this.mBetweenMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0))) {
if ((this.mBetweenMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0))) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false);
}
if (this.mPrimaryMeta > 0) {
for (int i = tMinY + 3; i < tMinY + 6; i++) {
if ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0)) {
if ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0)) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false);
}
}
}
if ((this.mSporadicMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0))) {
if ((this.mSporadicMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) / this.mDensity)) == 0))) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false);
}
}

View file

@ -27,40 +27,45 @@ public class GT_Worldgen_Stone
int tY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY);
int tZ = aChunkZ + aRandom.nextInt(16);
if ((this.mAllowToGenerateinVoid) || (!aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ))) {
float var6 = aRandom.nextFloat() * 3.141593F;
double var7 = tX + 8 + MathHelper.sin(var6) * this.mSize / 8.0F;
double var9 = tX + 8 - MathHelper.sin(var6) * this.mSize / 8.0F;
double var11 = tZ + 8 + MathHelper.cos(var6) * this.mSize / 8.0F;
double var13 = tZ + 8 - MathHelper.cos(var6) * this.mSize / 8.0F;
double var15 = tY + aRandom.nextInt(3) - 2;
double var17 = tY + aRandom.nextInt(3) - 2;
float math_pi = 3.141593F;//FB: CNT - CNT_ROUGH_CONSTANT_VALUE
float var6 = aRandom.nextFloat() * math_pi;
float var1d = this.mSize / 8.0F;int var2d = tX + 8;int var3d = tZ + 8;int var4d = tY - 2;
float mh_s_0 = MathHelper.sin(var6) * var1d;float mh_c_0 = MathHelper.cos(var6) * var1d;
float var7 = var2d + mh_s_0;
float var11 = var3d + mh_c_0;
int var15r = aRandom.nextInt(3);int var17r = aRandom.nextInt(3);
int var15 = var4d + var15r;
int mh_n_4=var17r - var15r;
float mh_n_0 = -2*mh_s_0;float mh_n_1 = -2*mh_c_0;
for (int var19 = 0; var19 <= this.mSize; var19++) {
double var20 = var7 + (var9 - var7) * var19 / this.mSize;
double var22 = var15 + (var17 - var15) * var19 / this.mSize;
double var24 = var11 + (var13 - var11) * var19 / this.mSize;
double var26 = aRandom.nextDouble() * this.mSize / 16.0D;
double var28 = (MathHelper.sin(var19 * 3.141593F / this.mSize) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * 3.141593F / this.mSize) + 1.0F) * var26 + 1.0D;
int tMinX = MathHelper.floor_double(var20 - var28 / 2.0D);
int tMinY = MathHelper.floor_double(var22 - var30 / 2.0D);
int tMinZ = MathHelper.floor_double(var24 - var28 / 2.0D);
int tMaxX = MathHelper.floor_double(var20 + var28 / 2.0D);
int tMaxY = MathHelper.floor_double(var22 + var30 / 2.0D);
int tMaxZ = MathHelper.floor_double(var24 + var28 / 2.0D);
float var5d = var19 / this.mSize;
float var20 = var7 + mh_n_0 * var5d;
float var22 = var15 + mh_n_4 * var5d;
float var24 = var11 + mh_n_1 * var5d;
float var6d = var19 * math_pi / this.mSize;
float var26 = aRandom.nextFloat() * this.mSize / 16.0F;
float var28 = ((MathHelper.sin(var6d) + 1.0F) * var26 + 1.0F) / 2.0F;
int tMinX = MathHelper.floor_float(var20 - var28);
int tMinY = MathHelper.floor_float(var22 - var28);
int tMinZ = MathHelper.floor_float(var24 - var28);
int tMaxX = MathHelper.floor_float(var20 + var28);
int tMaxY = MathHelper.floor_float(var22 + var28);
int tMaxZ = MathHelper.floor_float(var24 + var28);
for (int eX = tMinX; eX <= tMaxX; eX++) {
double var39 = (eX + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D) {
float var39 = (eX + 0.5F - var20) / (var28);
float var10d = var39 * var39;
if (var10d < 1.0F) {
for (int eY = tMinY; eY <= tMaxY; eY++) {
double var42 = (eY + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D) {
float var42 = (eY + 0.5F - var22) / (var28);
float var12d = var10d + var42 * var42;
if (var12d < 1.0F) {
for (int eZ = tMinZ; eZ <= tMaxZ; eZ++) {
double var45 = (eZ + 0.5D - var24) / (var28 / 2.0D);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D) {
float var45 = (eZ + 0.5F - var24) / (var28);
if (var12d + var45 * var45 < 1.0F) {
Block tTargetedBlock = aWorld.getBlock(eX, eY, eZ);
if (tTargetedBlock instanceof GT_Block_Ores_Abstract) {
TileEntity tTileEntity = aWorld.getTileEntity(eX, eY, eZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
short aMeta = ((GT_TileEntity_Ores) tTileEntity).mMetaData;
if (tTargetedBlock != GregTech_API.sBlockOres1) {
((GT_TileEntity_Ores) tTileEntity).convertOreBlock(aWorld, eX, eY, eZ);
}

View file

@ -3,6 +3,7 @@ package gregtech.common;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_Log;
import gregtech.api.world.GT_Worldgen;
import gregtech.common.blocks.GT_TileEntity_Ores;
@ -40,7 +41,7 @@ public class GT_Worldgenerator
}
public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
this.mList.add(new WorldGenContainer(new Random(aRandom.nextInt()), aX * 16, aZ * 16, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName));
this.mList.add(new WorldGenContainer(new XSTR(aRandom.nextInt()), aX * 16, aZ * 16, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName));
if (!this.mIsGenerating) {
this.mIsGenerating = true;
for (int i = 0; i < this.mList.size(); i++) {

View file

@ -12,6 +12,7 @@ import gregtech.api.items.GT_Generic_Block;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.metatileentity.BaseTileEntity;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_BaseCrop;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
@ -308,7 +309,7 @@ public class GT_Block_Machines
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof IGregTechTileEntity)) {
IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
Random tRandom = new Random();
Random tRandom = new XSTR();
mTemporaryTileEntity.set(tGregTechTileEntity);
for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) {
ItemStack tItem = tGregTechTileEntity.getStackInSlot(i);

View file

@ -9,6 +9,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
@ -194,7 +195,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
aFortune = 0;
}
if (aMaterial != null) {
Random tRandom = new Random(this.xCoord ^ this.yCoord ^ this.zCoord);
Random tRandom = new XSTR(this.xCoord ^ this.yCoord ^ this.zCoord);
ArrayList<ItemStack> tSelector = new ArrayList();

View file

@ -5,6 +5,7 @@ import gregtech.api.enums.Materials;
import gregtech.api.items.GT_MetaBase_Item;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.objects.ItemData;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
@ -87,7 +88,7 @@ public class Behaviour_Prospecting
break;
}
}
Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide);
Random tRandom = new XSTR(aX ^ aY ^ aZ ^ aSide);
i = 0;
for (int j = 9 + 2 * tQuality; i < j; i++) {
tX = aX - 4 - tQuality + tRandom.nextInt(j);

View file

@ -7,6 +7,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
@ -255,7 +256,7 @@ public abstract class GT_MetaTileEntity_Boiler
if (aIndex == 1) {
GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(4)), 2, 1.0F, aX, aY, aZ);
for (int l = 0; l < 8; l++) {
getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5D + Math.random(), aY, aZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5D + (new XSTR()).nextFloat(), aY, aZ - 0.5D + (new XSTR()).nextFloat(), 0.0D, 0.0D, 0.0D);
}
}
}

View file

@ -10,6 +10,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_Container_BronzeBlastFurnace;
@ -185,7 +186,7 @@ public class GT_MetaTileEntity_BronzeBlastFurnace
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
if ((aBaseMetaTileEntity.isClientSide()) &&
(aBaseMetaTileEntity.isActive())) {
aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), 0.0D, 0.3D, 0.0D);
aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D);
}
if (aBaseMetaTileEntity.isServerSide()) {
if (this.mUpdate-- == 0) {