Fix convertOre
This commit is contained in:
parent
5fe4798e6b
commit
2704680a2e
2 changed files with 38 additions and 27 deletions
|
@ -61,9 +61,9 @@ public class GT_Worldgen_Stone
|
||||||
TileEntity tTileEntity = aWorld.getTileEntity(eX, eY, eZ);
|
TileEntity tTileEntity = aWorld.getTileEntity(eX, eY, eZ);
|
||||||
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
|
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
|
||||||
if(tTargetedBlock != GregTech_API.sBlockOres1) {
|
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))))) {
|
} 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);
|
aWorld.setBlock(eX, eY, eZ, this.mBlock, this.mBlockMeta, 0);
|
||||||
|
|
|
@ -73,6 +73,16 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
|
||||||
} else {
|
} else {
|
||||||
aMetaData += 3000;
|
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)) {
|
} else if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -116,41 +126,42 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
|
||||||
}
|
}
|
||||||
|
|
||||||
public void overrideOreBlockMaterial(Block aOverridingStoneBlock, byte aOverridingStoneMeta) {
|
public void overrideOreBlockMaterial(Block aOverridingStoneBlock, byte aOverridingStoneMeta) {
|
||||||
this.mMetaData = ((short) (int) (this.mMetaData % 1000L + this.mMetaData / 16000L * 16000L));
|
if (this.mMetaData < 3000) { //Avoid existing "stone" vein having it's ore meta changed if a new vein is generated around it.
|
||||||
if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.netherrack)) {
|
this.mMetaData = ((short) (int) (this.mMetaData % 1000L + this.mMetaData / 16000L * 16000L));
|
||||||
this.mMetaData = ((short) (this.mMetaData + 1000));
|
if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.netherrack)) {
|
||||||
} else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.end_stone)) {
|
this.mMetaData = ((short) (this.mMetaData + 1000));
|
||||||
this.mMetaData = ((short) (this.mMetaData + 2000));
|
} else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.end_stone)) {
|
||||||
} else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockGranites)) {
|
this.mMetaData = ((short) (this.mMetaData + 2000));
|
||||||
if (aOverridingStoneBlock == GregTech_API.sBlockGranites) {
|
} else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockGranites)) {
|
||||||
if (aOverridingStoneMeta < 8) {
|
if (aOverridingStoneBlock == GregTech_API.sBlockGranites) {
|
||||||
|
if (aOverridingStoneMeta < 8) {
|
||||||
|
this.mMetaData = ((short) (this.mMetaData + 3000));
|
||||||
|
} else {
|
||||||
|
this.mMetaData = ((short) (this.mMetaData + 4000));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
this.mMetaData = ((short) (this.mMetaData + 3000));
|
this.mMetaData = ((short) (this.mMetaData + 3000));
|
||||||
} else {
|
|
||||||
this.mMetaData = ((short) (this.mMetaData + 4000));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockStones)) {
|
||||||
this.mMetaData = ((short) (this.mMetaData + 3000));
|
if (aOverridingStoneBlock == GregTech_API.sBlockStones) {
|
||||||
}
|
if (aOverridingStoneMeta < 8) {
|
||||||
} else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockStones)) {
|
this.mMetaData = ((short) (this.mMetaData + 5000));
|
||||||
if (aOverridingStoneBlock == GregTech_API.sBlockStones) {
|
} else {
|
||||||
if (aOverridingStoneMeta < 8) {
|
this.mMetaData = ((short) (this.mMetaData + 6000));
|
||||||
this.mMetaData = ((short) (this.mMetaData + 5000));
|
}
|
||||||
} else {
|
|
||||||
this.mMetaData = ((short) (this.mMetaData + 6000));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(this.mMetaData), 0);
|
||||||
}
|
}
|
||||||
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);
|
aWorld.setBlock(aX, aY, aZ, GregTech_API.sBlockOres1);
|
||||||
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
|
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
|
||||||
if(tTileEntity instanceof GT_TileEntity_Ores) {
|
if (tTileEntity instanceof GT_TileEntity_Ores) {
|
||||||
short aMeta = aTileEntityOres.mMetaData >= 16000 ? (short) ((aTileEntityOres.mMetaData % 1000) + 16000) : (short) (aTileEntityOres.mMetaData % 1000);
|
((GT_TileEntity_Ores) tTileEntity).mMetaData = aMeta;
|
||||||
aWorld.setBlockMetadataWithNotify(aX, aY, aZ, getHarvestData(aMeta), 0);
|
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(this.mMetaData), 0);
|
||||||
}
|
}
|
||||||
return tTileEntity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getMetaData() {
|
public short getMetaData() {
|
||||||
|
|
Loading…
Reference in a new issue