Skip to content

Commit

Permalink
Moved NEI handlers to plugins package, added drying rack handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Tonius committed Sep 19, 2014
1 parent 9e7eec8 commit 66a45e0
Show file tree
Hide file tree
Showing 15 changed files with 249 additions and 124 deletions.
Binary file modified resources/assets/tinker/textures/gui/nei/casting.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/assets/tinker/textures/gui/nei/smeltery.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 42 additions & 19 deletions src/main/java/tconstruct/TConstruct.java
@@ -1,42 +1,65 @@
package tconstruct;

import cpw.mods.fml.common.*;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.network.*;
import cpw.mods.fml.common.registry.*;
import cpw.mods.fml.relauncher.Side;
import java.util.*;
import java.util.Map;
import java.util.Random;

import mantle.pulsar.config.ForgeCFG;
import mantle.pulsar.control.PulseManager;
import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.*;
import tconstruct.achievements.*;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import tconstruct.achievements.AchievementEvents;
import tconstruct.achievements.TAchievements;
import tconstruct.api.TConstructAPI;
import tconstruct.armor.TinkerArmor;
import tconstruct.armor.player.*;
import tconstruct.armor.player.TPlayerHandler;
import tconstruct.armor.player.TPlayerStats;
import tconstruct.common.TProxyCommon;
import tconstruct.library.*;
import tconstruct.library.crafting.*;
import tconstruct.library.TConstructCreativeTab;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.Detailing;
import tconstruct.library.crafting.LiquidCasting;
import tconstruct.mechworks.TinkerMechworks;
import tconstruct.mechworks.landmine.behavior.Behavior;
import tconstruct.mechworks.landmine.behavior.stackCombo.SpecialStackHandler;
import tconstruct.plugins.ic2.TinkerIC2;
import tconstruct.plugins.imc.*;
import tconstruct.plugins.imc.TinkerAE2;
import tconstruct.plugins.imc.TinkerBuildCraft;
import tconstruct.plugins.imc.TinkerMystcraft;
import tconstruct.plugins.imc.TinkerThaumcraft;
import tconstruct.plugins.mfr.TinkerMFR;
import tconstruct.plugins.nei.TinkerNEI;
import tconstruct.plugins.te4.TinkerTE4;
import tconstruct.plugins.waila.TinkerWaila;
import tconstruct.smeltery.TinkerSmeltery;
import tconstruct.tools.TinkerTools;
import tconstruct.util.EnvironmentChecks;
import tconstruct.util.config.*;
import tconstruct.util.config.DimensionBlacklist;
import tconstruct.util.config.PHConstruct;
import tconstruct.util.network.PacketPipeline;
import tconstruct.world.TinkerWorld;
import tconstruct.world.gen.SlimeIslandGen;
import tconstruct.world.village.*;
import tconstruct.world.village.ComponentSmeltery;
import tconstruct.world.village.ComponentToolWorkshop;
import tconstruct.world.village.TVillageTrades;
import tconstruct.world.village.VillageSmelteryHandler;
import tconstruct.world.village.VillageToolStationHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkCheckHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
import cpw.mods.fml.relauncher.Side;

/**
* TConstruct, the tool mod. Craft your tools with style, then modify until the
Expand All @@ -45,7 +68,8 @@
* @author mDiyo
*/

@Mod(modid = "TConstruct", name = "TConstruct", version = "${version}", dependencies = "required-after:Forge@[10.13,);required-after:Mantle;after:MineFactoryReloaded;after:NotEnoughItems;after:Waila;after:ThermalExpansion")
@Mod(modid = "TConstruct", name = "TConstruct", version = "${version}",
dependencies = "required-after:Forge@[10.13,);required-after:Mantle;after:MineFactoryReloaded;after:NotEnoughItems;after:Waila;after:ThermalExpansion")
public class TConstruct
{
public static final String modVersion = "${version}";
Expand Down Expand Up @@ -104,7 +128,6 @@ public void preInit (FMLPreInitializationEvent event)
pulsar.registerPulse(new TinkerSmeltery());
pulsar.registerPulse(new TinkerMechworks());
pulsar.registerPulse(new TinkerArmor());
pulsar.registerPulse(new TinkerNEI());
pulsar.registerPulse(new TinkerThaumcraft());
pulsar.registerPulse(new TinkerWaila());
pulsar.registerPulse(new TinkerBuildCraft());
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/tconstruct/plugins/nei/NEICompat.java

This file was deleted.

42 changes: 42 additions & 0 deletions src/main/java/tconstruct/plugins/nei/NEITConstructConfig.java
@@ -0,0 +1,42 @@
package tconstruct.plugins.nei;

import tconstruct.tools.gui.CraftingStationGui;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.recipe.DefaultOverlayHandler;

public class NEITConstructConfig implements IConfigureNEI
{

@Override
public void loadConfig ()
{
API.registerGuiOverlay(CraftingStationGui.class, "crafting");
API.registerGuiOverlayHandler(CraftingStationGui.class, new DefaultOverlayHandler(), "crafting");

API.registerRecipeHandler(new RecipeHandlerDryingRack());
API.registerUsageHandler(new RecipeHandlerDryingRack());

API.registerRecipeHandler(new RecipeHandlerMelting());
API.registerUsageHandler(new RecipeHandlerMelting());
API.registerRecipeHandler(new RecipeHandlerAlloying());
API.registerUsageHandler(new RecipeHandlerAlloying());
API.registerRecipeHandler(new RecipeHandlerCastingTable());
API.registerUsageHandler(new RecipeHandlerCastingTable());
API.registerRecipeHandler(new RecipeHandlerCastingBasin());
API.registerUsageHandler(new RecipeHandlerCastingBasin());
}

@Override
public String getName ()
{
return "TConstruct";
}

@Override
public String getVersion ()
{
return "${version}";
}

}
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;

import java.awt.Rectangle;
import java.util.ArrayList;
Expand All @@ -13,7 +13,6 @@
import tconstruct.library.crafting.Smeltery;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;

public class RecipeHandlerAlloying extends RecipeHandlerBase
{
Expand Down Expand Up @@ -105,7 +104,7 @@ public String getGuiTexture ()
@Override
public void loadTransferRects ()
{
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(76, 21, 22, 15), this.getRecipeID(), new Object[0]));
this.transferRects.add(new RecipeTransferRect(new Rectangle(76, 21, 22, 15), this.getRecipeID(), new Object[0]));
}

