template folder died from nine shots in the back of the head (suicide)

This commit is contained in:
Boblet 2026-03-31 14:03:03 +02:00
parent 653e428462
commit 284c6a654a
25 changed files with 198 additions and 816 deletions

View File

@ -14,4 +14,5 @@
## Fixed
* Fixed euphemium compound plate recipe not yielding four items as it should in the plasma forge
* Fixed NTM rare item drops ignoring the mob loot gamerule
* Fixed flamethrowers not properly igniting entities on direct hit, only via lingering fire
* Fixed flamethrowers not properly igniting entities on direct hit, only via lingering fire
* Fixed PWR RoR components not properly showing the possible values/functions when connected to ports

View File

@ -342,10 +342,7 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
@Override
public String[] getFunctionInfo() {
if(this.getBlockMetadata() != 1) return new String[0];
TileEntityPWRController controller = this.getCore();
if(controller != null) return controller.getFunctionInfo();
return new String[0];
return TileEntityPWRController.ROR;
}
@Override
@ -353,7 +350,7 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
if(this.getBlockMetadata() != 1) return "";
TileEntityPWRController controller = this.getCore();
if(controller != null) return controller.provideRORValue(name);
return "";
return null;
}
@Override
@ -361,7 +358,7 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
if(this.getBlockMetadata() != 1) return "";
TileEntityPWRController controller = this.getCore();
if(controller != null) return controller.runRORFunction(name, params);
return "";
return null;
}
}
}

View File

