Fix convertOre
This commit is contained in:
parent
5fe4798e6b
commit
2704680a2e
2 changed files with 38 additions and 27 deletions
|
@ -61,7 +61,7 @@ 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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
((GT_TileEntity_Ores) tTileEntity).mMetaData = aMeta;
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(this.mMetaData), 0);
|
||||
}
|
||||
return tTileEntity;
|
||||
}
|
||||
|
||||
public short getMetaData() {
|
||||
|
|
Loading…
Reference in a new issue