oregen lag fix

This commit is contained in:
Dragon2488 2016-09-22 22:00:27 +07:00
parent dda2aa95a2
commit 5509d94044
11 changed files with 418 additions and 182 deletions

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

@ -7,16 +7,13 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
public abstract class GT_Worldgen {
public final String mWorldGenName;
public final boolean mEnabled;
private final Map<String, Boolean> mDimensionMap = new HashMap<String, Boolean>();
public GT_Worldgen(String aName, List aList, boolean aDefault) {
mWorldGenName = aName;
@ -51,30 +48,32 @@ public abstract class GT_Worldgen {
}
public boolean isDimensionAllowed(World aWorld, int aDimensionType, boolean nether, boolean overworld, boolean end) {
String aDimName = aWorld.getProviderName();
/*String aDimName = aWorld.getProviderName();
Boolean tAllowed = mDimensionMap.get(aDimName);
if (tAllowed == null) {
boolean tValue = GregTech_API.sWorldgenFile.get("worldgen.dimensions." + mWorldGenName, aDimName, ((aDimensionType == -1) && nether) || ((aDimensionType == 0) && overworld) || ((aDimensionType == 1) && end));
mDimensionMap.put(aDimName, tValue);
return tValue;
}
return tAllowed;
return tAllowed;*/
return (aDimensionType == 0 && overworld) || (aDimensionType == -1 && nether) || (aDimensionType == 1 & end);
}
public boolean isDimensionAllowed(World aWorld, int aDimensionType, int exceptedDimension) {
String aDimName = aWorld.getProviderName();
/*String aDimName = aWorld.getProviderName();
Boolean tAllowed = mDimensionMap.get(aDimName);
if (tAllowed == null) {
boolean tValue = GregTech_API.sWorldgenFile.get("worldgen.dimensions." + mWorldGenName, aDimName, aDimensionType == exceptedDimension);
mDimensionMap.put(aDimName, tValue);
return tValue;
}
return tAllowed;
return tAllowed;*/
return aDimensionType == 0 || aDimensionType == -1 || aDimensionType == 1 || aDimensionType == exceptedDimension;
}
public boolean isGenerationAllowed(World aWorld, BlockPos blockPos) {
IBlockState blockState = aWorld.getBlockState(blockPos);
return blockState.getBlock().isReplaceableOreGen(blockState, aWorld, blockPos, GT_Worldgen_Ore_Normal.ANY);
return GT_Worldgen_Constants.ANY.apply(blockState);
}
}

View file

@ -18,7 +18,7 @@ import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Random;
public class GT_Worldgen_Ore_Normal {
public class GT_Worldgen_Constants {
public static Predicate<IBlockState> STONES = input ->

View file

@ -1,9 +1,8 @@
package gregtech.common;
import gregtech.api.world.GT_Worldgen_Ore_Normal;
import gregtech.api.world.GT_Worldgen_Constants;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
@ -65,7 +64,7 @@ public class GT_MinableOreGenerator
BlockPos block = new BlockPos(var38, var41, var44);
IBlockState blockState = par1World.getBlockState(block);
if ((var39 * var39 + var42 * var42 + var45 * var45 < 1.0D) && ((this.allowVoid && par1World.isAirBlock(block)) ||
(block != null && (blockState.getBlock().isReplaceableOreGen(blockState, par1World, pos, GT_Worldgen_Ore_Normal.ANY))))) {
(block != null && (blockState.getBlock().isReplaceableOreGen(blockState, par1World, pos, GT_Worldgen_Constants.ANY))))) {
par1World.setBlockState(block, this.minableBlockId.getStateFromMeta(minableBlockMeta));
}
}

View file

@ -10,6 +10,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import org.apache.commons.lang3.time.StopWatch;
import java.util.ArrayList;
import java.util.Random;
@ -60,12 +61,15 @@ public class GT_Worldgen_GT_Ore_Layer
@Override
public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
if (!this.mBiome.equals("None") && !(this.mBiome.equals(aBiome))) {
return false; //Not the correct biome for ore mix
}
//if (!this.mBiome.equals("None") && !(this.mBiome.equals(aBiome))) {
// return false; //Not the correct biome for ore mix
//}
if (!isDimensionAllowed(aWorld, aDimensionType, mNether, mOverworld, mEnd)) {
return false;
}
//StopWatch watch = new StopWatch();
//watch.start();
int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5);
int cX = aChunkX - aRandom.nextInt(this.mSize);
@ -108,9 +112,10 @@ public class GT_Worldgen_GT_Ore_Layer
}
}
}
if (GT_Values.D1) {
System.out.println("Generated Orevein: " + this.mWorldGenName);
}
//watch.stop();
//if (GT_Values.D1) {
//System.out.println("Generated Orevein: " + watch.getTime() + " ms " + this.mWorldGenName + " X: " + (aChunkX * 16) + " Z: " + (aChunkZ * 16));
//}
return true;
}
}