@ -16,8 +16,8 @@ public class TemplateTab extends CreativeTabs {
@Override
public Item getTabIconItem() {
if(ModItems.crucible_template != null) {
return ModItems.crucible_template;
if(ModItems.blueprints != null) {
return ModItems.blueprints;
}
return Items.iron_pickaxe;

View File

@ -10,8 +10,8 @@ import com.hbm.handler.imc.ICompatNHNEI;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.material.NTMMaterial;
import com.hbm.inventory.recipes.CrucibleRecipe;
import com.hbm.inventory.recipes.CrucibleRecipes;
import com.hbm.inventory.recipes.CrucibleRecipes.CrucibleRecipe;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemScraps;
import com.hbm.lib.RefStrings;
@ -38,17 +38,16 @@ public class CrucibleAlloyingHandler extends TemplateRecipeHandler implements IC
public class RecipeSet extends TemplateRecipeHandler.CachedRecipe {
List<PositionedStack> inputs = new ArrayList();
PositionedStack template;
PositionedStack crucible;
List<PositionedStack> outputs = new ArrayList();
public RecipeSet(CrucibleRecipe recipe) {
List<ItemStack> inputs = new ArrayList();
List<ItemStack> outputs = new ArrayList();
for(MaterialStack stack : recipe.input) inputs.add(ItemScraps.create(stack, true));
for(MaterialStack stack : recipe.output) outputs.add(ItemScraps.create(stack, true));
this.template = new PositionedStack(new ItemStack(ModItems.crucible_template, 1, recipe.getId()), 75, 6);
this.crucible = new PositionedStack(new ItemStack(ModBlocks.machine_crucible), 75, 42);
for(int i = 0; i < inputs.size(); i++) {
@ -77,7 +76,6 @@ public class CrucibleAlloyingHandler extends TemplateRecipeHandler implements IC
List<PositionedStack> other = new ArrayList();
other.addAll(inputs);
other.add(crucible);
other.add(template);
other.addAll(outputs);
return getCycledIngredients(cycleticks / 20, other);
}
@ -98,7 +96,7 @@ public class CrucibleAlloyingHandler extends TemplateRecipeHandler implements IC
if(outputId.equals("ntmCrucibleAlloying")) {
for(CrucibleRecipe recipe : CrucibleRecipes.recipes) {
for(CrucibleRecipe recipe : CrucibleRecipes.INSTANCE.recipeOrderedList) {
this.arecipes.add(new RecipeSet(recipe));
}
} else {
@ -114,7 +112,7 @@ public class CrucibleAlloyingHandler extends TemplateRecipeHandler implements IC
NTMMaterial material = Mats.matById.get(result.getItemDamage());
for(CrucibleRecipe recipe : CrucibleRecipes.recipes) {
for(CrucibleRecipe recipe : CrucibleRecipes.INSTANCE.recipeOrderedList) {
for(MaterialStack stack : recipe.output) {
if(stack.material == material) {
@ -143,7 +141,7 @@ public class CrucibleAlloyingHandler extends TemplateRecipeHandler implements IC
NTMMaterial material = Mats.matById.get(ingredient.getItemDamage());
for(CrucibleRecipe recipe : CrucibleRecipes.recipes) {
for(CrucibleRecipe recipe : CrucibleRecipes.INSTANCE.recipeOrderedList) {
for(MaterialStack stack : recipe.input) {
if(stack.material == material) {

View File

@ -17,9 +17,6 @@ public class ContainerCrucible extends Container {
public ContainerCrucible(InventoryPlayer invPlayer, TileEntityCrucible crucible) {
this.crucible = crucible;
//template
this.addSlotToContainer(new SlotNonRetarded(crucible, 0, 107, 81));
//input
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
@ -53,14 +50,14 @@ public class ContainerCrucible extends Container {
ItemStack originalStack = slot.getStack();
stack = originalStack.copy();
if(index <= 9) {
if(!this.mergeItemStack(originalStack, 10, this.inventorySlots.size(), true)) {
if(index <= 8) {
if(!this.mergeItemStack(originalStack, 9, this.inventorySlots.size(), true)) {
return null;
}
slot.onSlotChange(originalStack, stack);
} else if(!InventoryUtil.mergeItemStack(this.inventorySlots, originalStack, 0, 10, false)) {
} else if(!InventoryUtil.mergeItemStack(this.inventorySlots, originalStack, 0, 9, false)) {
return null;
}

View File

@ -12,6 +12,9 @@ import com.hbm.inventory.container.ContainerCrucible;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.material.NTMMaterial.SmeltingBehavior;
import com.hbm.inventory.recipes.CrucibleRecipe;
import com.hbm.inventory.recipes.CrucibleRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityCrucible;
import com.hbm.util.i18n.I18nUtil;
@ -45,6 +48,22 @@ public class GUICrucible extends GuiInfoContainer {
this.drawCustomInfoStat(x, y, guiLeft + 125, guiTop + 81, 34, 7, x, y, new String[] { String.format(Locale.US, "%,d", crucible.progress) + " / " + String.format(Locale.US, "%,d", crucible.processTime) + "TU" });
this.drawCustomInfoStat(x, y, guiLeft + 125, guiTop + 90, 34, 7, x, y, new String[] { String.format(Locale.US, "%,d", crucible.heat) + " / " + String.format(Locale.US, "%,d", crucible.maxHeat) + "TU" });
if(guiLeft + 106 <= x && guiLeft + 106 + 18 > x && guiTop + 80 < y && guiTop + 80 + 18 >= y) {
if(this.crucible.recipe != null && CrucibleRecipes.INSTANCE.recipeNameMap.containsKey(this.crucible.recipe)) {
CrucibleRecipe recipe = (CrucibleRecipe) CrucibleRecipes.INSTANCE.recipeNameMap.get(this.crucible.recipe);
this.func_146283_a(recipe.print(), x, y);
} else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), x, y);
}
}
}
@Override
protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 106, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(CrucibleRecipes.INSTANCE, crucible, crucible.recipe, 0, null, this);
}
@Override
@ -66,6 +85,9 @@ public class GUICrucible extends GuiInfoContainer {
int hGauge = crucible.heat * 33 / crucible.maxHeat;
if(hGauge > 0) drawTexturedModalRect(guiLeft + 126, guiTop + 91, 176, 5, hGauge, 5);
GenericRecipe recipe = CrucibleRecipes.INSTANCE.recipeNameMap.get(crucible.recipe);
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 107, 81);
if(!crucible.recipeStack.isEmpty()) drawStack(crucible.recipeStack, crucible.recipeZCapacity, 62, 97);
if(!crucible.wasteStack.isEmpty()) drawStack(crucible.wasteStack, crucible.wasteZCapacity, 17, 97);
}

View File

@ -1,330 +0,0 @@
package com.hbm.inventory.gui;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.inventory.recipes.CrucibleRecipes;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toserver.ItemFolderPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class GUIScreenTemplateFolder extends GuiScreen {
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_planner.png");
protected static final ResourceLocation texture_journal = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_planner_journal.png");
private boolean isJournal = false;
protected int xSize = 176;
protected int ySize = 229;
protected int guiLeft;
protected int guiTop;
int currentPage = 0;
List<ItemStack> allStacks = new ArrayList<ItemStack>();
List<ItemStack> stacks = new ArrayList<ItemStack>();
List<FolderButton> buttons = new ArrayList<FolderButton>();
private GuiTextField search;
public GUIScreenTemplateFolder(EntityPlayer player) {
if(player.getHeldItem() == null)
return;
Item item = player.getHeldItem().getItem();
this.isJournal = item != ModItems.template_folder;
if(!this.isJournal) {
// Crucible Templates
for(int i = 0; i < CrucibleRecipes.recipes.size(); i++) {
allStacks.add(new ItemStack(ModItems.crucible_template, 1, CrucibleRecipes.recipes.get(i).getId()));
}
}
search(null);
}
private void search(String sub) {
stacks.clear();
this.currentPage = 0;
if(sub == null || sub.isEmpty()) {
stacks.addAll(allStacks);
updateButtons();
return;
}
sub = sub.toLowerCase(Locale.US);
outer:
for(ItemStack stack : allStacks) {
for(Object o : stack.getTooltip(MainRegistry.proxy.me(), true)) {
if(o instanceof String) {
String text = (String) o;
if(text.toLowerCase(Locale.US).contains(sub)) {
stacks.add(stack);
continue outer;
}
}
}
}
updateButtons();
}
int getPageCount() {
return (int) Math.ceil((stacks.size() - 1) / (5 * 7));
}
@Override
public void updateScreen() {
if(currentPage < 0)
currentPage = 0;
if(currentPage > getPageCount())
currentPage = getPageCount();
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
this.drawDefaultBackground();
this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
GL11.glDisable(GL11.GL_LIGHTING);
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
GL11.glEnable(GL11.GL_LIGHTING);
}
@Override
public void initGui() {
super.initGui();
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
updateButtons();
Keyboard.enableRepeatEvents(true);
this.search = new GuiTextField(this.fontRendererObj, guiLeft + 61, guiTop + 213, 48, 12);
this.search.setTextColor(0xffffff);
this.search.setDisabledTextColour(0xffffff);
this.search.setEnableBackgroundDrawing(false);
this.search.setMaxStringLength(100);
this.search.setFocused(true);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
protected void updateButtons() {
if(!buttons.isEmpty())
buttons.clear();
for(int i = currentPage * 35; i < Math.min(currentPage * 35 + 35, stacks.size()); i++) {
buttons.add(new FolderButton(guiLeft + 25 + (27 * (i % 5)), guiTop + 26 + (27 * (int) Math.floor((i / 5D))) - currentPage * 27 * 7, stacks.get(i)));
}
if(currentPage != 0)
buttons.add(new FolderButton(guiLeft + 25 - 18, guiTop + 26 + (27 * 3), 1, "Previous"));
if(currentPage != getPageCount())
buttons.add(new FolderButton(guiLeft + 25 + (27 * 4) + 18, guiTop + 26 + (27 * 3), 2, "Next"));
}
@Override
public void handleMouseInput() {
super.handleMouseInput();
if(Mouse.getEventButton() == -1) {
int scroll = Mouse.getEventDWheel();
if(scroll > 0) {
if(currentPage > 0)
currentPage--;
updateButtons();
} else if(scroll < 0) {
if(currentPage < getPageCount())
currentPage++;
updateButtons();
}
}
}
@Override
protected void mouseClicked(int i, int j, int k) {
if(i >= guiLeft + 45 && i < guiLeft + 117 && j >= guiTop + 211 && j < guiTop + 223) {
this.search.setFocused(true);
} else {
this.search.setFocused(false);
}
try {
for(FolderButton b : buttons)
if(b.isMouseOnButton(i, j))
b.executeAction();
} catch(Exception ex) {
updateButtons();
}
}
protected void drawGuiContainerForegroundLayer(int i, int j) {
this.fontRendererObj.drawString(I18n.format((currentPage + 1) + "/" + (getPageCount() + 1)), guiLeft + this.xSize / 2 - this.fontRendererObj.getStringWidth(I18n.format((currentPage + 1) + "/" + (getPageCount() + 1))) / 2, guiTop + 10, isJournal ? 4210752 : 0xffffff);
for(FolderButton b : buttons)
if(b.isMouseOnButton(i, j))
b.drawString(i, j);
}
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if(!isJournal)
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
else
Minecraft.getMinecraft().getTextureManager().bindTexture(texture_journal);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(search.isFocused())
drawTexturedModalRect(guiLeft + 45, guiTop + 211, 176, 54, 72, 12);
for(FolderButton b : buttons)
b.drawButton(b.isMouseOnButton(i, j));
for(FolderButton b : buttons)
b.drawIcon(b.isMouseOnButton(i, j));
search.drawTextBox();
}
@Override
protected void keyTyped(char p_73869_1_, int p_73869_2_) {
if (this.search.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
this.search(this.search.getText());
return;
}
if(p_73869_2_ == 1 || p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
this.mc.thePlayer.closeScreen();
}
}
class FolderButton {
int xPos;
int yPos;
// 0: regular, 1: prev, 2: next
int type;
String info;
ItemStack stack;
public FolderButton(int x, int y, int t, String i) {
xPos = x;
yPos = y;
type = t;
info = i;
}
public FolderButton(int x, int y, ItemStack stack) {
xPos = x;
yPos = y;
type = 0;
info = stack.getDisplayName();
this.stack = stack.copy();
}
public void updateButton(int mouseX, int mouseY) {
}
public boolean isMouseOnButton(int mouseX, int mouseY) {
return xPos <= mouseX && xPos + 18 > mouseX && yPos < mouseY && yPos + 18 >= mouseY;
}
public void drawButton(boolean b) {
if(!isJournal)
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
else
Minecraft.getMinecraft().getTextureManager().bindTexture(texture_journal);
drawTexturedModalRect(xPos, yPos, b ? 176 + 18 : 176, type == 1 ? 18 : (type == 2 ? 36 : 0), 18, 18);
}
public void drawIcon(boolean b) {
try {
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) 240 / 1.0F, (float) 240 / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if(stack != null) {
if(stack.getItem() == ModItems.crucible_template)
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), CrucibleRecipes.indexMapping.get(stack.getItemDamage()).icon, xPos + 1, yPos + 1);
else
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), stack, xPos + 1, yPos + 1);
}
GL11.glEnable(GL11.GL_LIGHTING);
} catch(Exception x) {
}
}
public void drawString(int x, int y) {
if(info == null || info.isEmpty())
return;
if(stack != null) {
GUIScreenTemplateFolder.this.renderToolTip(stack, x, y);
} else {
func_146283_a(Arrays.asList(new String[] { info }), x, y);
}
}
public void executeAction() {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
if(type == 0) {
PacketDispatcher.wrapper.sendToServer(new ItemFolderPacket(stack.copy()));
} else if(type == 1) {
if(currentPage > 0)
currentPage--;
updateButtons();
} else if(type == 2) {
if(currentPage < getPageCount())
currentPage++;
updateButtons();
}
}
}
@Override
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
}
}

View File

@ -0,0 +1,67 @@
package com.hbm.inventory.recipes;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.input.Keyboard;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
public class CrucibleRecipe extends GenericRecipe {
public MaterialStack[] input;
public MaterialStack[] output;
public int frequency = 1;
public CrucibleRecipe(String name) {
super(name);
}
public CrucibleRecipe setup(int frequency, ItemStack icon) {
this.frequency = frequency;
this.setIcon(icon);
return this;
}
public CrucibleRecipe inputs(MaterialStack... input) { this.input = input; return this; }
public CrucibleRecipe outputs(MaterialStack... output) { this.output = output; return this; }
public int getInputAmount() {
int content = 0;
for(MaterialStack stack : input) content += stack.amount;
return content;
}
@Override
public List<String> print() {
List<String> list = new ArrayList();
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
input(list);
output(list);
return list;
}
@Override
protected void input(List<String> list) {
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.recipe.input") + ":");
for(MaterialStack stack : input) {
list.add(I18nUtil.resolveKey(stack.material.getUnlocalizedName()) + ": " + Mats.formatAmount(stack.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
}
}
@Override
protected void output(List<String> list) {
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("gui.recipe.output") + ":");
for(MaterialStack stack : output) {
list.add(I18nUtil.resolveKey(stack.material.getUnlocalizedName()) + ": " + Mats.formatAmount(stack.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
}
}
}

View File

@ -21,7 +21,7 @@ import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.material.NTMMaterial;
import com.hbm.inventory.material.NTMMaterial.SmeltingBehavior;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.inventory.recipes.loader.GenericRecipes;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMold;
import com.hbm.items.machine.ItemMold.Mold;
@ -32,10 +32,22 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class CrucibleRecipes extends SerializableRecipe {
public class CrucibleRecipes extends GenericRecipes<CrucibleRecipe> {
public static HashMap<Integer, CrucibleRecipe> indexMapping = new HashMap();
public static List<CrucibleRecipe> recipes = new ArrayList();
public static final CrucibleRecipes INSTANCE = new CrucibleRecipes();
@Override public int inputItemLimit() { return 0; }
@Override public int inputFluidLimit() { return 0; }
@Override public int outputItemLimit() { return 0; }
@Override public int outputFluidLimit() { return 0; }
@Override public CrucibleRecipe instantiateRecipe(String name) { return new CrucibleRecipe(name); }
@Override
public void deleteRecipes() {
super.deleteRecipes();
this.moldRecipes.clear();
}
/*
* IMPORTANT: crucibles do not have stack size checks for the recipe's result, meaning that they can overflow if the resulting stacks are
@ -48,138 +60,82 @@ public class CrucibleRecipes extends SerializableRecipe {
int n = MaterialShapes.NUGGET.q(1);
int i = MaterialShapes.INGOT.q(1);
recipes.add(new CrucibleRecipe(0, "crucible.steel", 2, new ItemStack(ModItems.ingot_steel))
this.register(new CrucibleRecipe("crucible.steel").setup(2, new ItemStack(ModItems.ingot_steel))
.inputs(new MaterialStack(Mats.MAT_IRON, n * 2), new MaterialStack(Mats.MAT_CARBON, n))
.outputs(new MaterialStack(Mats.MAT_STEEL, n * 2)));
if(Compat.isModLoaded(Compat.MOD_GT6)) {
recipes.add(new CrucibleRecipe(9, "crucible.steelWrought", 2, new ItemStack(ModItems.ingot_steel))
this.register(new CrucibleRecipe("crucible.steelWrought").setup(2, new ItemStack(ModItems.ingot_steel))
.inputs(new MaterialStack(Mats.MAT_WROUGHTIRON, n * 2), new MaterialStack(Mats.MAT_CARBON, n))
.outputs(new MaterialStack(Mats.MAT_STEEL, n * 2)));
recipes.add(new CrucibleRecipe(10, "crucible.steelPig", 2, new ItemStack(ModItems.ingot_steel))
this.register(new CrucibleRecipe("crucible.steelPig").setup(2, new ItemStack(ModItems.ingot_steel))
.inputs(new MaterialStack(Mats.MAT_PIGIRON, n * 2), new MaterialStack(Mats.MAT_CARBON, n))
.outputs(new MaterialStack(Mats.MAT_STEEL, n * 2)));
recipes.add(new CrucibleRecipe(11, "crucible.steelMeteoric", 2, new ItemStack(ModItems.ingot_steel))
this.register(new CrucibleRecipe("crucible.steelMeteoric").setup(2, new ItemStack(ModItems.ingot_steel))
.inputs(new MaterialStack(Mats.MAT_METEORICIRON, n * 2), new MaterialStack(Mats.MAT_CARBON, n))
.outputs(new MaterialStack(Mats.MAT_STEEL, n * 2)));
}
recipes.add(new CrucibleRecipe(7, "crucible.hematite", 6, DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.HEMATITE))
this.register(new CrucibleRecipe("crucible.hematite").setup(6, DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.HEMATITE))
.inputs(new MaterialStack(Mats.MAT_HEMATITE, i * 2), new MaterialStack(Mats.MAT_FLUX, n * 2))
.outputs(new MaterialStack(Mats.MAT_IRON, i), new MaterialStack(Mats.MAT_SLAG, n * 3)));
recipes.add(new CrucibleRecipe(8, "crucible.malachite", 6, DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.MALACHITE))
this.register(new CrucibleRecipe("crucible.malachite").setup(6, DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.MALACHITE))
.inputs(new MaterialStack(Mats.MAT_MALACHITE, i * 2), new MaterialStack(Mats.MAT_FLUX, n * 2))
.outputs(new MaterialStack(Mats.MAT_COPPER, i), new MaterialStack(Mats.MAT_SLAG, n * 3)));
recipes.add(new CrucibleRecipe(1, "crucible.redcopper", 2, new ItemStack(ModItems.ingot_red_copper))
this.register(new CrucibleRecipe("crucible.redcopper").setup(2, new ItemStack(ModItems.ingot_red_copper))
.inputs(new MaterialStack(Mats.MAT_COPPER, n), new MaterialStack(Mats.MAT_REDSTONE, n))
.outputs(new MaterialStack(Mats.MAT_MINGRADE, n * 2)));
recipes.add(new CrucibleRecipe(2, "crucible.aa", 2, new ItemStack(ModItems.ingot_advanced_alloy))
this.register(new CrucibleRecipe("crucible.aa").setup(2, new ItemStack(ModItems.ingot_advanced_alloy))
.inputs(new MaterialStack(Mats.MAT_STEEL, n), new MaterialStack(Mats.MAT_MINGRADE, n))
.outputs(new MaterialStack(Mats.MAT_ALLOY, n * 2)));
recipes.add(new CrucibleRecipe(3, "crucible.hss", 9, new ItemStack(ModItems.ingot_dura_steel))
this.register(new CrucibleRecipe("crucible.hss").setup(9, new ItemStack(ModItems.ingot_dura_steel))
.inputs(new MaterialStack(Mats.MAT_STEEL, n * 5), new MaterialStack(Mats.MAT_TUNGSTEN, n * 3), new MaterialStack(Mats.MAT_COBALT, n * 1))
.outputs(new MaterialStack(Mats.MAT_DURA, n * 9)));
recipes.add(new CrucibleRecipe(4, "crucible.ferro", 3, new ItemStack(ModItems.ingot_ferrouranium))
this.register(new CrucibleRecipe("crucible.ferro").setup(3, new ItemStack(ModItems.ingot_ferrouranium))
.inputs(new MaterialStack(Mats.MAT_STEEL, n * 2), new MaterialStack(Mats.MAT_U238, n))
.outputs(new MaterialStack(Mats.MAT_FERRO, n * 3)));
recipes.add(new CrucibleRecipe(5, "crucible.tcalloy", 9, new ItemStack(ModItems.ingot_tcalloy))
this.register(new CrucibleRecipe("crucible.tcalloy").setup(9, new ItemStack(ModItems.ingot_tcalloy))
.inputs(new MaterialStack(Mats.MAT_STEEL, n * 8), new MaterialStack(Mats.MAT_TECHNETIUM, n))
.outputs(new MaterialStack(Mats.MAT_TCALLOY, i)));
recipes.add(new CrucibleRecipe(12, "crucible.cdalloy", 9, new ItemStack(ModItems.ingot_cdalloy))
this.register(new CrucibleRecipe("crucible.cdalloy").setup(9, new ItemStack(ModItems.ingot_cdalloy))
.inputs(new MaterialStack(Mats.MAT_STEEL, n * 8), new MaterialStack(Mats.MAT_CADMIUM, n))
.outputs(new MaterialStack(Mats.MAT_CDALLOY, i)));
recipes.add(new CrucibleRecipe(14, "crucible.bbronze", 9, new ItemStack(ModItems.ingot_bismuth_bronze))
this.register(new CrucibleRecipe("crucible.bbronze").setup(9, new ItemStack(ModItems.ingot_bismuth_bronze))
.inputs(new MaterialStack(Mats.MAT_COPPER, n * 8), new MaterialStack(Mats.MAT_BISMUTH, n), new MaterialStack(Mats.MAT_FLUX, n * 3))
.outputs(new MaterialStack(Mats.MAT_BBRONZE, i), new MaterialStack(Mats.MAT_SLAG, n * 3)));
recipes.add(new CrucibleRecipe(15, "crucible.abronze", 9, new ItemStack(ModItems.ingot_arsenic_bronze))
this.register(new CrucibleRecipe("crucible.abronze").setup(9, new ItemStack(ModItems.ingot_arsenic_bronze))
.inputs(new MaterialStack(Mats.MAT_COPPER, n * 8), new MaterialStack(Mats.MAT_ARSENIC, n), new MaterialStack(Mats.MAT_FLUX, n * 3))
.outputs(new MaterialStack(Mats.MAT_ABRONZE, i), new MaterialStack(Mats.MAT_SLAG, n * 3)));
recipes.add(new CrucibleRecipe(13, "crucible.cmb", 3, new ItemStack(ModItems.ingot_combine_steel))
this.register(new CrucibleRecipe("crucible.cmb").setup(3, new ItemStack(ModItems.ingot_combine_steel))
.inputs(new MaterialStack(Mats.MAT_MAGTUNG, n * 6), new MaterialStack(Mats.MAT_MUD, n * 3))
.outputs(new MaterialStack(Mats.MAT_CMB, i)));
recipes.add(new CrucibleRecipe(16, "crucible.magtung", 3, new ItemStack(ModItems.ingot_magnetized_tungsten))
this.register(new CrucibleRecipe("crucible.magtung").setup(3, new ItemStack(ModItems.ingot_magnetized_tungsten))
.inputs(new MaterialStack(Mats.MAT_TUNGSTEN, i), new MaterialStack(Mats.MAT_SCHRABIDIUM, n * 1))
.outputs(new MaterialStack(Mats.MAT_MAGTUNG, i)));
recipes.add(new CrucibleRecipe(17, "crucible.bscco", 3, new ItemStack(ModItems.ingot_bscco))
this.register(new CrucibleRecipe("crucible.bscco").setup(3, new ItemStack(ModItems.ingot_bscco))
.inputs(new MaterialStack(Mats.MAT_BISMUTH, n * 2), new MaterialStack(Mats.MAT_STRONTIUM, n * 2), new MaterialStack(Mats.MAT_CALCIUM, n * 2), new MaterialStack(Mats.MAT_COPPER, n * 3))
.outputs(new MaterialStack(Mats.MAT_BSCCO, i)));
registerMoldsForNEI();
}
public static class CrucibleRecipe {
public MaterialStack[] input;
public MaterialStack[] output;
private int id;
private String name;
public int frequency = 1;
public ItemStack icon;
public CrucibleRecipe(int id, String name, int frequency, ItemStack icon) {
this.id = id;
this.name = name;
this.frequency = frequency;
this.icon = icon;
if(!indexMapping.containsKey(id)) {
indexMapping.put(id, this);
} else {
throw new IllegalStateException("Crucible recipe " + name + " has been registered with duplicate id " + id + " used by " + indexMapping.get(id).name + "!");
}
}
public CrucibleRecipe inputs(MaterialStack... input) {
this.input = input;
return this;
}
public CrucibleRecipe outputs(MaterialStack... output) {
this.output = output;
return this;
}
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public int getInputAmount() {
int content = 0;
for(MaterialStack stack : input) {
content += stack.amount;
}
return content;
}
}
@Override
public String getFileName() {
return "hbmCrucible.json";
}
@Override
public Object getRecipeObject() {
return this.recipes;
}
@Override
public String getComment() {
return "ID must be unique, but not sequential. Order in which the recipes are defined determines the order in which they are displayed in-game. "
@ -190,10 +146,10 @@ public class CrucibleRecipes extends SerializableRecipe {
@Override
public void readRecipe(JsonElement recipe) {
JsonObject obj = (JsonObject) recipe;
int id = obj.get("id").getAsInt();
String name = obj.get("name").getAsString();
int freq = obj.get("frequency").getAsInt();
ItemStack icon = this.readItemStack(obj.get("icon").getAsJsonArray());
MaterialStack[] input = new MaterialStack[obj.get("input").getAsJsonArray().size()];
for(int i = 0; i < input.length; i++) {
JsonArray entry = obj.get("input").getAsJsonArray().get(i).getAsJsonArray();
@ -201,6 +157,7 @@ public class CrucibleRecipes extends SerializableRecipe {
int amount = entry.get(1).getAsInt();
input[i] = new MaterialStack(Mats.matByName.get(matname), amount);
}
MaterialStack[] output = new MaterialStack[obj.get("output").getAsJsonArray().size()];
for(int i = 0; i < output.length; i++) {
JsonArray entry = obj.get("output").getAsJsonArray().get(i).getAsJsonArray();
@ -208,17 +165,18 @@ public class CrucibleRecipes extends SerializableRecipe {
int amount = entry.get(1).getAsInt();
output[i] = new MaterialStack(Mats.matByName.get(matname), amount);
}
recipes.add(new CrucibleRecipe(id, name, freq, icon).inputs(input).outputs(output));
this.register(new CrucibleRecipe(name).setup(freq, icon).inputs(input).outputs(output));
}
@Override
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
CrucibleRecipe rec = (CrucibleRecipe) recipe;
writer.name("id").value(rec.id);
writer.name("name").value(rec.name);
writer.name("name").value(rec.getInternalName());
writer.name("frequency").value(rec.frequency);
writer.name("icon");
this.writeItemStack(rec.icon, writer);
this.writeItemStack(rec.getIcon(), writer);
writer.name("input");
writer.beginArray();
for(MaterialStack mat : rec.input) {
@ -229,6 +187,7 @@ public class CrucibleRecipes extends SerializableRecipe {
writer.setIndent(" ");
}
writer.endArray();
writer.name("output");
writer.beginArray();
for(MaterialStack mat : rec.output) {
@ -240,13 +199,6 @@ public class CrucibleRecipes extends SerializableRecipe {
}
writer.endArray();
}
@Override
public void deleteRecipes() {
this.indexMapping.clear();
this.recipes.clear();
this.moldRecipes.clear();
}
/** Returns a map containing all recipes where an item becomes a liquid material in the crucible. */
public static HashMap<AStack, List<ItemStack>> getSmeltingRecipes() {

View File

@ -56,7 +56,6 @@ public abstract class SerializableRecipe {
recipeHandlers.add(new ShredderRecipes());
recipeHandlers.add(new SolderingRecipes());
recipeHandlers.add(new CombinationRecipes());
recipeHandlers.add(new CrucibleRecipes());
recipeHandlers.add(new CentrifugeRecipes());
recipeHandlers.add(new CrystallizerRecipes());
recipeHandlers.add(new RefineryRecipes());
@ -89,6 +88,7 @@ public abstract class SerializableRecipe {
recipeHandlers.add(new AnnihilatorRecipes());
//GENERIC
recipeHandlers.add(CrucibleRecipes.INSTANCE);
recipeHandlers.add(AssemblyMachineRecipes.INSTANCE);
recipeHandlers.add(ChemicalPlantRecipes.INSTANCE);
recipeHandlers.add(PUREXRecipes.INSTANCE);

View File

@ -1152,8 +1152,6 @@ public class ModItems {
public static Item blueprints;
public static Item blueprint_folder;
public static Item template_folder;
public static Item crucible_template;
public static Item fluid_identifier_multi;
public static Item fluid_icon;
public static Item siren_track;
@ -2164,6 +2162,7 @@ public class ModItems {
public static Item orange7;
public static Item orange8;
public static Item template_folder;
public static Item nothing;
public static Item broken_item;
@ -4017,8 +4016,6 @@ public class ModItems {
blueprints = new ItemBlueprints().setUnlocalizedName("blueprints").setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":blueprints");
blueprint_folder = new ItemBlueprintFolder().setUnlocalizedName("blueprint_folder").setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":blueprint_folder");
template_folder = new ItemTemplateFolder().setUnlocalizedName("template_folder").setMaxStackSize(1).setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":template_folder");
crucible_template = new ItemCrucibleTemplate().setUnlocalizedName("crucible_template").setMaxStackSize(1).setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":crucible_template");
fluid_identifier_multi = new ItemFluidIDMulti().setUnlocalizedName("fluid_identifier_multi").setMaxStackSize(1).setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":fluid_identifier_multi");
fluid_icon = new ItemFluidIcon().setUnlocalizedName("fluid_icon").setCreativeTab(null).setTextureName(RefStrings.MODID + ":fluid_icon");
fluid_tank_empty = new Item().setUnlocalizedName("fluid_tank_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_tank");
@ -4567,6 +4564,7 @@ public class ModItems {
orange7 = new Item().setUnlocalizedName("orange7").setTextureName(RefStrings.MODID + ":orange7");
orange8 = new Item().setUnlocalizedName("orange8").setTextureName(RefStrings.MODID + ":orange8");
template_folder = new Item().setUnlocalizedName("template_folder").setTextureName(RefStrings.MODID + ":template_folder");
nothing = new Item().setUnlocalizedName("nothing").setTextureName(RefStrings.MODID + ":nothing");
broken_item = new BrokenItem().setUnlocalizedName("broken_item").setTextureName(RefStrings.MODID + ":broken_item");
@ -5360,7 +5358,6 @@ public class ModItems {
//Folders
GameRegistry.registerItem(blueprints, blueprints.getUnlocalizedName());
GameRegistry.registerItem(blueprint_folder, blueprint_folder.getUnlocalizedName());
GameRegistry.registerItem(template_folder, template_folder.getUnlocalizedName());
GameRegistry.registerItem(bobmazon, bobmazon.getUnlocalizedName());
GameRegistry.registerItem(bobmazon_hidden, bobmazon_hidden.getUnlocalizedName());
@ -5444,7 +5441,6 @@ public class ModItems {
GameRegistry.registerItem(fluid_identifier_multi, fluid_identifier_multi.getUnlocalizedName());
GameRegistry.registerItem(fluid_icon, fluid_icon.getUnlocalizedName());
GameRegistry.registerItem(fluid_duct, fluid_duct.getUnlocalizedName());
GameRegistry.registerItem(crucible_template, crucible_template.getUnlocalizedName());
//Machine Items
GameRegistry.registerItem(fuse, fuse.getUnlocalizedName());
@ -6741,6 +6737,7 @@ public class ModItems {
GameRegistry.registerItem(memory, memory.getUnlocalizedName());
GameRegistry.registerItem(conveyor_wand, conveyor_wand.getUnlocalizedName());
GameRegistry.registerItem(template_folder, template_folder.getUnlocalizedName());
GameRegistry.registerItem(nothing, nothing.getUnlocalizedName());
GameRegistry.registerItem(broken_item, broken_item.getUnlocalizedName());
}

View File

@ -1,75 +0,0 @@
package com.hbm.items.machine;
import java.util.List;
import org.lwjgl.input.Keyboard;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.recipes.CrucibleRecipes;
import com.hbm.inventory.recipes.CrucibleRecipes.CrucibleRecipe;
import com.hbm.util.i18n.I18nUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
public class ItemCrucibleTemplate extends Item {
public ItemCrucibleTemplate() {
this.setHasSubtypes(true);
this.setMaxDamage(0);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List list) {
for(int i = 0; i < CrucibleRecipes.recipes.size(); i++) {
list.add(new ItemStack(item, 1, CrucibleRecipes.recipes.get(i).getId()));
}
}
public String getItemStackDisplayName(ItemStack stack) {
CrucibleRecipe recipe = CrucibleRecipes.indexMapping.get(stack.getItemDamage());
if(recipe == null) {
return super.getItemStackDisplayName(stack);
}
String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
String s1 = ("" + StatCollector.translateToLocal(recipe.getName())).trim();
if(s1 != null) {
s = s + " " + s1;
}
return s;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
CrucibleRecipe recipe = CrucibleRecipes.indexMapping.get(stack.getItemDamage());
if(recipe == null) {
return;
}
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("info.template_out_p"));
for(MaterialStack out : recipe.output) {
list.add(I18nUtil.resolveKey(out.material.getUnlocalizedName()) + ": " + Mats.formatAmount(out.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
}
list.add(EnumChatFormatting.BOLD + I18nUtil.resolveKey("info.template_in_p"));
for(MaterialStack in : recipe.input) {
list.add(I18nUtil.resolveKey(in.material.getUnlocalizedName()) + ": " + Mats.formatAmount(in.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
}
}
}

View File

@ -1,52 +0,0 @@
package com.hbm.items.machine;
import java.util.List;
import com.hbm.inventory.gui.GUIScreenTemplateFolder;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.util.BobMathUtil;
import com.hbm.util.i18n.I18nUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class ItemTemplateFolder extends Item implements IGUIProvider {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if(world.isRemote)
player.openGui(MainRegistry.instance, 0, world, 0, 0, 0);
return stack;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
String[] lang = I18nUtil.resolveKeyArray(ModItems.template_folder.getUnlocalizedName() + ".desc");
EnumChatFormatting color = BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.YELLOW;
for(String line : lang) {
list.add(color + line);
}
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
@Override
@SideOnly(Side.CLIENT)
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIScreenTemplateFolder(player);
}
}

View File

@ -68,7 +68,6 @@ public class ItemStarterKit extends Item {
player.inventory.addItemStackToInventory(new ItemStack(ModItems.ingot_uranium, 32));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.powder_yellowcake, 32));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.template_folder, 1));
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_press, 1));
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_difurnace_off, 1));
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.machine_gascent, 1));
@ -154,7 +153,6 @@ public class ItemStarterKit extends Item {
player.inventory.addItemStackToInventory(new ItemStack(ModBlocks.barrel_steel, 16));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.plate_iron, 64));
player.inventory.addItemStackToInventory(new ItemStack(Items.dye, 64));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.template_folder, 1));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.radaway_flush, 8));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.iv_blood, 8));
player.inventory.addItemStackToInventory(new ItemStack(ModItems.pill_iodine, 8));

View File

@ -545,8 +545,6 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.missile_shuttle, new ItemRenderMissileGeneric(RenderMissileType.TYPE_ROBIN));
MinecraftForgeClient.registerItemRenderer(ModItems.battery_pack, new ItemRenderBatteryPack());
//templates
MinecraftForgeClient.registerItemRenderer(ModItems.crucible_template, new ItemRenderTemplate());
//hot stuff
MinecraftForgeClient.registerItemRenderer(ModItems.ingot_steel_dusted, new ItemRendererHot());
MinecraftForgeClient.registerItemRenderer(ModItems.ingot_chainsteel, new ItemRendererHot());

View File

@ -654,7 +654,6 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModItems.door_office, 1), new Object[] { "II", "SS", "II", 'I', KEY_PLANKS, 'S', IRON.plate() });
addRecipeAuto(new ItemStack(ModItems.door_bunker, 1), new Object[] { "II", "SS", "II", 'I', STEEL.plate(), 'S', PB.plate() });
addShapelessAuto(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.crucible_template, 1, OreDictionary.WILDCARD_VALUE) });
addShapelessAuto(new ItemStack(Items.slime_ball, 16), new Object[] { new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 15), new ItemStack(Items.dye, 1, 15), Fluids.SULFURIC_ACID.getDict(1000) });
for(int i = 1; i < Fluids.getAll().length; ++i) {

View File

@ -1516,6 +1516,7 @@ public class MainRegistry {
ignoreMappings.add("hbm:item.redcoil_capacitor");
ignoreMappings.add("hbm:item.euphemium_capacitor");
ignoreMappings.add("hbm:item.toolbox_legacy");
ignoreMappings.add("hbm:item.crucible_template");
/// REMAP ///
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);

View File

@ -989,7 +989,6 @@ public class ModEventHandlerClient {
MainRegistry.logger.info("Taking a screenshot of ALL items, if you did this by mistake: fucking lmao get rekt nerd");
List<Item> ignoredItems = Arrays.asList(
ModItems.crucible_template,
ModItems.achievement_icon,
Items.spawn_egg,
Item.getItemFromBlock(Blocks.mob_spawner)

View File

@ -15,8 +15,6 @@ public class PacketDispatcher {
public static void registerPackets() {
int i = 0;
//Signals server to consume items and create template
wrapper.registerMessage(ItemFolderPacket.Handler.class, ItemFolderPacket.class, i++, Side.SERVER);
//Siren packet for looped sounds
wrapper.registerMessage(TESirenPacket.Handler.class, TESirenPacket.class, i++, Side.CLIENT);
//Signals server to change ItemStacks

View File

@ -1,156 +0,0 @@
package com.hbm.packet.toserver;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemCassette;
import com.hbm.items.machine.ItemCrucibleTemplate;
import com.hbm.util.InventoryUtil;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemFolderPacket implements IMessage {
int item;
int meta;
public ItemFolderPacket()
{
}
public ItemFolderPacket(ItemStack stack)
{
this.item = Item.getIdFromItem(stack.getItem());
this.meta = stack.getItemDamage();
}
@Override
public void fromBytes(ByteBuf buf) {
item = buf.readInt();
meta = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(item);
buf.writeInt(meta);
}
public static class Handler implements IMessageHandler<ItemFolderPacket, IMessage> {
/*
* While it is still horrible, it is arguably less horrible than it was before.
*/
@Override
public IMessage onMessage(ItemFolderPacket m, MessageContext ctx) {
//if(!Minecraft.getMinecraft().theWorld.isRemote)
EntityPlayer p = ctx.getServerHandler().playerEntity;
ItemStack stack = new ItemStack(Item.getItemById(m.item), 1, m.meta);
if(p.capabilities.isCreativeMode) {
p.inventory.addItemStackToInventory(stack);
return null;
}
if(stack.getItem() instanceof ItemCrucibleTemplate) {
tryMakeItem(p, stack, Items.paper, "dye");
return null;
}
if(stack.getItem() instanceof ItemCassette) {
tryMakeItem(p, stack, ModItems.plate_polymer, "plateSteel");
return null;
}
if(stack.getItem() == ModItems.stamp_stone_plate ||
stack.getItem() == ModItems.stamp_stone_wire ||
stack.getItem() == ModItems.stamp_stone_circuit) {
tryConvert(p, ModItems.stamp_stone_flat, stack.getItem());
return null;
}
if(stack.getItem() == ModItems.stamp_iron_plate ||
stack.getItem() == ModItems.stamp_iron_wire ||
stack.getItem() == ModItems.stamp_iron_circuit) {
tryConvert(p, ModItems.stamp_iron_flat, stack.getItem());
return null;
}
if(stack.getItem() == ModItems.stamp_steel_plate ||
stack.getItem() == ModItems.stamp_steel_wire ||
stack.getItem() == ModItems.stamp_steel_circuit) {
tryConvert(p, ModItems.stamp_steel_flat, stack.getItem());
return null;
}
if(stack.getItem() == ModItems.stamp_titanium_plate ||
stack.getItem() == ModItems.stamp_titanium_wire ||
stack.getItem() == ModItems.stamp_titanium_circuit) {
tryConvert(p, ModItems.stamp_titanium_flat, stack.getItem());
return null;
}
if(stack.getItem() == ModItems.stamp_obsidian_plate ||
stack.getItem() == ModItems.stamp_obsidian_wire ||
stack.getItem() == ModItems.stamp_obsidian_circuit) {
tryConvert(p, ModItems.stamp_obsidian_flat, stack.getItem());
return null;
}
if(stack.getItem() == ModItems.stamp_desh_plate ||
stack.getItem() == ModItems.stamp_desh_wire ||
stack.getItem() == ModItems.stamp_desh_circuit) {
tryConvert(p, ModItems.stamp_desh_flat, stack.getItem());
return null;
}
//}
return null;
}
private void tryMakeItem(EntityPlayer player, ItemStack output, Object... ingredients) {
//check
for(Object o : ingredients) {
if(o instanceof Item) {
if(!player.inventory.hasItem((Item)o))
return;
}
if(o instanceof String) {
if(!InventoryUtil.hasOreDictMatches(player, (String)o, 1))
return;
}
}
//consume
for(Object o : ingredients) {
if(o instanceof Item) {
player.inventory.consumeInventoryItem((Item)o);
}
if(o instanceof String) {
InventoryUtil.consumeOreDictMatches(player, (String)o, 1);
}
}
if(!player.inventory.addItemStackToInventory(output))
player.dropPlayerItemWithRandomChoice(output, true);
}
private void tryConvert(EntityPlayer player, Item target, Item result) {
for(int i = 0; i < player.inventory.mainInventory.length; i++) {
ItemStack stack = player.inventory.mainInventory[i];
if(stack != null && stack.getItem() == target) {
player.inventory.mainInventory[i] = new ItemStack(result, stack.stackSize, stack.getItemDamage());
return;
}
}
}
}
}

View File

@ -1,49 +0,0 @@
package com.hbm.render.item;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.recipes.CrucibleRecipes;
import com.hbm.items.ModItems;
import com.hbm.render.util.RenderItemStack;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class ItemRenderTemplate implements IItemRenderer {
private ItemStack currentItem;
public boolean handleRenderType(ItemStack stack, IItemRenderer.ItemRenderType type) {
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && (type == IItemRenderer.ItemRenderType.INVENTORY)) {
if(stack.getItem() == ModItems.crucible_template)
this.currentItem = CrucibleRecipes.indexMapping.get(stack.getItemDamage()).icon;
if(this.currentItem != null) {
return true;
}
}
return false;
}
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack stack, IItemRenderer.ItemRendererHelper renderHelper) {
return false;
}
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... args) {
GL11.glPushMatrix();
RenderHelper.enableGUIStandardItemLighting();
if(currentItem != null)
RenderItemStack.renderItemStack(0, 0, 1.0F, currentItem);
else
RenderItemStack.renderItemStack(0, 0, 1.0F, stack);
GL11.glPopMatrix();
}
}

View File

@ -11,15 +11,15 @@ import com.hbm.config.ServerConfig;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerCrucible;
import com.hbm.inventory.gui.GUICrucible;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.material.NTMMaterial;
import com.hbm.inventory.recipes.CrucibleRecipe;
import com.hbm.inventory.recipes.CrucibleRecipes;
import com.hbm.inventory.recipes.CrucibleRecipes.CrucibleRecipe;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.tileentity.IConfigurableMachine;
@ -31,6 +31,7 @@ import com.hbm.util.CrucibleUtil;
import api.hbm.block.ICrucibleAcceptor;
import api.hbm.tile.IHeatSource;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -48,10 +49,12 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityCrucible extends TileEntityMachineBase implements IGUIProvider, ICrucibleAcceptor, IConfigurableMachine, IMetalCopiable {
public class TileEntityCrucible extends TileEntityMachineBase implements IGUIProvider, ICrucibleAcceptor, IConfigurableMachine, IMetalCopiable, IControlReceiver {
public int heat;
public int progress;
public String recipe = "null";
public List<MaterialStack> recipeStack = new ArrayList();
public List<MaterialStack> wasteStack = new ArrayList();
@ -253,6 +256,8 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
super.serialize(buf);
buf.writeInt(progress);
buf.writeInt(heat);
ByteBufUtils.writeUTF8String(buf, recipe);
buf.writeShort(recipeStack.size());
for(MaterialStack sta : recipeStack) {
@ -278,6 +283,8 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
super.deserialize(buf);
progress = buf.readInt();
heat = buf.readInt();
recipe = ByteBufUtils.readUTF8String(buf);
recipeStack.clear();
wasteStack.clear();
@ -302,6 +309,8 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.recipe = nbt.getString("recipe");
int[] rec = nbt.getIntArray("rec");
for(int i = 0; i < rec.length / 2; i++) {
@ -320,6 +329,8 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setString("recipe", this.recipe);
int[] rec = new int[recipeStack.size() * 2];
int[] was = new int[wasteStack.size() * 2];
@ -439,11 +450,6 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
if(i == 0) {
return stack.getItem() == ModItems.crucible_template;
}
return isItemSmeltable(stack);
}
@ -515,12 +521,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
}
public CrucibleRecipe getLoadedRecipe() {
if(slots[0] != null && slots[0].getItem() == ModItems.crucible_template) {
return CrucibleRecipes.indexMapping.get(slots[0].getItemDamage());
}
return null;
return CrucibleRecipes.INSTANCE.recipeNameMap.get(recipe);
}
/* "Arrays and Lists don't have a common ancestor" my fucking ass */
@ -654,4 +655,20 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
return BobMathUtil.intCollectionToArray(types);
}
@Override
public boolean hasPermission(EntityPlayer player) {
return this.isUseableByPlayer(player);
}
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("index") && data.hasKey("selection")) {
int index = data.getInteger("index");
String selection = data.getString("selection");
if(index == 0) {
this.recipe = selection;
this.markChanged();
}
}
}
}

