Porting of GT6 prospection + Marble/Basalt compatibility, more oredicts for marble/basalt, chisel compat #1050

This commit is contained in:
Blood-Asp 2017-06-06 23:57:33 +02:00
parent 589a77c5cb
commit 688e6eb122

View file

@ -13,6 +13,7 @@ import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores; import gregtech.common.blocks.GT_TileEntity_Ores;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -44,57 +45,59 @@ public class Behaviour_Prospecting
return false; return false;
} }
byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ);
ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta));
if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))){
GT_Utility.sendChatToPlayer(aPlayer, trans("100","This is ") + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + trans("101"," Ore.")); GT_Utility.sendChatToPlayer(aPlayer, trans("100","This is ") + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + trans("101"," Ore."));
GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
return true; return true;
} }
if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone))) {
if (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone) ||
aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack) ||
aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone) ||
aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockStones) ||
aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites) ||
(aBlock == GregTech_API.sBlockOresUb1) ||
(aBlock == GregTech_API.sBlockOresUb2) ||
(aBlock == GregTech_API.sBlockOresUb3) ||
(aBlock == GregTech_API.sBlockOres1) ||
(aBlock == GregTech_API.sBlockOresGC)){
if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) {
GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
int tX = aX;
int tY = aY;
int tZ = aZ;
int tMetaID = 0; int tMetaID = 0;
int tQuality = (aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0; int tQuality = (aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0;
int tX = aX, tY = aY, tZ = aZ;
int i = 0; Block tBlock;
for (int j = 6 + tQuality; i < j; i++) { for (int i = 0, j = (int)(6 + tQuality); i < j; i++) {
tX -= ForgeDirection.getOrientation(aSide).offsetX; tX -= ForgeDirection.getOrientation(aSide).offsetX;
tY -= ForgeDirection.getOrientation(aSide).offsetY; tY -= ForgeDirection.getOrientation(aSide).offsetY;
tZ -= ForgeDirection.getOrientation(aSide).offsetZ; tZ -= ForgeDirection.getOrientation(aSide).offsetZ;
Block tBlock = aWorld.getBlock(tX, tY, tZ); tBlock = aWorld.getBlock(tX, tY, tZ);
if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { if (tBlock == Blocks.lava || tBlock == Blocks.flowing_lava) {
GT_Utility.sendChatToPlayer(aPlayer, trans("102","There is Lava behind this Rock.")); GT_Utility.sendChatToPlayer(aPlayer, trans("102","There is Lava behind this Rock."));
break; break;
} }
if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) { if (tBlock instanceof BlockLiquid || tBlock instanceof IFluidBlock) {
GT_Utility.sendChatToPlayer(aPlayer, trans("103","There is a Liquid behind this Rock.")); GT_Utility.sendChatToPlayer(aPlayer, trans("103","There is a Liquid behind this Rock."));
break; break;
} }
if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) { if (tBlock == Blocks.monster_egg || !GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ)) {
GT_Utility.sendChatToPlayer(aPlayer, trans("104","There is an Air Pocket behind this Rock.")); GT_Utility.sendChatToPlayer(aPlayer, trans("104","There is an Air Pocket behind this Rock."));
break; break;
} }
if (tBlock != aBlock) { if (tBlock != aBlock) {
if (i >= 4) { if (i < 4) GT_Utility.sendChatToPlayer(aPlayer, trans("105","Material is changing behind this Rock."));
break;
}
GT_Utility.sendChatToPlayer(aPlayer, trans("105","Material is changing behind this Rock."));
break; break;
} }
} }
Random tRandom = new XSTR(aX ^ aY ^ aZ ^ aSide);
i = 0; Random tRandom = new XSTR(aX^aY^aZ^aSide);
for (int j = 9 + 2 * tQuality; i < j; i++) { for (int i = 0, j = (int)(9+2*tQuality); i < j; i++) {
tX = aX - 4 - tQuality + tRandom.nextInt(j); tX = aX-4-tQuality+tRandom.nextInt(j);
tY = aY - 4 - tQuality + tRandom.nextInt(j); tY = aY-4-tQuality+tRandom.nextInt(j);
tZ = aZ - 4 - tQuality + tRandom.nextInt(j); tZ = aZ-4-tQuality+tRandom.nextInt(j);
Block tBlock = aWorld.getBlock(tX, tY, tZ); tBlock = aWorld.getBlock(tX, tY, tZ);
if ((tBlock instanceof GT_Block_Ores_Abstract)) { if ((tBlock instanceof GT_Block_Ores_Abstract)) {
TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) { if ((tTileEntity instanceof GT_TileEntity_Ores)) {
@ -114,9 +117,9 @@ public class Behaviour_Prospecting
} }
} }
GT_Utility.sendChatToPlayer(aPlayer, trans("107","No Ores found.")); GT_Utility.sendChatToPlayer(aPlayer, trans("107","No Ores found."));
}
return true; return true;
} }
}
return false; return false;
} }