@Override
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;

import java.awt.Point;
import java.awt.Rectangle;
Expand Down Expand Up @@ -32,7 +32,10 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler

public abstract class CachedBaseRecipe extends CachedRecipe
{
public abstract List<FluidTankElement> getFluidTanks ();
public List<FluidTankElement> getFluidTanks ()
{
return null;
}
}

public abstract String getRecipeID ();
Expand Down Expand Up @@ -122,11 +125,15 @@ public List<String> handleTooltip (GuiRecipe guiRecipe, List<String> currenttip,
Point mouse = GuiDraw.getMousePosition();
Point offset = guiRecipe.getRecipePosition(recipe);
Point relMouse = new Point(mouse.x - ((guiRecipe.width - 176) / 2) - offset.x, mouse.y - ((guiRecipe.height - 166) / 2) - offset.y);
for (FluidTankElement tank : crecipe.getFluidTanks())

if (crecipe.getFluidTanks() != null)
{
if (tank.position.contains(relMouse))
for (FluidTankElement tank : crecipe.getFluidTanks())
{
tank.handleTooltip(currenttip);
if (tank.position.contains(relMouse))
{
tank.handleTooltip(currenttip);
}
}
}
}
Expand Down Expand Up @@ -179,27 +186,31 @@ protected boolean transferFluidTank (GuiRecipe guiRecipe, int recipe, boolean us
Point mousepos = GuiDraw.getMousePosition();
Point offset = guiRecipe.getRecipePosition(recipe);
Point relMouse = new Point(mousepos.x - ((guiRecipe.width - 176) / 2) - offset.x, mousepos.y - ((guiRecipe.height - 166) / 2) - offset.y);
for (FluidTankElement tank : crecipe.getFluidTanks())

if (crecipe.getFluidTanks() != null)
{
if (tank.position.contains(relMouse))
for (FluidTankElement tank : crecipe.getFluidTanks())
{
if ((tank.fluid != null) && tank.fluid.amount > 0)
if (tank.position.contains(relMouse))
{
if (usage)
if ((tank.fluid != null) && tank.fluid.amount > 0)
{
if (!GuiUsageRecipe.openRecipeGui("liquid", new Object[] { tank.fluid }))
if (usage)
{
return false;
if (!GuiUsageRecipe.openRecipeGui("liquid", new Object[] { tank.fluid }))
{
return false;
}
}
}
else
{
if (!GuiCraftingRecipe.openRecipeGui("liquid", new Object[] { tank.fluid }))
else
{
return false;
if (!GuiCraftingRecipe.openRecipeGui("liquid", new Object[] { tank.fluid }))
{
return false;
}
}
return true;
}
return true;
}
}
}
Expand All @@ -210,9 +221,12 @@ protected boolean transferFluidTank (GuiRecipe guiRecipe, int recipe, boolean us
public void drawFluidTanks (int recipe)
{
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
for (FluidTankElement fluidTank : crecipe.getFluidTanks())
if (crecipe.getFluidTanks() != null)
{
fluidTank.draw();
for (FluidTankElement fluidTank : crecipe.getFluidTanks())
{
fluidTank.draw();
}
}
}

Expand Down
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;

import java.awt.Rectangle;
import java.util.ArrayList;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;

import java.util.ArrayList;
import java.util.List;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;

import java.util.ArrayList;
import java.util.List;
Expand Down

0 comments on commit 66a45e0

Please sign in to comment.