From c1f85264a09c174b964d16d145e24b16f26dfcbc Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Mon, 5 Jun 2017 20:45:15 +0200 Subject: Add missing translation lines. #772 --- .../gregtech/common/items/behaviors/Behaviour_None.java | 5 +++++ .../common/items/behaviors/Behaviour_Prospecting.java | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src/main/java/gregtech/common/items') diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java index 66ed8bb672..bad13f591f 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_None.java @@ -3,6 +3,7 @@ package gregtech.common.items.behaviors; import gregtech.api.enums.SubTag; import gregtech.api.interfaces.IItemBehaviour; import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.util.GT_LanguageManager; import net.minecraft.block.BlockDispenser; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; import net.minecraft.dispenser.IBlockSource; @@ -68,5 +69,9 @@ public class Behaviour_None public EntityArrow getProjectile(GT_MetaBase_Item aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { return null; + } + + public String trans(String aKey, String aEnglish){ + return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false); } } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java index c950cc8fe1..2d2e8e6664 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java @@ -48,7 +48,7 @@ public class Behaviour_Prospecting ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - GT_Utility.sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " 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); return true; } @@ -69,22 +69,22 @@ public class Behaviour_Prospecting Block tBlock = aWorld.getBlock(tX, tY, tZ); if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { - GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Rock."); + GT_Utility.sendChatToPlayer(aPlayer, trans("102","There is Lava behind this Rock.")); break; } if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Rock."); + GT_Utility.sendChatToPlayer(aPlayer, trans("103","There is a Liquid behind this Rock.")); break; } if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Rock."); + GT_Utility.sendChatToPlayer(aPlayer, trans("104","There is an Air Pocket behind this Rock.")); break; } if (tBlock != aBlock) { if (i >= 4) { break; } - GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Rock."); + GT_Utility.sendChatToPlayer(aPlayer, trans("105","Material is changing behind this Rock.")); break; } } @@ -100,7 +100,7 @@ public class Behaviour_Prospecting if ((tTileEntity instanceof GT_TileEntity_Ores)) { Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; if ((tMaterial != null) && (tMaterial != Materials._NULL)) { - GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); + GT_Utility.sendChatToPlayer(aPlayer, trans("106","Found traces of ") + tMaterial.mDefaultLocalName + trans("101"," Ore.")); return true; } } @@ -108,12 +108,12 @@ public class Behaviour_Prospecting tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); + GT_Utility.sendChatToPlayer(aPlayer, trans("106","Found traces of ") + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + trans("101"," Ore.")); return true; } } } - GT_Utility.sendChatToPlayer(aPlayer, "No Ores found."); + GT_Utility.sendChatToPlayer(aPlayer, trans("107","No Ores found.")); } return true; } -- cgit From 688e6eb122ecc9ed8d38e19b2685ac8c9f93d6bc Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Tue, 6 Jun 2017 23:57:33 +0200 Subject: Porting of GT6 prospection + Marble/Basalt compatibility, more oredicts for marble/basalt, chisel compat #1050 --- .../items/behaviors/Behaviour_Prospecting.java | 123 +++++++++++---------- 1 file changed, 63 insertions(+), 60 deletions(-) (limited to 'src/main/java/gregtech/common/items') diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java index 2d2e8e6664..de22776eb3 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Prospecting.java @@ -13,6 +13,7 @@ import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -39,62 +40,64 @@ public class Behaviour_Prospecting if (aWorld.isRemote) { return false; } - Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - - + Block aBlock = aWorld.getBlock(aX, aY, aZ); + if (aBlock == null) { + return false; + } + byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); - 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.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); - 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 (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); - int tX = aX; - int tY = aY; - int tZ = aZ; - int tMetaID = 0; - int tQuality = (aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0; - - int i = 0; - for (int j = 6 + tQuality; i < j; i++) { - tX -= ForgeDirection.getOrientation(aSide).offsetX; - tY -= ForgeDirection.getOrientation(aSide).offsetY; - tZ -= ForgeDirection.getOrientation(aSide).offsetZ; - - Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { - GT_Utility.sendChatToPlayer(aPlayer, trans("102","There is Lava behind this Rock.")); - break; - } - if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) { - GT_Utility.sendChatToPlayer(aPlayer, trans("103","There is a Liquid behind this Rock.")); - break; - } - 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.")); - break; - } - if (tBlock != aBlock) { - if (i >= 4) { - break; - } - GT_Utility.sendChatToPlayer(aPlayer, trans("105","Material is changing behind this Rock.")); - break; - } - } - Random tRandom = new XSTR(aX ^ aY ^ aZ ^ aSide); - i = 0; - for (int j = 9 + 2 * tQuality; i < j; i++) { - tX = aX - 4 - tQuality + tRandom.nextInt(j); - tY = aY - 4 - tQuality + tRandom.nextInt(j); - tZ = aZ - 4 - tQuality + tRandom.nextInt(j); - Block tBlock = aWorld.getBlock(tX, tY, tZ); + 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.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); + return true; + } + + 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)) { + GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); + int tMetaID = 0; + int tQuality = (aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0; + int tX = aX, tY = aY, tZ = aZ; + Block tBlock; + for (int i = 0, j = (int)(6 + tQuality); i < j; i++) { + tX -= ForgeDirection.getOrientation(aSide).offsetX; + tY -= ForgeDirection.getOrientation(aSide).offsetY; + tZ -= ForgeDirection.getOrientation(aSide).offsetZ; + + tBlock = aWorld.getBlock(tX, tY, tZ); + if (tBlock == Blocks.lava || tBlock == Blocks.flowing_lava) { + GT_Utility.sendChatToPlayer(aPlayer, trans("102","There is Lava behind this Rock.")); + break; + } + if (tBlock instanceof BlockLiquid || tBlock instanceof IFluidBlock) { + GT_Utility.sendChatToPlayer(aPlayer, trans("103","There is a Liquid behind this Rock.")); + break; + } + 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.")); + break; + } + if (tBlock != aBlock) { + if (i < 4) GT_Utility.sendChatToPlayer(aPlayer, trans("105","Material is changing behind this Rock.")); + break; + } + } + + Random tRandom = new XSTR(aX^aY^aZ^aSide); + for (int i = 0, j = (int)(9+2*tQuality); i < j; i++) { + tX = aX-4-tQuality+tRandom.nextInt(j); + tY = aY-4-tQuality+tRandom.nextInt(j); + tZ = aZ-4-tQuality+tRandom.nextInt(j); + tBlock = aWorld.getBlock(tX, tY, tZ); if ((tBlock instanceof GT_Block_Ores_Abstract)) { TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); if ((tTileEntity instanceof GT_TileEntity_Ores)) { @@ -112,12 +115,12 @@ public class Behaviour_Prospecting return true; } } - } - GT_Utility.sendChatToPlayer(aPlayer, trans("107","No Ores found.")); - } - return true; + } + GT_Utility.sendChatToPlayer(aPlayer, trans("107","No Ores found.")); + return true; + } } - return false; + return false; } public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) { -- cgit