View file

@ -36,9 +36,9 @@ public class GT_Worldgen_GT_Ore_SmallPieces
@Override
public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
if (!this.mBiome.equals("None") && !(this.mBiome.equals(aBiome))) {
return false; //Not the correct biome for ore mix
}
//if (!this.mBiome.equals("None") && !(this.mBiome.equals(aBiome))) {
// return false; //Not the correct biome for ore mix
//}
if (!isDimensionAllowed(aWorld, aDimensionType, mNether, mOverworld, mEnd)) {
return false;
}

View file

@ -2,7 +2,7 @@ package gregtech.common;
import gregtech.api.GregTech_API;
import gregtech.api.world.GT_Worldgen_Ore;
import gregtech.api.world.GT_Worldgen_Ore_Normal;
import gregtech.api.world.GT_Worldgen_Constants;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
import net.minecraft.block.Block;
@ -71,7 +71,7 @@ public class GT_Worldgen_Stone
((GT_TileEntity_Ores)tTileEntity).overrideOreBlockMaterial(this.mBlock, (byte) this.mBlockMeta);
}
} else if ((this.mAllowToGenerateinVoid && aWorld.isAirBlock(randPos)) ||
(tTargetedBlock != null && tTargetedBlock.getBlock().isReplaceableOreGen(tTargetedBlock, aWorld, randPos, GT_Worldgen_Ore_Normal.ANY))) {
(tTargetedBlock != null && tTargetedBlock.getBlock().isReplaceableOreGen(tTargetedBlock, aWorld, randPos, GT_Worldgen_Constants.ANY))) {
aWorld.setBlockState(randPos, this.mBlock.getStateFromMeta(mBlockMeta));
}
}

View file

