Finished bags.

Closes #183
This commit is contained in:
Ellpeck 2016-08-02 20:06:31 +02:00
parent 5b730d1f12
commit d63c7e788d
6 changed files with 72 additions and 28 deletions

View file

@ -137,6 +137,7 @@ public final class InitBooklet{
new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLeafGenerator.ENERGY_PRODUCED).addTextReplacement("<range>", 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();

View file

@ -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;

View file

@ -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",

View file

@ -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;
}
}

View file

@ -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<ItemStack>(EnumActionResult.PASS, stack);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.isVoid ? EnumRarity.RARE : EnumRarity.UNCOMMON;
}
}

View file

@ -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"}]
@ -961,3 +965,6 @@ booklet.actuallyadditions.chapter.playerProbe.text.1=The <item>Player Probe<r> c
booklet.actuallyadditions.chapter.worms.name=Worms
booklet.actuallyadditions.chapter.worms.text.1=The <item>Worms<r> are a pretty useful species. <n>They will, once <imp>placed down on dirt or grass<r>, help you <imp>till the land<r> around them in a 3x3 area and <imp>keep it wet<r>. <n>Additionally, they will help the crops <imp>grow faster<r> by making the ground nice and soft. <n><n><item>Worms<r> can be gotten by simply <imp>tilling grass<r> with a hoe.
booklet.actuallyadditions.chapter.worms.text.2=<i>A worm at work
booklet.actuallyadditions.chapter.bags.name=Bag and Void Bag
booklet.actuallyadditions.chapter.bags.text.1=<item>Bags<r> are an easy way to <imp>transport items around<r>, however, they have some additional functions. <n>First of all, in their GUI that is accessed by <imp>right-clicking<r>, they can be set to automatically <imp>suck up items on the ground<r>. Also, they have a couple of <imp>filter slots<r> where you can configure what can actually go into the bags. <n><n><item>Void Bags<r> have the same functionality as normal bags, however, they <imp>remove items<r> from the world instead of storing them.