From a907b7e8c55dd1044a80cd20f17ca4ad1d0540d3 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 4 Aug 2016 03:14:45 +0200 Subject: [PATCH] Added more storage crate upgrades Closes #186 --- .../mod/booklet/InitBooklet.java | 2 +- .../mod/crafting/ItemCrafting.java | 14 ++++++++++ .../mod/creative/CreativeTab.java | 2 ++ .../mod/items/InitItems.java | 9 ++++++- .../mod/items/ItemChestToCrateUpgrade.java | 24 +++++++++++------- .../assets/actuallyadditions/lang/en_US.lang | 6 ++++- .../item/itemMediumToLargeCrateUpgrade.json | 6 +++++ .../item/itemSmallToMediumCrateUpgrade.json | 6 +++++ .../items/itemMediumToLargeCrateUpgrade.png | Bin 0 -> 529 bytes .../items/itemSmallToMediumCrateUpgrade.png | Bin 0 -> 539 bytes 10 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/assets/actuallyadditions/models/item/itemMediumToLargeCrateUpgrade.json create mode 100644 src/main/resources/assets/actuallyadditions/models/item/itemSmallToMediumCrateUpgrade.json create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemMediumToLargeCrateUpgrade.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemSmallToMediumCrateUpgrade.png diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index 22fae77c5..471fc6b5f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -125,7 +125,7 @@ public final class InitBooklet{ new BookletChapter("fishingNet", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText()); new BookletChapter("feeder", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFeeder), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText()); new BookletChapter("compost", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemFertilizer)), new PageCrafting(2, BlockCrafting.recipeCompost).setNoText(), new PageCrafting(3, ItemCrafting.RECIPES_MASHED_FOOD)); - new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGiantChest), new PageCrafting(1, BlockCrafting.recipeCrate), new PageCrafting(2, BlockCrafting.recipeCrateMedium).setNoText(), new PageCrafting(3, BlockCrafting.recipeCrateLarge).setNoText(), new PageCrafting(4, ItemCrafting.recipeCrateKeeper), new PageCrafting(5, ItemCrafting.recipeChestToCrateUpgrade)); + new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGiantChest), new PageCrafting(1, BlockCrafting.recipeCrate), new PageCrafting(2, BlockCrafting.recipeCrateMedium).setNoText(), new PageCrafting(3, BlockCrafting.recipeCrateLarge).setNoText(), new PageCrafting(4, ItemCrafting.recipeCrateKeeper), new PageCrafting(5, ItemCrafting.recipeChestToCrateUpgrade), new PageCrafting(6, ItemCrafting.recipeSmallToMediumCrateUpgrade), new PageCrafting(7, ItemCrafting.recipeMediumToLargeCrateUpgrade)); new BookletChapter("rangedCollector", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockRangedCollector), new PageTextOnly(1).addTextReplacement("", TileEntityRangedCollector.RANGE), new PageCrafting(2, BlockCrafting.recipeRangedCollector).setNoText()); //RF Using Blocks diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java index a423d0e32..fc1233b3a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java @@ -75,6 +75,8 @@ public final class ItemCrafting{ public static IRecipe recipeLeafBlower; public static IRecipe recipeLeafBlowerAdvanced; public static IRecipe recipeChestToCrateUpgrade; + public static IRecipe recipeSmallToMediumCrateUpgrade; + public static IRecipe recipeMediumToLargeCrateUpgrade; public static IRecipe recipeLaserWrench; public static IRecipe recipeDrillCore; public static IRecipe recipeBlackDye; @@ -138,6 +140,18 @@ public final class ItemCrafting{ 'C', new ItemStack(InitBlocks.blockGiantChest), 'W', "plankWood")); recipeChestToCrateUpgrade = RecipeUtil.lastIRecipe(); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemSmallToMediumCrateUpgrade), + " W ", "WCW", " W ", + 'C', new ItemStack(InitBlocks.blockGiantChestMedium), + 'W', "plankWood")); + recipeSmallToMediumCrateUpgrade = RecipeUtil.lastIRecipe(); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMediumToLargeCrateUpgrade), + " W ", "WCW", " W ", + 'C', new ItemStack(InitBlocks.blockGiantChestLarge), + 'W', "plankWood")); + recipeMediumToLargeCrateUpgrade = RecipeUtil.lastIRecipe(); } //Disenchanting Lens diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java index 30f66d76d..041d6323a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -162,6 +162,8 @@ public class CreativeTab extends CreativeTabs{ this.add(InitItems.itemLaserWrench); this.add(InitItems.itemCrateKeeper); this.add(InitItems.itemChestToCrateUpgrade); + this.add(InitItems.itemSmallToMediumCrateUpgrade); + this.add(InitItems.itemMediumToLargeCrateUpgrade); this.add(InitItems.itemSpawnerChanger); this.add(InitItems.itemWaterBowl); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java index b67f1d497..40ce72e93 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java @@ -19,6 +19,8 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials; import de.ellpeck.actuallyadditions.mod.material.InitToolMaterials; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; +import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil; @@ -29,6 +31,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntityChest; public final class InitItems{ @@ -129,6 +132,8 @@ public final class InitItems{ public static Item itemWaterRemovalRing; public static Item itemChestToCrateUpgrade; + public static Item itemSmallToMediumCrateUpgrade; + public static Item itemMediumToLargeCrateUpgrade; public static Item itemCrateKeeper; public static Item itemSpawnerChanger; @@ -234,7 +239,9 @@ public final class InitItems{ itemCrystal = new ItemCrystal("itemCrystal", false); itemCrystalEmpowered = new ItemCrystal("itemCrystalEmpowered", true); itemLaserWrench = new ItemLaserWrench("itemLaserWrench"); - itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade"); + itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade", TileEntityChest.class, InitBlocks.blockGiantChest.getDefaultState()); + itemSmallToMediumCrateUpgrade = new ItemChestToCrateUpgrade("itemSmallToMediumCrateUpgrade", TileEntityGiantChest.class, InitBlocks.blockGiantChestMedium.getDefaultState()); + itemMediumToLargeCrateUpgrade = new ItemChestToCrateUpgrade("itemMediumToLargeCrateUpgrade", TileEntityGiantChestMedium.class, InitBlocks.blockGiantChestLarge.getDefaultState()); itemBooklet = new ItemBooklet("itemBooklet"); itemGrowthRing = new ItemGrowthRing("itemGrowthRing"); itemMagnetRing = new ItemMagnetRing("itemSuctionRing"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java index 027cdfade..440cf20d9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java @@ -10,13 +10,16 @@ package de.ellpeck.actuallyadditions.mod.items; +import de.ellpeck.actuallyadditions.mod.blocks.BlockGiantChest; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import net.minecraft.block.Block; import net.minecraft.block.BlockChest; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -29,21 +32,24 @@ import net.minecraft.world.World; public class ItemChestToCrateUpgrade extends ItemBase{ - public ItemChestToCrateUpgrade(String name){ - super(name); - } + private final Class start; + private final IBlockState end; + public ItemChestToCrateUpgrade(String name, Class start, IBlockState end){ + super(name); + this.start = start; + this.end = end; + } @Override public EnumActionResult onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float par8, float par9, float par10){ if(player.isSneaking()){ TileEntity tileHit = world.getTileEntity(pos); - Block block = world.getBlockState(pos).getBlock(); - if(block instanceof BlockChest && tileHit instanceof TileEntityChest){ + if(tileHit.getClass() == this.start){ if(!world.isRemote){ - TileEntityChest chest = (TileEntityChest)tileHit; //Copy Slots + IInventory chest = (IInventory)tileHit; ItemStack[] stacks = new ItemStack[chest.getSizeInventory()]; for(int i = 0; i < stacks.length; i++){ ItemStack aStack = chest.getStackInSlot(i); @@ -57,12 +63,12 @@ public class ItemChestToCrateUpgrade extends ItemBase{ if(!ConfigBoolValues.LESS_BLOCK_BREAKING_EFFECTS.isEnabled()){ world.playEvent(2001, pos, Block.getStateId(world.getBlockState(pos))); } - world.setBlockState(pos, InitBlocks.blockGiantChest.getDefaultState(), 2); + world.setBlockState(pos, this.end, 2); //Copy Items into new Chest TileEntity newTileHit = world.getTileEntity(pos); - if(newTileHit instanceof TileEntityGiantChest){ - TileEntityGiantChest newChest = (TileEntityGiantChest)newTileHit; + if(newTileHit instanceof IInventory){ + IInventory newChest = (IInventory)newTileHit; for(int i = 0; i < stacks.length; i++){ if(stacks[i] != null){ if(newChest.getSizeInventory() > i){ diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 66eaf6e44..e9fcc1b05 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -425,6 +425,8 @@ item.actuallyadditions.itemBooklet.name=Actually Additions Manual item.actuallyadditions.itemRarmorModuleReconstructor.name=Reconstruction Module item.actuallyadditions.itemLaserWrench.name=Laser Wrench item.actuallyadditions.itemChestToCrateUpgrade.name=Chest To Storage Crate Upgrade +item.actuallyadditions.itemSmallToMediumCrateUpgrade.name=Small To Medium Storage Crate Upgrade +item.actuallyadditions.itemMediumToLargeCrateUpgrade.name=Medium To Large Storage Crate Upgrade item.actuallyadditions.itemMiscDrillCore.name=Drill Core item.actuallyadditions.itemMiscBlackDye.name=Black Dye item.actuallyadditions.itemCrystalRed.name=Restonia Crystal @@ -779,8 +781,10 @@ booklet.actuallyadditions.chapter.compost.text.3=Bio-Mash can be crafte booklet.actuallyadditions.chapter.crate.name=Storage Crates booklet.actuallyadditions.chapter.crate.text.1=Storage Crates are big. Really big. They hold tons of items, more than 4 chests worth of them. Not only that, but they can be upgraded in size! View the following pages to get information on that and some other items regarding crates! -booklet.actuallyadditions.chapter.crate.text.4=Placing a Storage Crate Keeper inside the Storage Crate before breaking it will cause it to keep all of its items, however the Keeper will be destroyed upon placing the Crate back down. +booklet.actuallyadditions.chapter.crate.text.4=Placing a Storage Crate Keeper inside the Storage Crate before breaking it will cause it to keep all of its items, however the Keeper will be destroyed in the process. Also note that using a filled crate for crafting will destroy its contents. booklet.actuallyadditions.chapter.crate.text.5=The Chest To Storage Crate Upgrade allows you to convert any chest into a Storage Crate, retaining its items! Just shift-right-click onto the chest to apply it. +booklet.actuallyadditions.chapter.crate.text.6=Similar to the Chest To Storage Crate Upgrade, the Small To Medium Storage Crate Upgrade will convert any Small Storage Crate into a Medium Storage Crate by simply shift-right-clicking it. It will retain its items. +booklet.actuallyadditions.chapter.crate.text.7=Similar to the Chest To Storage Crate Upgrade, the Medium To Large Storage Crate Upgrade will convert any Medium Storage Crate into a Large Storage Crate by simply shift-right-clicking it. It will retain its items. booklet.actuallyadditions.chapter.coffeeMachine.name=Coffee Maker booklet.actuallyadditions.chapter.coffeeMachine.text.1=The Coffee Maker is a block used to make Coffee, a potion-like item that gives the user several buffs. To use the coffee maker, you need a Empty Cup, Coffee Beans, which can be found in the wild, harvested and planted on farmland again, RF/t and mB of Water per cup brewed. On the coffee maker recipe pages at the back, to see what the item does, just hover over the Cup of Coffee. diff --git a/src/main/resources/assets/actuallyadditions/models/item/itemMediumToLargeCrateUpgrade.json b/src/main/resources/assets/actuallyadditions/models/item/itemMediumToLargeCrateUpgrade.json new file mode 100644 index 000000000..7653206ae --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/models/item/itemMediumToLargeCrateUpgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "actuallyadditions:item/standardItem", + "textures": { + "layer0": "actuallyadditions:items/itemMediumToLargeCrateUpgrade" + } +} diff --git a/src/main/resources/assets/actuallyadditions/models/item/itemSmallToMediumCrateUpgrade.json b/src/main/resources/assets/actuallyadditions/models/item/itemSmallToMediumCrateUpgrade.json new file mode 100644 index 000000000..d3596a957 --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/models/item/itemSmallToMediumCrateUpgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "actuallyadditions:item/standardItem", + "textures": { + "layer0": "actuallyadditions:items/itemSmallToMediumCrateUpgrade" + } +} diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemMediumToLargeCrateUpgrade.png b/src/main/resources/assets/actuallyadditions/textures/items/itemMediumToLargeCrateUpgrade.png new file mode 100644 index 0000000000000000000000000000000000000000..e09586119710c63fd95fa6e5494617a94086a810 GIT binary patch literal 529 zcmV+s0`C2ZP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc00(qQO+^Ra3Jnnl zA`qk6LI3~&7<5HgbW?9;ba!ELWdLwtX>N2bZe?^JG%heMIczh2P5=M_Z%IT!R5(wK zlF3d2K@f)f;PNaU5ZUqO5)*HFQ&8Lxx4Q;hKnMbQ_fCeL0YW(X4xW6Vvi=G^nGpu8 zB^?F^v zemES`_veb!M86qD#mg|grNUIcj>@`_4AJX(kO>GdN3Fv|8{n{T5u`i|vZsE^odxLS z#K-t$pXaj)1N*&A)1-%(hgqd`+)Gc#YeMG8E4ljv4|O^nt6og(2DtyGS`>EFlCaBc zs|DKN+?HCNZGg{ueaGTcn?h=wM7Ru3Eo z2$Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc00(qQO+^Ra3Jnnl zA`qk6LI3~&7<5HgbW?9;ba!ELWdLwtX>N2bZe?^JG%heMIczh2P5=M_c}YY;R5(wK zlDSSoQ4ogd1rq|jVr(ebR|{>__z1>*LEL%`xPTBuw6`bhdkCfPVC4h-&P+Hr_X-!B zh=zI)F<$6^-v$wII3_WaO_z9L5b2Q;)~*S?@zZ8qQ1;Yg^MU&lTo}~#busPMDTJJCWS-{=Uf9s0r)U~9!8D|GABV~PeXV< z4v>Pf&e7QfK!5LUw~PBd56O$vz7LOweo^|sCwq6h9<&VIJvOzNjG@!%7y)`8qzlvm?n3c0CS6cnDI~ZfVGW=ab0`4cFGG$$k=VEtDNSaw z9@x;MfaZY#z`+oHDAj6J9#OyFm#*-dy%`J!GVk?zlf^3dfa$YjTC9Q-rh(M{IBkBY dg4u-@%P*+Q=AW1frPTlc002ovPDHLkV1i>c+oS*h literal 0 HcmV?d00001