diff --git a/dependencies.gradle b/dependencies.gradle index 8426e60..08e1866 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,8 +1,9 @@ // Add your dependencies here dependencies { - compile('com.github.GTNewHorizons:waila:1.5.20:dev') + compile('com.github.GTNewHorizons:waila:1.6.0:dev') - compileOnly('com.github.GTNewHorizons:ForestryMC:4.4.6:dev') + compileOnly('com.github.GTNewHorizons:ForestryMC:4.6.14:dev') compileOnly('curse.maven:minefactory-reloaded-66672:2366150') + api('com.github.GTNewHorizons:BuildCraft:7.1.36:dev') } diff --git a/src/main/java/mcp/mobius/betterbarrels/BetterBarrels.java b/src/main/java/mcp/mobius/betterbarrels/BetterBarrels.java index ef5caa4..a714a46 100644 --- a/src/main/java/mcp/mobius/betterbarrels/BetterBarrels.java +++ b/src/main/java/mcp/mobius/betterbarrels/BetterBarrels.java @@ -12,6 +12,7 @@ import mcp.mobius.betterbarrels.common.items.ItemTuningFork; import mcp.mobius.betterbarrels.common.items.dolly.ItemBarrelMover; import mcp.mobius.betterbarrels.common.items.dolly.ItemDiamondMover; +import mcp.mobius.betterbarrels.common.items.dolly.ItemFoldedBarrelMover; import mcp.mobius.betterbarrels.common.items.upgrades.ItemUpgradeCore; import mcp.mobius.betterbarrels.common.items.upgrades.ItemUpgradeSide; import mcp.mobius.betterbarrels.common.items.upgrades.ItemUpgradeStructural; @@ -86,6 +87,7 @@ public static void debug(String msg) { public static Item itemLockingPlanks = null; public static Item itemHammer = null; + public static Item itemFoldedMover = null; public static long limiterDelay = 500; public static int blockBarrelRendererID = -1; @@ -257,6 +259,7 @@ public void preInit(FMLPreInitializationEvent event) { itemMoverDiamond = new ItemDiamondMover(); itemHammer = new ItemBarrelHammer(); itemTuningFork = new ItemTuningFork(); + itemFoldedMover = new ItemFoldedBarrelMover(); GameRegistry.registerBlock(blockBarrel, "barrel"); // GameRegistry.registerBlock(blockMiniBarrel); @@ -268,6 +271,7 @@ public void preInit(FMLPreInitializationEvent event) { GameRegistry.registerItem(itemUpgradeCore, "upgradeCore"); GameRegistry.registerItem(itemUpgradeSide, "upgradeSide"); GameRegistry.registerItem(itemMover, "mover"); + GameRegistry.registerItem(itemFoldedMover, "moverFolded"); GameRegistry.registerItem(itemMoverDiamond, "moverDiamond"); GameRegistry.registerItem(itemHammer, "hammer"); GameRegistry.registerItem(itemTuningFork, "tuningFork"); diff --git a/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemBarrelMover.java b/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemBarrelMover.java index f54da5d..f6779f0 100644 --- a/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemBarrelMover.java +++ b/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemBarrelMover.java @@ -5,6 +5,7 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import mcp.mobius.betterbarrels.BetterBarrels; import mcp.mobius.betterbarrels.Utils; @@ -16,6 +17,7 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; @@ -27,6 +29,7 @@ import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -43,6 +46,7 @@ public class ItemBarrelMover extends Item { protected IIcon text_filled = null; protected DollyType type = DollyType.NORMAL; + private static final String PREVENT_FOLD_TAG_KEY = "prevent_fold"; protected static ArrayList classExtensions = new ArrayList(); protected static ArrayList classExtensionsNames = new ArrayList(); protected static HashMap classMap = new HashMap(); @@ -177,12 +181,43 @@ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, } if (stack.hasTagCompound() && stack.getTagCompound().hasKey("Container")) { + stack.getTagCompound().setBoolean(PREVENT_FOLD_TAG_KEY, true); return this.placeContainer(stack, player, world, x, y, z, side); } return false; } + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { + if (world.isRemote) { + return itemStack; + } + + // This prevents the dolly from folding after sneak right-clicking to place an item. + if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(PREVENT_FOLD_TAG_KEY)) { + itemStack.getTagCompound().removeTag(PREVENT_FOLD_TAG_KEY); + return itemStack; + } + + if (player.isSneaking() && type == DollyType.NORMAL + && (!itemStack.hasTagCompound() || !itemStack.getTagCompound().hasKey("Container"))) { + // Diamond dollies can't be folded because they can be damaged. + final EntityItem newItem = new EntityItem( + world, + player.posX, + player.posY, + player.posZ, + new ItemStack(BetterBarrels.itemFoldedMover, 1)); + newItem.delayBeforeCanPickup = 0; + world.spawnEntityInWorld(newItem); + + itemStack.stackSize -= 1; + } + + return itemStack; + } + protected boolean placeContainer(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) { NBTTagCompound nbtStack = stack.getTagCompound(); NBTTagCompound nbtContainerStack = nbtStack.getCompoundTag("Container"); @@ -644,6 +679,18 @@ public void onUpdate(ItemStack stack, World world, Entity entity, int par4, bool } } + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean p_77624_4_) { + super.addInformation(itemStack, player, tooltip, p_77624_4_); + + if (type == DollyType.NORMAL + && (!itemStack.hasTagCompound() || !itemStack.getTagCompound().hasKey("Container"))) { + tooltip.add(StatCollector.translateToLocal("item.dolly.folding_hint.1")); + tooltip.add(StatCollector.translateToLocal("item.dolly.folding_hint.2")); + } + } + private ForgeDirection getBarrelOrientationOnPlacement(EntityPlayer player) { return this.getBarrelOrientationOnPlacement(player, 0, false); } diff --git a/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemFoldedBarrelMover.java b/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemFoldedBarrelMover.java new file mode 100644 index 0000000..3951b16 --- /dev/null +++ b/src/main/java/mcp/mobius/betterbarrels/common/items/dolly/ItemFoldedBarrelMover.java @@ -0,0 +1,62 @@ +package mcp.mobius.betterbarrels.common.items.dolly; + +import java.util.List; + +import mcp.mobius.betterbarrels.BetterBarrels; +import mcp.mobius.betterbarrels.common.JabbaCreativeTab; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class ItemFoldedBarrelMover extends Item { + + public ItemFoldedBarrelMover() { + super(); + this.setCreativeTab(JabbaCreativeTab.tab); + this.setNoRepair(); + } + + @Override + public void registerIcons(IIconRegister par1IconRegister) { + this.itemIcon = par1IconRegister.registerIcon(BetterBarrels.modid + ":dolly_normal_folded"); + } + + @Override + public String getUnlocalizedName() { + return getUnlocalizedName(null); + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return "item.dolly.normal.folded"; + } + + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { + if (!world.isRemote && itemStack.stackSize > 0) { + final EntityItem newItem = new EntityItem( + world, + player.posX, + player.posY, + player.posZ, + new ItemStack(BetterBarrels.itemMover, 1)); + newItem.delayBeforeCanPickup = 0; + world.spawnEntityInWorld(newItem); + + itemStack.stackSize -= 1; + } + return itemStack; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean p_77624_4_) { + super.addInformation(itemStack, player, tooltip, p_77624_4_); + tooltip.add(StatCollector.translateToLocal("item.dolly.folded_hint")); + } +} diff --git a/src/main/resources/assets/jabba/lang/de_DE.lang b/src/main/resources/assets/jabba/lang/de_DE.lang index 47ac3b1..8a28ab6 100644 --- a/src/main/resources/assets/jabba/lang/de_DE.lang +++ b/src/main/resources/assets/jabba/lang/de_DE.lang @@ -34,8 +34,12 @@ item.hammer.void.name=Barrel Hammer(Leere) item.dolly.normal.empty.name=Transportwagen item.dolly.normal.full.name=Transportwagen (Voll) +item.dolly.normal.folded.name=Transportwagen (Gefaltet) item.dolly.diamond.empty.name=Diamant-Transportwagen item.dolly.diamond.full.name=Diamant-Transportwagen (Voll) +item.dolly.folding_hint.1=Schleichend rechtsklicken zum Zusammenklappen +item.dolly.folding_hint.2=Zusammengeklappte Transportwagen können in Truhen und Rucksäcken verstaut werden +item.dolly.folded_hint=Ausklappen mit Rechtsklick item.fork.name=B-Space-Stimmgabel tile.blockbarrel.name=Besseres Fass diff --git a/src/main/resources/assets/jabba/lang/en_US.lang b/src/main/resources/assets/jabba/lang/en_US.lang index 5a45b1f..c1b8a04 100644 --- a/src/main/resources/assets/jabba/lang/en_US.lang +++ b/src/main/resources/assets/jabba/lang/en_US.lang @@ -37,8 +37,12 @@ item.hammer.creative.name=Barrel Hammer(Creative) item.dolly.normal.empty.name=Dolly item.dolly.normal.full.name=Dolly (Full) -item.dolly.diamond.empty.name=Diamond dolly -item.dolly.diamond.full.name=Diamond dolly (Full) +item.dolly.normal.folded.name=Dolly (Folded) +item.dolly.diamond.empty.name=Diamond Dolly +item.dolly.diamond.full.name=Diamond Dolly (Full) +item.dolly.folding_hint.1=Sneak right click to fold +item.dolly.folding_hint.2=Folded dollies can be stored in chests and backpacks +item.dolly.folded_hint=Right click to unfold item.fork.name=B-Space tuning fork tile.blockbarrel.name=Better Barrel diff --git a/src/main/resources/assets/jabba/lang/ru_RU.lang b/src/main/resources/assets/jabba/lang/ru_RU.lang index 35a757d..0e6c560 100644 --- a/src/main/resources/assets/jabba/lang/ru_RU.lang +++ b/src/main/resources/assets/jabba/lang/ru_RU.lang @@ -37,8 +37,12 @@ item.hammer.creative.name=Бочкообразный молот (Творчес item.dolly.normal.empty.name=Тележка item.dolly.normal.full.name=Тележка (Полная) +item.dolly.normal.folded.name=Тележка (Сложенная) item.dolly.diamond.empty.name=Алмазная тележка item.dolly.diamond.full.name=Алмазная тележка (Полная) +item.dolly.folding_hint.1=Присесть и правая кнопка мыши чтобы сложить +item.dolly.folding_hint.2=Сложенные тележки можно хранить в сундуках и рюкзаках +item.dolly.folded_hint=Присесть и правая кнопка мыши чтобы разложить item.fork.name=Пространственный камертон tile.blockbarrel.name=Better Barrel diff --git a/src/main/resources/assets/jabba/lang/zh_CN.lang b/src/main/resources/assets/jabba/lang/zh_CN.lang index 0d4210b..3dbfb97 100644 --- a/src/main/resources/assets/jabba/lang/zh_CN.lang +++ b/src/main/resources/assets/jabba/lang/zh_CN.lang @@ -37,8 +37,12 @@ item.hammer.creative.name=桶锤(创造) item.dolly.normal.empty.name=手推车 item.dolly.normal.full.name=手推车(满) +item.dolly.normal.folded.name=手推车(折叠式) item.dolly.diamond.empty.name=钻石手推车 item.dolly.diamond.full.name=钻石手推车(满) +item.dolly.folding_hint.1=偷偷点击右键折叠 +item.dolly.folding_hint.2=折叠式手推车可存放在箱子和背包中 +item.dolly.folded_hint=右击展开 item.fork.name=B空间音叉 tile.blockbarrel.name=更好的桶 diff --git a/src/main/resources/assets/jabba/textures/items/dolly_diamond_empty.png b/src/main/resources/assets/jabba/textures/items/dolly_diamond_empty.png index f3b5b0b..9549f60 100644 Binary files a/src/main/resources/assets/jabba/textures/items/dolly_diamond_empty.png and b/src/main/resources/assets/jabba/textures/items/dolly_diamond_empty.png differ diff --git a/src/main/resources/assets/jabba/textures/items/dolly_diamond_filled.png b/src/main/resources/assets/jabba/textures/items/dolly_diamond_filled.png index 662a7bc..91b2c14 100644 Binary files a/src/main/resources/assets/jabba/textures/items/dolly_diamond_filled.png and b/src/main/resources/assets/jabba/textures/items/dolly_diamond_filled.png differ diff --git a/src/main/resources/assets/jabba/textures/items/dolly_normal_empty.png b/src/main/resources/assets/jabba/textures/items/dolly_normal_empty.png index 7bbbe3c..9c6e145 100644 Binary files a/src/main/resources/assets/jabba/textures/items/dolly_normal_empty.png and b/src/main/resources/assets/jabba/textures/items/dolly_normal_empty.png differ diff --git a/src/main/resources/assets/jabba/textures/items/dolly_normal_filled.png b/src/main/resources/assets/jabba/textures/items/dolly_normal_filled.png index d3113be..7ed956e 100644 Binary files a/src/main/resources/assets/jabba/textures/items/dolly_normal_filled.png and b/src/main/resources/assets/jabba/textures/items/dolly_normal_filled.png differ diff --git a/src/main/resources/assets/jabba/textures/items/dolly_normal_folded.png b/src/main/resources/assets/jabba/textures/items/dolly_normal_folded.png new file mode 100644 index 0000000..fddb323 Binary files /dev/null and b/src/main/resources/assets/jabba/textures/items/dolly_normal_folded.png differ