@ -1,5 +1,6 @@
package gregtech.common;
import gregtech.api.objects.XSTR;
import net.minecraft.init.Biomes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@ -44,49 +45,33 @@ public class GT_Worldgenerator implements IWorldGenerator {
@Override
public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
if(aRandom.nextInt(3) == 0) {
Biome biome = aWorld.getBiomeGenForCoords(new BlockPos(aX * 16 + 8, 16, aZ * 16 + 8));
new WorldGenContainer(aRandom, aX * 16, aZ * 16,
(aChunkGenerator instanceof ChunkProviderEnd || biome == Biomes.SKY) ? 1 :
(aChunkGenerator instanceof ChunkProviderHell || biome == Biomes.HELL) ? -1 : 0,
aWorld, aChunkGenerator, aChunkProvider, biome.getBiomeName()).run();
}
Random xstrRandom = new XSTR(aRandom.nextLong() ^ System.nanoTime());
Biome biome = aWorld.getBiomeGenForCoords(new BlockPos(aX * 16, 64, aZ * 16));
generateInternal(xstrRandom, aX * 16, aZ * 16,
getDimensionType(aChunkGenerator, biome),
aWorld, aChunkGenerator, aChunkProvider,
biome.getBiomeName());
}
public static class WorldGenContainer
implements Runnable {
public final Random mRandom;
public final int mX;
public final int mZ;
public final int mDimensionType;
public final World mWorld;
public final IChunkGenerator mChunkGenerator;
public final IChunkProvider mChunkProvider;
public final String mBiome;
public WorldGenContainer(Random aRandom, int aX, int aZ, int aDimensionType, World aWorld, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider, String aBiome) {
this.mRandom = aRandom;
this.mX = aX;
this.mZ = aZ;
this.mDimensionType = aDimensionType;
this.mWorld = aWorld;
this.mChunkGenerator = aChunkGenerator;
this.mChunkProvider = aChunkProvider;
this.mBiome = aBiome;
private int getDimensionType(IChunkGenerator aChunkGenerator, Biome biome) {
return (aChunkGenerator instanceof ChunkProviderEnd || biome == Biomes.SKY) ? 1 :
(aChunkGenerator instanceof ChunkProviderHell || biome == Biomes.HELL) ? -1 : 0;
}
public void run() {
if ((Math.abs(this.mX / 16) % 3 == 1) && (Math.abs(this.mZ / 16) % 3 == 1)) {
private void generateInternal(Random mRandom, int mX, int mZ, int mDimensionType, World mWorld, IChunkGenerator mChunkGenerator, IChunkProvider mChunkProvider, String mBiome) {
if ((Math.abs(mX / 16) % 3 == 1) && (Math.abs(mZ / 16) % 3 == 1)) {
if ((GT_Worldgen_GT_Ore_Layer.sWeight > 0) && (GT_Worldgen_GT_Ore_Layer.sList.size() > 0)) {
boolean temp = true;
int tRandomWeight;
for (int i = 0; (i < 256) && (temp); i++) {
tRandomWeight = this.mRandom.nextInt(GT_Worldgen_GT_Ore_Layer.sWeight);
tRandomWeight = mRandom.nextInt(GT_Worldgen_GT_Ore_Layer.sWeight);
for (GT_Worldgen tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) {
tRandomWeight -= ((GT_Worldgen_GT_Ore_Layer) tWorldGen).mWeight;
if (tRandomWeight <= 0) {
try {
if (tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, this.mX, this.mZ, this.mChunkGenerator, this.mChunkProvider)) {
if (tWorldGen.executeWorldgen(mWorld, mRandom, mBiome, mDimensionType, mX, mZ, mChunkGenerator, mChunkProvider)) {
temp = false;
}
break;
@ -98,16 +83,16 @@ public class GT_Worldgenerator implements IWorldGenerator {
}
}
int i = 0;
for (int tX = this.mX - 16; i < 3; tX += 16) {
for (int tX = mX - 16; i < 3; tX += 16) {
int j = 0;
for (int tZ = this.mZ - 16; j < 3; tZ += 16) {
String tBiome = this.mWorld.getBiomeGenForCoords(new BlockPos(tX + 8, 0, tZ + 8)).getBiomeName();
for (int tZ = mZ - 16; j < 3; tZ += 16) {
String tBiome = mWorld.getBiomeGenForCoords(new BlockPos(tX + 8, 0, tZ + 8)).getBiomeName();
if (tBiome == null) {
tBiome = Biomes.PLAINS.getBiomeName();
}
for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) {
try {
tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, tX, tZ, this.mChunkGenerator, this.mChunkProvider);
tWorldGen.executeWorldgen(mWorld, mRandom, mBiome, mDimensionType, tX, tZ, mChunkGenerator, mChunkProvider);
} catch (Throwable e) {
e.printStackTrace(GT_Log.err);
}
@ -118,7 +103,7 @@ public class GT_Worldgenerator implements IWorldGenerator {
}
}
//Asteroid Worldgen
int tDimensionType = this.mWorld.provider.getDimension();
int tDimensionType = mWorld.provider.getDimension();
Random aRandom = new Random();
if (((tDimensionType == 1) && endAsteroids && ((mEndAsteroidProbability <= 1) || (aRandom.nextInt(mEndAsteroidProbability) == 0)))) {
short primaryMeta = 0;
@ -188,13 +173,13 @@ public class GT_Worldgenerator implements IWorldGenerator {
if ((var39 * var39 + var42 * var42 + var45 * var45 < 1.0D) && mWorld.isAirBlock(randPos)) {
int ranOre = aRandom.nextInt(50);
if (ranOre < 3) {
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, primaryMeta , true);
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, primaryMeta, true);
} else if (ranOre < 6) {
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, secondaryMeta , true);
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, secondaryMeta, true);
} else if (ranOre < 8) {
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, betweenMeta , true);
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, betweenMeta, true);
} else if (ranOre < 10) {
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, sporadicMeta , true);
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, sporadicMeta, true);
} else {
mWorld.setBlockState(randPos, Blocks.END_STONE.getDefaultState());
}
@ -206,10 +191,7 @@ public class GT_Worldgenerator implements IWorldGenerator {
}
}
}
}
}
}
Chunk tChunk = this.mWorld.getChunkFromBlockCoords(new BlockPos(this.mX, 0, this.mZ));
if (tChunk != null) tChunk.setModified(true);
}
}
}

