mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-27 23:45:59 +00:00
Add NEI handler for reactor
This commit is contained in:
1 parent
af28e2bdb8
commit
606d8fa719
6 files changed
+164
-3
No files matched your search
@@ -101,6 +101,8 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
import static com.brandon3055.draconicevolution.integration.nei.IMCForNEI.IMCSender;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
private static final boolean debug = DraconicEvolution.debug;
|
||||
@@ -173,6 +175,7 @@ public class ClientProxy extends CommonProxy {
|
||||
registerRenderIDs();
|
||||
registerRendering();
|
||||
ResourceHandler.instance.tick(null);
|
||||
IMCSender();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.brandon3055.draconicevolution.integration.nei;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
import static com.brandon3055.draconicevolution.common.lib.References.MODID;
|
||||
import static com.brandon3055.draconicevolution.common.lib.References.MODNAME;
|
||||
|
||||
|
||||
public class IMCForNEI {
|
||||
public static void IMCSender() {
|
||||
sendHandler("com.brandon3055.draconicevolution.integration.nei.ReactorNEIHandler", "DraconicEvolution:reactorCore");
|
||||
sendCatalyst("draconicevolution.reactor", "DraconicEvolution:reactorCore");
|
||||
}
|
||||
|
||||
private static void sendHandler(String name, String itemStack) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("handler", name);
|
||||
nbt.setString("modName", MODNAME);
|
||||
nbt.setString("modId", MODID);
|
||||
nbt.setBoolean("modRequired", true);
|
||||
nbt.setString("itemName", itemStack);
|
||||
nbt.setInteger("handlerHeight", 105);
|
||||
nbt.setInteger("maxRecipesPerPage", 1);
|
||||
FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", nbt);
|
||||
}
|
||||
|
||||
private static void sendCatalyst(String name, String itemStack, int priority) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("handlerID", name);
|
||||
nbt.setString("itemName", itemStack);
|
||||
nbt.setInteger("priority", priority);
|
||||
FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", nbt);
|
||||
}
|
||||
|
||||
private static void sendCatalyst(String name, String itemStack) {
|
||||
sendCatalyst(name, itemStack, 0);
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -10,7 +10,6 @@ import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 30/10/2014.
|
||||
*/
|
||||
@@ -21,6 +20,8 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI {
|
||||
|
||||
API.registerGuiOverlay(GUIDraconiumChest.class, "crafting", new CraftingChestStackPositioner());
|
||||
API.registerGuiOverlayHandler(GUIDraconiumChest.class, new CraftingChestOverlayHandler(), "crafting");
|
||||
API.registerRecipeHandler(new ReactorNEIHandler());
|
||||
API.registerUsageHandler(new ReactorNEIHandler());
|
||||
API.hideItem(new ItemStack(ModBlocks.placedItem));
|
||||
API.hideItem(new ItemStack(ModBlocks.invisibleMultiblock));
|
||||
API.hideItem(new ItemStack(ModBlocks.safetyFlame));
|
||||
@@ -33,8 +34,8 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI {
|
||||
API.hideItem(new ItemStack(ModBlocks.chaosShardAtmos));
|
||||
API.hideItem(new ItemStack(ModBlocks.chaosCrystal));
|
||||
API.registerNEIGuiHandler(new DENEIGuiHandler());
|
||||
|
||||
LogHelper.info("Added NEI integration");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.brandon3055.draconicevolution.integration.nei;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class ReactorNEIHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return new ResourceLocation("draconicevolution", "textures/gui/nei/reactor.png").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("nei.recipe.reactor.category");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "draconicevolution.reactor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("draconicevolution.reactor") && getClass() == ReactorNEIHandler.class) {
|
||||
final CachedReactorRecipe cachedRecipe = new CachedReactorRecipe();
|
||||
this.arecipes.add(cachedRecipe);
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(final ItemStack result) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(ModItems.chaosShard), result)) {
|
||||
final CachedReactorRecipe cachedRecipe = new CachedReactorRecipe();
|
||||
this.arecipes.add(cachedRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(final ItemStack ingredient) {
|
||||
final CachedReactorRecipe cachedRecipe = new CachedReactorRecipe();
|
||||
if ((cachedRecipe.contains(cachedRecipe.ingredients, ingredient.getItem()))) {
|
||||
if (cachedRecipe.contains(cachedRecipe.ingredients, ingredient)) {
|
||||
cachedRecipe.setIngredientPermutation(cachedRecipe.ingredients, ingredient);
|
||||
this.arecipes.add(cachedRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
this.drawProgressBar(16, 18, 176, 10, 24, 28, 1200, 1);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glTranslated(85, 32, 100);
|
||||
int scale = 260;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileReactorCore(), -0.5D, -0.5D, -0.5D, 0.0F);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(16, 18, 24, 28), "draconicevolution.reactor"));
|
||||
}
|
||||
|
||||
|
||||
private class CachedReactorRecipe extends CachedRecipe {
|
||||
|
||||
private final List<PositionedStack> ingredients;
|
||||
private final PositionedStack result;
|
||||
|
||||
public CachedReactorRecipe() {
|
||||
this.result = new PositionedStack(new ItemStack(ModItems.chaosShard), 17, 47);
|
||||
this.ingredients = new ArrayList<>();
|
||||
ItemStack[] inputList = {
|
||||
new ItemStack(ModBlocks.draconicBlock),
|
||||
new ItemStack(ModItems.draconicIngot),
|
||||
new ItemStack(ModItems.nugget, 1, 1)};
|
||||
this.ingredients.add(new PositionedStack(inputList, 17, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(ReactorNEIHandler.this.cycleticks / 20, this.ingredients);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,6 +309,8 @@ info.infusedObsidian.txt=This block is wither resistant
|
||||
|
||||
enchantment.draconicevolution.reaperEnchant=Reaper
|
||||
|
||||
nei.recipe.reactor.category=Reactor
|
||||
|
||||
//Achievements ----------------------------------------------------------------------------------------------------------------------------------------
|
||||
draconicevolution.achievementPage.name=Draconic Evolution
|
||||
|
||||
@@ -660,4 +662,4 @@ potion.de.flight.txt=Flight
|
||||
potion.de.highStep.txt=High Step
|
||||
potion.de.swiftness.txt=Swiftness
|
||||
potion.de.fireImmune.txt=Fire Immunity
|
||||
potion.de.jumpBoost.txt=Jump Boost
|
||||
potion.de.jumpBoost.txt=Jump Boost
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Reference in new issue
Block a user