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 b7063655c..82b6ca8e9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -137,6 +137,7 @@ public final class InitBooklet{ new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("", TileEntityLeafGenerator.ENERGY_PRODUCED).addTextReplacement("", TileEntityLeafGenerator.RANGE), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant(); //No RF Using Items + new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemBag), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag).setNoText(), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant(); new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial(); new BookletChapter("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon).setNoText(), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrafting(18, FoodCrafting.recipeChocolateToast).setNoText(), new PageCrafting(1, FoodCrafting.recipePizza).setNoText()); new BookletChapter("leafBlower", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemLeafBlowerAdvanced), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()).setImportant(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java index 6adfcb960..80a2de3b4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java @@ -169,7 +169,10 @@ public enum ConfigCrafting{ FILTER("Item Filter", ConfigCategories.ITEMS_CRAFTING), CHARCOAL_BLOCK("Charcoal Block", ConfigCategories.BLOCKS_CRAFTING), - TINY_COAL("Tiny Coal", ConfigCategories.ITEMS_CRAFTING); + TINY_COAL("Tiny Coal", ConfigCategories.ITEMS_CRAFTING), + + BAG("Bag", ConfigCategories.ITEMS_CRAFTING), + VOID_BAG("Void Bag", ConfigCategories.ITEMS_CRAFTING); public final String name; public final String category; 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 c4b399acb..f21846878 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java @@ -85,9 +85,32 @@ public final class ItemCrafting{ public static IRecipe recipeFilter; public static IRecipe recipePlayerProbe; public static IRecipe recipeDisenchantingLens; + public static IRecipe recipeBag; + public static IRecipe recipeVoidBag; public static void init(){ + //Bag + if(ConfigCrafting.BAG.isEnabled()){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBag), + "SLS", "SCS", "LVL", + 'S', new ItemStack(Items.STRING), + 'L', new ItemStack(Items.LEATHER), + 'C', new ItemStack(Blocks.CHEST), + 'V', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()))); + recipeBag = RecipeUtil.lastIRecipe(); + } + + //Void Bag + if(ConfigCrafting.VOID_BAG.isEnabled()){ + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemVoidBag), + new ItemStack(InitItems.itemBag), + new ItemStack(Items.ENDER_PEARL), + new ItemStack(Blocks.OBSIDIAN), + new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()))); + recipeVoidBag = RecipeUtil.lastIRecipe(); + } + //Lens GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), "GGG", "GBG", "GGG", diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java index 535d704b1..309e20cc3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotDeletion.java @@ -10,7 +10,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -25,9 +24,4 @@ public class SlotDeletion extends Slot{ public void putStack(ItemStack stack){ this.onSlotChanged(); } - - @Override - public boolean canTakeStack(EntityPlayer player){ - return false; - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java index ee443ce43..fb156008d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java @@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; @@ -25,6 +26,7 @@ import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; +import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ItemBag extends ItemBase{ @@ -52,7 +54,7 @@ public class ItemBag extends ItemBase{ ItemStack invStack = player.inventory.getStackInSlot(i); if(invStack != null && invStack.getItem() instanceof ItemBag && invStack.hasTagCompound()){ if(invStack.getTagCompound().getBoolean("AutoInsert")){ - boolean needsSave = false; + boolean changed = false; boolean isVoid = ((ItemBag)invStack.getItem()).isVoid; ItemStack[] inventory = new ItemStack[ContainerBag.getSlotAmount(isVoid)]; @@ -61,32 +63,41 @@ public class ItemBag extends ItemBase{ FilterSettings filter = new FilterSettings(0, 4, false, false, false, 0, 0); filter.readFromNBT(invStack.getTagCompound(), "Filter"); if(filter.check(stack, inventory)){ - for(int j = 4; j < inventory.length; j++){ - ItemStack bagStack = inventory[j]; - if(bagStack != null){ - if(ItemUtil.canBeStacked(bagStack, stack)){ - int maxTransfer = Math.min(stack.stackSize, stack.getMaxStackSize()-bagStack.stackSize); - if(maxTransfer > 0){ - bagStack.stackSize += maxTransfer; - stack.stackSize -= maxTransfer; - needsSave = true; + if(isVoid){ + stack.stackSize = 0; + changed = true; + } + else{ + for(int j = 4; j < inventory.length; j++){ + ItemStack bagStack = inventory[j]; + if(bagStack != null){ + if(ItemUtil.canBeStacked(bagStack, stack)){ + int maxTransfer = Math.min(stack.stackSize, stack.getMaxStackSize()-bagStack.stackSize); + if(maxTransfer > 0){ + bagStack.stackSize += maxTransfer; + stack.stackSize -= maxTransfer; + changed = true; + } } } - } - else{ - inventory[j] = stack.copy(); - stack.stackSize = 0; - needsSave = true; - } + else{ + inventory[j] = stack.copy(); + stack.stackSize = 0; + changed = true; + } - if(stack.stackSize <= 0){ - break; + if(stack.stackSize <= 0){ + break; + } } } } - if(needsSave && !isVoid){ //void doesn't need to save as items are deleted - ItemDrill.writeSlotsToNBT(inventory, invStack); + if(changed){ + if(!isVoid){ + ItemDrill.writeSlotsToNBT(inventory, invStack); + } + event.setResult(Event.Result.ALLOW); } } } @@ -107,4 +118,9 @@ public class ItemBag extends ItemBase{ } return new ActionResult(EnumActionResult.PASS, stack); } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return this.isVoid ? EnumRarity.RARE : EnumRarity.UNCOMMON; + } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index af93e9bea..b6b9a48ea 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -502,6 +502,8 @@ item.actuallyadditions.itemMiscBiomass.name=Biomass item.actuallyadditions.itemMiscBiocoal.name=Bio Coal item.actuallyadditions.itemPlayerProbe.name=Player Probe item.actuallyadditions.itemWorm.name=Worm +item.actuallyadditions.itemBag.name=Bag +item.actuallyadditions.itemVoidBag.name=Void Bag #Tooltips tooltip.actuallyadditions.onSuffix.desc=On @@ -617,6 +619,8 @@ container.actuallyadditions.rangedCollector.name=Ranged Collector container.actuallyadditions.miner.name=Vertical Digger container.actuallyadditions.laserRelayItemWhitelist.name=Laser Relay container.actuallyadditions.filter.name=Item Filter +container.actuallyadditions.bag.name=Bag +container.actuallyadditions.voidBag.name=Void Bag #Update Information info.actuallyadditions.update.generic=[{"text":"There is an Update for "},{"text":"Actually Additions ","color":"dark_green"},{"text":"available!","color":"none"}] @@ -960,4 +964,7 @@ booklet.actuallyadditions.chapter.playerProbe.text.1=The Player Probe c booklet.actuallyadditions.chapter.worms.name=Worms booklet.actuallyadditions.chapter.worms.text.1=The Worms are a pretty useful species. They will, once placed down on dirt or grass, help you till the land around them in a 3x3 area and keep it wet. Additionally, they will help the crops grow faster by making the ground nice and soft. Worms can be gotten by simply tilling grass with a hoe. -booklet.actuallyadditions.chapter.worms.text.2=A worm at work \ No newline at end of file +booklet.actuallyadditions.chapter.worms.text.2=A worm at work + +booklet.actuallyadditions.chapter.bags.name=Bag and Void Bag +booklet.actuallyadditions.chapter.bags.text.1=Bags are an easy way to transport items around, however, they have some additional functions. First of all, in their GUI that is accessed by right-clicking, they can be set to automatically suck up items on the ground. Also, they have a couple of filter slots where you can configure what can actually go into the bags. Void Bags have the same functionality as normal bags, however, they remove items from the world instead of storing them. \ No newline at end of file