View file

@ -51,7 +51,7 @@ public class GT_TickHandler_Ores {
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent player) {
if(player.side.isServer()) {
/*if(player.side.isServer()) {
EntityPlayer entityPlayer = player.player;
World world = entityPlayer.worldObj;
if (world.getWorldTime() % 10 == 0) {
@ -71,7 +71,7 @@ public class GT_TickHandler_Ores {
GT_Values.NW.sendTo(packet_ores, (EntityPlayerMP) entityPlayer);
}
}
}
}*/
}

View file

@ -2,7 +2,6 @@ package gregtech.common.blocks;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
@ -10,16 +9,14 @@ import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.api.world.GT_Worldgen_Ore_Normal;
import gregtech.api.world.GT_Worldgen_Constants;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@ -88,7 +85,6 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
} else if(tBlock == GregTech_API.sBlockStones && BlockMeta == 8) {
aMetaData += 6000;
}
aWorld.setBlockState(blockPos, tOreBlock.getStateFromMeta(getHarvestData((short) aMetaData)), 0);
TileEntity tTileEntity = aWorld.getTileEntity(blockPos);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
@ -142,7 +138,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
} else {
this.mMetaData = ((short) (this.mMetaData + 3000));
}
} else if (aOverridingStoneBlock.isReplaceableOreGen(worldObj.getBlockState(getPos()), this.worldObj, getPos(), GT_Worldgen_Ore_Normal.ANY)) {
} else if (aOverridingStoneBlock.isReplaceableOreGen(worldObj.getBlockState(getPos()), this.worldObj, getPos(), GT_Worldgen_Constants.ANY)) {
if (aOverridingStoneBlock == GregTech_API.sBlockStones) {
if (aOverridingStoneMeta < 8) {
this.mMetaData = ((short) (this.mMetaData + 5000));
@ -156,17 +152,17 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
this.worldObj.setBlockState(getPos(), getBlockType().getStateFromMeta(getHarvestData(this.mMetaData)), 0);
}
@Override
public void invalidate() {
super.invalidate();
GT_TickHandler_Ores.unloadChunkOre(this);
}
//@Override
//public void invalidate() {
//super.invalidate();
//GT_TickHandler_Ores.unloadChunkOre(this);
//}
@Override
public void validate() {
super.validate();
GT_TickHandler_Ores.loadChunkOre(this);
}
//@Override
//public void validate() {
//super.validate();
//GT_TickHandler_Ores.loadChunkOre(this);
//}
public void convertOreBlock(World aWorld, int aX, int aY, int aZ) {
short aMeta = ((short) (int) (this.mMetaData % 1000 + (this.mMetaData / 16000 * 16000)));

View file

@ -143,7 +143,7 @@ public class GT_Loader_Item_Block_And_Fluid
GregTech_API.sBlockOresUb2 = new GT_Block_Ores_UB2();
GregTech_API.sBlockOresUb3 = new GT_Block_Ores_UB3();
}
new GT_TickHandler_Ores();
//new GT_TickHandler_Ores();
GregTech_API.sBlockMetal1 = new GT_Block_Metal("gt.blockmetal1", new Materials[]{
Materials.Adamantium,
Materials.Aluminium,