From 7f94823e20eb76330be83924b13c391abb220b44 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 22 Dec 2016 21:33:51 +0100 Subject: [PATCH] Removed Item Distributor --- .../mod/ActuallyAdditions.java | 2 +- .../mod/blocks/BlockDistributorItem.java | 78 --------- .../mod/blocks/InitBlocks.java | 2 - .../mod/booklet/InitBooklet.java | 1 - .../mod/config/values/ConfigCrafting.java | 1 - .../mod/crafting/BlockCrafting.java | 10 -- .../mod/creative/CreativeTab.java | 1 - .../mod/tile/TileEntityBase.java | 1 - .../mod/tile/TileEntityDistributorItem.java | 154 ------------------ 9 files changed, 1 insertion(+), 249 deletions(-) delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDistributorItem.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDistributorItem.java diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index 71c4ad541..9209572ff 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -150,7 +150,7 @@ public class ActuallyAdditions{ if(mapping.name != null){ String name = mapping.name.toLowerCase(Locale.ROOT); if(name.startsWith(ModUtil.MOD_ID+":")){ - if(name.contains("paxel") || name.contains("itemspecial") || name.contains("blockbookstand") || name.contains("rarmor") || name.contains("bucket") || name.contains("modulereconstructor") || name.contains("stand")){ + if(name.contains("paxel") || name.contains("itemspecial") || name.contains("blockbookstand") || name.contains("rarmor") || name.contains("bucket") || name.contains("modulereconstructor") || name.contains("stand") || name.contains("distributor")){ mapping.ignore(); ModUtil.LOGGER.info("Missing Mapping "+mapping.name+" is getting ignored. This is intentional."); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDistributorItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDistributorItem.java deleted file mode 100644 index 37bd609a5..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDistributorItem.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This file ("BlockDistributorItem.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2016 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.blocks; - -import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityDistributorItem; -import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; - -public class BlockDistributorItem extends BlockContainerBase implements IHudDisplay{ - - public BlockDistributorItem(String name){ - super(Material.ROCK, name); - - this.setHarvestLevel("pickaxe", 0); - this.setHardness(1.75F); - this.setResistance(10.0F); - this.setSoundType(SoundType.STONE); - } - - @Override - public TileEntity createNewTileEntity(World worldIn, int meta){ - return new TileEntityDistributorItem(); - } - - @Override - public void breakBlock(World world, BlockPos pos, IBlockState state){ - this.dropInventory(world, pos); - super.breakBlock(world, pos, state); - } - - @Override - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){ - TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); - if(tile instanceof TileEntityDistributorItem){ - TileEntityDistributorItem distributor = (TileEntityDistributorItem)tile; - ItemStack slot = distributor.getStackInSlot(0); - - String strg; - if(!StackUtil.isValid(slot)){ - strg = StringUtil.localize("info."+ModUtil.MOD_ID+".noItem"); - } - else{ - strg = slot.getItem().getItemStackDisplayName(slot); - AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-19, 1F); - } - minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-15, StringUtil.DECIMAL_COLOR_WHITE); - } - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.UNCOMMON; - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java index 55ffa4519..163946e3f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java @@ -104,7 +104,6 @@ public final class InitBlocks{ public static Block blockDisplayStand; public static Block blockShockSuppressor; public static Block blockEmpowerer; - public static Block blockDistributorItem; public static Block blockBioReactor; public static Block blockTinyTorch; public static Block blockFarmer; @@ -114,7 +113,6 @@ public final class InitBlocks{ blockFarmer = new BlockFarmer("blockFarmer"); blockBioReactor = new BlockBioReactor("blockBioReactor"); - blockDistributorItem = new BlockDistributorItem("blockDistributorItem"); blockEmpowerer = new BlockEmpowerer("blockEmpowerer"); blockTinyTorch = new BlockTinyTorch("blockTinyTorch"); blockShockSuppressor = new BlockShockSuppressor("blockShockSuppressor"); 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 d0dca5218..0b467013f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -173,7 +173,6 @@ public final class InitBooklet{ new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomRedstoneface), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText()); new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomBreaker), new PageTextOnly(1).addTextReplacement("", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText()); new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial(); - new BookletChapter("distributorItem", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockDistributorItem), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDistributorItem).setNoText()).setSpecial(); new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).addItemToPage(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setImportant(); new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass)); new BookletChapter("fishingNet", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText()); 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 a0e9008a5..d8f74758a 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 @@ -157,7 +157,6 @@ public enum ConfigCrafting{ FILLING_WAND("Handheld Filler", ConfigCategories.ITEMS_CRAFTING), VOID_BAG("Void Bag", ConfigCategories.ITEMS_CRAFTING), EMPOWERER("Empowerer", ConfigCategories.BLOCKS_CRAFTING), - DISTRIBUTOR_ITEM("Item Distributor", ConfigCategories.BLOCKS_CRAFTING), FARMER("Farmer", ConfigCategories.BLOCKS_CRAFTING); public final String name; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java index 7abc7b9b6..41574002b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java @@ -147,16 +147,6 @@ public final class BlockCrafting{ recipeFireworkBox = RecipeUtil.lastIRecipe(); } - //Item Distributor - if(ConfigCrafting.DISTRIBUTOR_ITEM.isEnabled()){ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockDistributorItem), - "WHW", "HCH", "WHW", - 'W', "plankWood", - 'H', new ItemStack(Blocks.HOPPER), - 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()))); - recipeDistributorItem = RecipeUtil.lastIRecipe(); - } - //Shock Suppressor if(ConfigCrafting.SHOCK_SUPPRESSOR.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockShockSuppressor), 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 ab6cb9d63..47fb0e4c4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -82,7 +82,6 @@ public class CreativeTab extends CreativeTabs{ this.add(InitBlocks.blockCoffeeMachine); this.add(InitBlocks.blockXPSolidifier); this.add(InitBlocks.blockDisplayStand); - this.add(InitBlocks.blockDistributorItem); this.add(InitBlocks.blockFarmer); this.add(InitBlocks.blockShockSuppressor); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 93420b256..f1b8e40c0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -106,7 +106,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ register(TileEntityShockSuppressor.class); register(TileEntityEmpowerer.class); register(TileEntityLaserRelayFluids.class); - register(TileEntityDistributorItem.class); register(TileEntityBioReactor.class); register(TileEntityFarmer.class); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDistributorItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDistributorItem.java deleted file mode 100644 index d78553d87..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDistributorItem.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * This file ("TileEntityDistributorItem.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2016 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.tile; - -import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.items.CapabilityItemHandler; -import net.minecraftforge.items.IItemHandler; - -import java.util.HashMap; -import java.util.Map; - -public class TileEntityDistributorItem extends TileEntityInventoryBase{ - - private final Map handlersAround = new HashMap(); - private int putSide; - - public TileEntityDistributorItem(){ - super(1, "distributorItem"); - } - - @Override - public void updateEntity(){ - super.updateEntity(); - - if(!this.worldObj.isRemote){ - boolean shouldMarkDirty = false; - - IItemHandler handlerUp = this.handlersAround.get(EnumFacing.UP); - if(handlerUp != null){ - for(int i = 0; i < handlerUp.getSlots(); i++){ - - ItemStack pullable = handlerUp.extractItem(i, 1, true); - if(StackUtil.isValid(pullable) && (!StackUtil.isValid(this.slots[0]) || (ItemUtil.canBeStacked(this.slots[0], pullable) && StackUtil.getStackSize(this.slots[0]) < this.slots[0].getMaxStackSize()))){ - ItemStack pulled = handlerUp.extractItem(i, 1, false); - if(StackUtil.isValid(pulled)){ - if(!StackUtil.isValid(this.slots[0])){ - this.slots[0] = pulled.copy(); - } - else{ - this.slots[0] = StackUtil.addStackSize(this.slots[0], StackUtil.getStackSize(pulled)); - } - shouldMarkDirty = true; - break; - } - } - - if(StackUtil.isValid(this.slots[0]) && StackUtil.getStackSize(this.slots[0]) >= this.slots[0].getMaxStackSize()){ - break; - } - } - } - - if(!this.handlersAround.isEmpty() && (!this.handlersAround.containsKey(EnumFacing.UP) || this.handlersAround.size() >= 2) && StackUtil.isValid(this.slots[0])){ - EnumFacing[] allFacings = EnumFacing.values(); - do{ - this.putSide++; - - if(this.putSide >= 6){ - this.putSide = 0; - } - } - while(allFacings[this.putSide] == EnumFacing.UP || !this.handlersAround.containsKey(allFacings[this.putSide])); - - EnumFacing putFacing = allFacings[this.putSide]; - IItemHandler handler = this.handlersAround.get(putFacing); - if(handler != null){ - int aroundAmount = this.handlersAround.containsKey(EnumFacing.UP) ? this.handlersAround.size()-1 : this.handlersAround.size(); - int amount = StackUtil.getStackSize(this.slots[0])/aroundAmount; - if(amount <= 0){ - amount = StackUtil.getStackSize(this.slots[0]); - } - - if(amount > 0){ - ItemStack toInsert = this.slots[0].copy(); - toInsert = StackUtil.setStackSize(toInsert, amount); - - for(int i = 0; i < handler.getSlots(); i++){ - toInsert = handler.insertItem(i, toInsert.copy(), false); - - if(!StackUtil.isValid(toInsert)){ - this.slots[0] = StackUtil.addStackSize(this.slots[0], -amount); - shouldMarkDirty = true; - - break; - } - } - } - } - } - - if(shouldMarkDirty){ - this.markDirty(); - } - } - } - - @Override - public void saveDataOnChangeOrWorldStart(){ - this.handlersAround.clear(); - - for(EnumFacing side : EnumFacing.values()){ - TileEntity tile = this.worldObj.getTileEntity(this.pos.offset(side)); - if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite())){ - IItemHandler cap = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite()); - if(cap != null){ - this.handlersAround.put(side, cap); - } - } - } - } - - @Override - public boolean shouldSyncSlots(){ - return true; - } - - @Override - public void markDirty(){ - super.markDirty(); - this.sendUpdate(); - } - - @Override - public boolean shouldSaveDataOnChangeOrWorldStart(){ - return true; - } - - @Override - public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction){ - return direction == EnumFacing.UP && this.isItemValidForSlot(index, stack); - } - - @Override - public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction){ - return true; - } - - @Override - public boolean isItemValidForSlot(int index, ItemStack stack){ - return true; - } -}