This commit is contained in:
Bernhard Bonigl committed 2014-09-19 15:25:51 +02:00
commit dfe6836955
15 files changed
+249 -124

No files matched your search

+42 -19
View File
@@ -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
@@ -45,7 +68,8 @@ import tconstruct.world.village.*;
* @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}";
@@ -104,7 +128,6 @@ public class TConstruct
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());
@@ -1,21 +0,0 @@
package tconstruct.plugins.nei;
import codechicken.nei.api.API;
import codechicken.nei.recipe.DefaultOverlayHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import tconstruct.tools.gui.CraftingStationGui;
public class NEICompat
{
public static void registerNEICompat ()
{
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
{
API.registerGuiOverlay(CraftingStationGui.class, "crafting");
API.registerGuiOverlayHandler(CraftingStationGui.class, new DefaultOverlayHandler(), "crafting");
}
}
}
@@ -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;
@@ -13,7 +13,6 @@ import tconstruct.library.crafting.AlloyMix;
import tconstruct.library.crafting.Smeltery;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerAlloying extends RecipeHandlerBase
{
@@ -105,7 +104,7 @@ public class RecipeHandlerAlloying extends RecipeHandlerBase
@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
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;
import java.awt.Point;
import java.awt.Rectangle;
@@ -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 ();
@@ -122,11 +125,15 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler
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);
}
}
}
}
@@ -179,27 +186,31 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler
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;
}
}
}
@@ -210,9 +221,12 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler
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();
}
}
}
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;
import java.util.ArrayList;
import java.util.List;
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;
import java.util.ArrayList;
import java.util.List;
@@ -0,0 +1,126 @@
package tconstruct.plugins.nei;
import java.awt.Rectangle;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import tconstruct.library.crafting.DryingRackRecipes;
import tconstruct.library.crafting.DryingRackRecipes.DryingRecipe;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
public class RecipeHandlerDryingRack extends RecipeHandlerBase
{
public class CachedDryingRackRecipe extends CachedBaseRecipe
{
public PositionedStack input;
public PositionedStack output;
public int time;
public CachedDryingRackRecipe(DryingRecipe drying)
{
this.input = new PositionedStack(drying.input, 44, 18);
this.output = new PositionedStack(drying.result, 98, 18);
this.time = drying.time;
}
@Override
public PositionedStack getIngredient ()
{
return this.input;
}
@Override
public PositionedStack getResult ()
{
return this.output;
}
}
@Override
public String getRecipeName ()
{
return "Drying Rack";
}
@Override
public String getRecipeID ()
{
return "tconstruct.dryingrack";
}
@Override
public void loadTransferRects ()
{
this.transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 15), this.getRecipeID(), new Object[0]));
}
@Override
public String getGuiTexture ()
{
return "tinker:textures/gui/nei/dryingrack.png";
}
@Override
public void drawBackground (int recipe)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(this.getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 160, 65);
}
@Override
public void drawExtras (int recipe)
{
int time = ((CachedDryingRackRecipe) this.arecipes.get(recipe)).time;
int seconds = time / 20;
GuiDraw.drawStringC(time + " ticks (" + seconds + " secs)", 81, 40, 0x808080, false);
}
@Override
public void loadCraftingRecipes (String outputId, Object... results)
{
if (outputId.equals(this.getRecipeID()))
{
for (DryingRecipe drying : DryingRackRecipes.recipes)
{
this.arecipes.add(new CachedDryingRackRecipe(drying));
}
}
else
{
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes (ItemStack result)
{
for (DryingRecipe drying : DryingRackRecipes.recipes)
{
if (NEIServerUtils.areStacksSameTypeCrafting(drying.result, result))
{
this.arecipes.add(new CachedDryingRackRecipe(drying));
}
}
}
@Override
public void loadUsageRecipes (ItemStack ingred)
{
for (DryingRecipe drying : DryingRackRecipes.recipes)
{
if (NEIServerUtils.areStacksSameTypeCrafting(drying.input, ingred))
{
this.arecipes.add(new CachedDryingRackRecipe(drying));
}
}
}
}
@@ -1,4 +1,4 @@
package tconstruct.smeltery.nei;
package tconstruct.plugins.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
@@ -1,20 +0,0 @@
package tconstruct.plugins.nei;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
import mantle.pulsar.pulse.*;
import tconstruct.TConstruct;
@ObjectHolder(TConstruct.modID)
@Pulse(id = "Tinkers NEI Compatibility", description = "Tinkers Construct compatibility for NEI", modsRequired = "NotEnoughItems")
public class TinkerNEI
{
@Handler
public void init (FMLInitializationEvent event)
{
TConstruct.logger.info("NotEnoughItems detected. Registering TConstruct NEI plugin.");
NEICompat.registerNEICompat();
}
}
@@ -1,38 +0,0 @@
package tconstruct.smeltery.nei;
import tconstruct.TConstruct;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
public class NEITinkerSmelteryConfig implements IConfigureNEI
{
@Override
public void loadConfig ()
{
if (TConstruct.pulsar.isPulseLoaded("Tinkers' Smeltery"))
{
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 "TinkerSmeltery";
}
@Override
public String getVersion ()
{
return "${version}";
}
}