View File

@ -8,6 +8,7 @@ import java.util.Map.Entry;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.CompatHandler;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.interfaces.NotableComments;
import com.hbm.inventory.container.ContainerPWR;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
@ -47,6 +48,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@NotableComments
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityPWRController extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, SimpleComponent, IFluidStandardTransceiverMK2, CompatHandler.OCComponent, IRORValueProvider, IRORInteractive {
@ -638,23 +640,25 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
@Override public FluidTank[] getAllTanks() { return tanks; }
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] { tanks[1] }; }
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] { tanks[0] }; }
public static final String[] ROR = new String[] { // not to be confused with RUR
PREFIX_VALUE + "rods",
PREFIX_VALUE + "coreheat",
PREFIX_VALUE + "hullheat",
PREFIX_VALUE + "flux",
PREFIX_VALUE + "depletion",
PREFIX_FUNCTION + "setrods" + NAME_SEPARATOR + "percent",
PREFIX_FUNCTION + "jettison",
};
@Override
public String[] getFunctionInfo() {
return new String[] {
PREFIX_VALUE + "rods",
PREFIX_VALUE + "coreheat",
PREFIX_VALUE + "hullheat",
PREFIX_VALUE + "flux",
PREFIX_VALUE + "depletion",
PREFIX_FUNCTION + "setrods" + NAME_SEPARATOR + "percent",
PREFIX_FUNCTION + "jettison",
};
return ROR;
}
@Override
public String provideRORValue(String name) {
if((PREFIX_VALUE + "rods").equals(name)) return "" + (int) this.rodLevel;
if((PREFIX_VALUE + "rods").equals(name)) return "" + (int) (100 - this.rodLevel); // why the fuck did i invert this again?
if((PREFIX_VALUE + "coreheat").equals(name)) return "" + this.coreHeat;
if((PREFIX_VALUE + "hullheat").equals(name)) return "" + this.hullHeat;
if((PREFIX_VALUE + "flux").equals(name)) return "" + (int) this.flux;

View File

@ -12,7 +12,6 @@ import com.hbm.inventory.recipes.AmmoPressRecipes.AmmoPressRecipe;
import com.hbm.inventory.recipes.ArcFurnaceRecipes.ArcFurnaceRecipe;
import com.hbm.inventory.recipes.ArcWelderRecipes.ArcWelderRecipe;
import com.hbm.inventory.recipes.BreederRecipes.BreederRecipe;
import com.hbm.inventory.recipes.CrucibleRecipes.CrucibleRecipe;
import com.hbm.inventory.recipes.CrystallizerRecipes.CrystallizerRecipe;
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes.ElectrolysisRecipe;
import com.hbm.inventory.recipes.ElectrolyserMetalRecipes.ElectrolysisMetalRecipe;
@ -103,10 +102,10 @@ public class CompatRecipeRegistry {
CombinationRecipes.recipes.put(o, new Pair(output, fluid));
}
/** Crucible recipes need unique IDs, game will crash when an ID collision is detected! */
/** Numeric IDs are now unused, names need to be unique! */
public static void registerCrucible(int index, String name, int frequency, ItemStack icon, MaterialStack[] input, MaterialStack[] output) {
CrucibleRecipe recipe = new CrucibleRecipe(index, name, frequency, icon).inputs(input).outputs(output);
CrucibleRecipes.recipes.add(recipe);
CrucibleRecipe recipe = new CrucibleRecipe(name).setup(frequency, icon).inputs(input).outputs(output);
CrucibleRecipes.INSTANCE.register(recipe);
}
public static void registerCentrifuge(AStack input, ItemStack[] outputs) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB