From 45f167754a92c3481efbc7479aeccb4ee3ec985f Mon Sep 17 00:00:00 2001 From: mezz Date: Tue, 16 Dec 2014 00:27:13 -0800 Subject: [PATCH] Cleanup TODOs --- .../worldgen/ComponentVillageBeeHouse.java | 3 +- .../forestry/mail/gadgets/MachineMailbox.java | 131 +++--------------- .../java/forestry/plugins/PluginFactory.java | 58 +++----- .../storage/PickupHandlerStorage.java | 13 +- 4 files changed, 43 insertions(+), 162 deletions(-) diff --git a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java index 69f15b3e9..93cf2872b 100755 --- a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java +++ b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java @@ -369,8 +369,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } private boolean isAirBlockAtCurrentPosition(World world, int x, int y, int z, StructureBoundingBox box) { - // TODO: replace with isAir - return getBlockAtCurrentPosition(world, x, y, z, box) == Blocks.air; + return getBlockAtCurrentPosition(world, x, y, z, box).isAir(world, x, y, z); } } diff --git a/src/main/java/forestry/mail/gadgets/MachineMailbox.java b/src/main/java/forestry/mail/gadgets/MachineMailbox.java index 320a59123..75be347e2 100755 --- a/src/main/java/forestry/mail/gadgets/MachineMailbox.java +++ b/src/main/java/forestry/mail/gadgets/MachineMailbox.java @@ -10,9 +10,22 @@ ******************************************************************************/ package forestry.mail.gadgets; -import buildcraft.api.statements.ITriggerExternal; +import java.util.Collection; +import java.util.LinkedList; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.world.World; + import com.mojang.authlib.GameProfile; + +import net.minecraftforge.common.util.ForgeDirection; + import cpw.mods.fml.common.Optional; + import forestry.api.core.ForestryAPI; import forestry.api.mail.ILetter; import forestry.api.mail.IMailAddress; @@ -28,15 +41,8 @@ import forestry.mail.IMailContainer; import forestry.mail.POBox; import forestry.mail.PostRegistry; import forestry.plugins.PluginMail; -import java.util.Collection; -import java.util.LinkedList; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; + +import buildcraft.api.statements.ITriggerExternal; public class MachineMailbox extends TileBase implements IMailContainer { @@ -117,109 +123,4 @@ public class MachineMailbox extends TileBase implements IMailContainer { res.add(PluginMail.triggerHasMail); return res; } - - /* ISPECIALINVENTORY */ -// @Override -// public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) { -// if (!PostManager.postRegistry.isLetter(stack)) -// return 0; -// -// IPostalState result = tryDispatchLetter(stack, doAdd); -// -// if (!result.isOk()) -// return 0; -// else -// return 1; -// } -// -// @Override -// public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) { -// -// ItemStack product = null; -// IInventory mailInventory = getOrCreateMailInventory(worldObj, getOwnerProfile()); -// -// for (int i = 0; i < mailInventory.getSizeInventory(); i++) { -// ItemStack slotStack = mailInventory.getStackInSlot(i); -// if (slotStack == null) -// continue; -// -// product = slotStack; -// if (doRemove) -// mailInventory.setInventorySlotContents(i, null); -// break; -// } -// -// if (product != null) -// return new ItemStack[]{product}; -// else -// return new ItemStack[0]; -// } - -// @Override -// public int getSizeInventory() { -// return 0; -// } -// -// @Override -// public ItemStack getStackInSlot(int var1) { -// return null; -// } -// -// @Override -// public ItemStack decrStackSize(int var1, int var2) { -// return null; -// } -// -// @Override -// public ItemStack getStackInSlotOnClosing(int var1) { -// return null; -// } -// -// @Override -// public void setInventorySlotContents(int var1, ItemStack var2) { -// } -// -// @Override -// public int getInventoryStackLimit() { -// return 0; -// } -// -// @Override -// public boolean isUseableByPlayer(EntityPlayer player) { -// return Utils.isUseableByPlayer(player, this); -// } -// -// @Override -// public boolean hasCustomInventoryName() { -// return false; -// } -// -// // TODO: This is broken mezz, I don't know how to fix -CovertJaguar -// @Override -// public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) { -// return super.isItemValidForSlot(slotIndex, itemstack); -// } -// -// @Override -// public boolean canInsertItem(int i, ItemStack itemstack, int j) { -// return super.canInsertItem(i, itemstack, j); -// } -// -// @Override -// public boolean canExtractItem(int i, ItemStack itemstack, int j) { -// return super.canExtractItem(i, itemstack, j); -// } -// -// @Override -// public int[] getAccessibleSlotsFromSide(int side) { -// return super.getAccessibleSlotsFromSide(side); -// } -// -// @Override -// public void openInventory() { -// } -// -// @Override -// public void closeInventory() { -// } } diff --git a/src/main/java/forestry/plugins/PluginFactory.java b/src/main/java/forestry/plugins/PluginFactory.java index 8b974b6d4..b757cd5ee 100755 --- a/src/main/java/forestry/plugins/PluginFactory.java +++ b/src/main/java/forestry/plugins/PluginFactory.java @@ -10,8 +10,17 @@ ******************************************************************************/ package forestry.plugins; +import java.util.Arrays; + +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fluids.FluidStack; + import cpw.mods.fml.common.network.IGuiHandler; -import forestry.api.recipes.ICraftingProvider; + import forestry.api.recipes.RecipeManagers; import forestry.core.GameMode; import forestry.core.config.Defaults; @@ -21,8 +30,6 @@ import forestry.core.fluids.Fluids; import forestry.core.gadgets.BlockBase; import forestry.core.gadgets.MachineDefinition; import forestry.core.gadgets.MachineNBTDefinition; -import forestry.core.interfaces.IOreDictionaryHandler; -import forestry.core.interfaces.ISaveEventHandler; import forestry.core.items.ItemForestryBlock; import forestry.core.items.ItemNBTTile; import forestry.core.proxy.Proxies; @@ -42,12 +49,7 @@ import forestry.factory.gadgets.MillRainmaker; import forestry.factory.gadgets.TileWorktable; import forestry.factory.recipes.CraftGuideIntegration; import forestry.factory.triggers.FactoryTriggers; -import java.util.ArrayList; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; + @Plugin(pluginID = "Factory", name = "Factory", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.factory.description") public class PluginFactory extends ForestryPlugin { @@ -68,21 +70,15 @@ public class PluginFactory extends ForestryPlugin { public void preInit() { super.preInit(); - RecipeManagers.craftingProviders = new ArrayList(); - // Init carpenter manager - RecipeManagers.craftingProviders.add(RecipeManagers.carpenterManager = new MachineCarpenter.RecipeManager()); - // Init centrifuge manager - RecipeManagers.craftingProviders.add(RecipeManagers.centrifugeManager = new MachineCentrifuge.RecipeManager()); - // Init fabricator manager - RecipeManagers.craftingProviders.add(RecipeManagers.fabricatorManager = new MachineFabricator.RecipeManager()); - // Init fermenter manager - RecipeManagers.craftingProviders.add(RecipeManagers.fermenterManager = new MachineFermenter.RecipeManager()); - // Init moistener manager - RecipeManagers.craftingProviders.add(RecipeManagers.moistenerManager = new MachineMoistener.RecipeManager()); - // Init squeezer manager - RecipeManagers.craftingProviders.add(RecipeManagers.squeezerManager = new MachineSqueezer.RecipeManager()); - // Init still manager - RecipeManagers.craftingProviders.add(RecipeManagers.stillManager = new MachineStill.RecipeManager()); + RecipeManagers.craftingProviders = Arrays.asList( + RecipeManagers.carpenterManager = new MachineCarpenter.RecipeManager(), + RecipeManagers.centrifugeManager = new MachineCentrifuge.RecipeManager(), + RecipeManagers.fabricatorManager = new MachineFabricator.RecipeManager(), + RecipeManagers.fermenterManager = new MachineFermenter.RecipeManager(), + RecipeManagers.moistenerManager = new MachineMoistener.RecipeManager(), + RecipeManagers.squeezerManager = new MachineSqueezer.RecipeManager(), + RecipeManagers.stillManager = new MachineStill.RecipeManager() + ); ForestryBlock.factoryTESR.registerBlock(new BlockBase(Material.iron, true), ItemForestryBlock.class, "factory"); @@ -497,23 +493,9 @@ public class PluginFactory extends ForestryPlugin { } } - @Override - protected void registerCrates() { - // TODO Auto-generated method stub - } - @Override public IGuiHandler getGuiHandler() { return new GuiHandlerFactory(); } - @Override - public ISaveEventHandler getSaveEventHandler() { - return null; - } - - @Override - public IOreDictionaryHandler getDictionaryHandler() { - return null; - } } diff --git a/src/main/java/forestry/storage/PickupHandlerStorage.java b/src/main/java/forestry/storage/PickupHandlerStorage.java index 81380ffb9..f63b1d2e8 100755 --- a/src/main/java/forestry/storage/PickupHandlerStorage.java +++ b/src/main/java/forestry/storage/PickupHandlerStorage.java @@ -10,13 +10,14 @@ ******************************************************************************/ package forestry.storage; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import forestry.core.interfaces.IPickupHandler; import forestry.storage.gui.ContainerBackpack; import forestry.storage.gui.ContainerNaturalistBackpack; import forestry.storage.items.ItemBackpack; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; public class PickupHandlerStorage implements IPickupHandler { @@ -27,13 +28,11 @@ public class PickupHandlerStorage implements IPickupHandler { if (itemstack == null || itemstack.stackSize <= 0) return false; - // Do not pick up if a backpack is open // FIXME: Must not contain - // anything from apiculture + // Do not pick up if a backpack is open if (player.openContainer instanceof ContainerBackpack || player.openContainer instanceof ContainerNaturalistBackpack) return true; - // Make sure to top off manually placed itemstacks in player - // inventory first + // Make sure to top off manually placed itemstacks in player inventory first topOffPlayerInventory(player, itemstack); for (ItemStack pack : player.inventory.mainInventory) {