Fix convertOre

This commit is contained in:
Muramasa 2016-07-22 04:31:57 +01:00
parent 5fe4798e6b
commit 2704680a2e
2 changed files with 38 additions and 27 deletions

View file

@ -61,9 +61,9 @@ public class GT_Worldgen_Stone
TileEntity tTileEntity = aWorld.getTileEntity(eX, eY, eZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
if(tTargetedBlock != GregTech_API.sBlockOres1) {
tTileEntity = ((GT_TileEntity_Ores) tTileEntity).convertOreBlock(aWorld, (GT_TileEntity_Ores)tTileEntity, eX, eY, eZ);
((GT_TileEntity_Ores) tTileEntity).convertOreBlock(aWorld, ((GT_TileEntity_Ores) tTileEntity).mMetaData, eX, eY, eZ);
}
((GT_TileEntity_Ores) tTileEntity).overrideOreBlockMaterial(this.mBlock, (byte) this.mBlockMeta);
((GT_TileEntity_Ores)tTileEntity).overrideOreBlockMaterial(this.mBlock, (byte) this.mBlockMeta);
}
} else if (((this.mAllowToGenerateinVoid) && (aWorld.getBlock(eX, eY, eZ).isAir(aWorld, eX, eY, eZ))) || ((tTargetedBlock != null) && ((tTargetedBlock.isReplaceableOreGen(aWorld, eX, eY, eZ, Blocks.stone)) || (tTargetedBlock.isReplaceableOreGen(aWorld, eX, eY, eZ, Blocks.end_stone)) || (tTargetedBlock.isReplaceableOreGen(aWorld, eX, eY, eZ, Blocks.netherrack))))) {
aWorld.setBlock(eX, eY, eZ, this.mBlock, this.mBlockMeta, 0);

View file

@ -73,6 +73,16 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
} else {
aMetaData += 3000;
}
} else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockStones)) {
if (tBlock == GregTech_API.sBlockStones) {
if (aWorld.getBlockMetadata(aX, aY, aZ) < 8) {
aMetaData += 5000;
} else {
aMetaData += 6000;
}
} else {
aMetaData += 5000;
}
} else if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) {
return false;
}
@ -116,6 +126,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
}
public void overrideOreBlockMaterial(Block aOverridingStoneBlock, byte aOverridingStoneMeta) {
if (this.mMetaData < 3000) { //Avoid existing "stone" vein having it's ore meta changed if a new vein is generated around it.
this.mMetaData = ((short) (int) (this.mMetaData % 1000L + this.mMetaData / 16000L * 16000L));
if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.netherrack)) {
this.mMetaData = ((short) (this.mMetaData + 1000));
@ -142,15 +153,15 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
}
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(this.mMetaData), 0);
}
}
public TileEntity convertOreBlock(World aWorld, GT_TileEntity_Ores aTileEntityOres, int aX, int aY, int aZ) {
public void convertOreBlock(World aWorld, short aMeta, int aX, int aY, int aZ) {
aWorld.setBlock(aX, aY, aZ, GregTech_API.sBlockOres1);
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if(tTileEntity instanceof GT_TileEntity_Ores) {
short aMeta = aTileEntityOres.mMetaData >= 16000 ? (short) ((aTileEntityOres.mMetaData % 1000) + 16000) : (short) (aTileEntityOres.mMetaData % 1000);
aWorld.setBlockMetadataWithNotify(aX, aY, aZ, getHarvestData(aMeta), 0);
if (tTileEntity instanceof GT_TileEntity_Ores) {
((GT_TileEntity_Ores) tTileEntity).mMetaData = aMeta;
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(this.mMetaData), 0);
}
return tTileEntity;
}
public short getMetaData() {