mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
more anvil work, RBMK irradiation channel IO
This commit is contained in:
parent
a2049e5e7b
commit
b1382eaac2
@ -17,7 +17,7 @@ public class RBMKOutgasser extends RBMKBase {
|
|||||||
return new TileEntityRBMKOutgasser();
|
return new TileEntityRBMKOutgasser();
|
||||||
|
|
||||||
if(hasExtra(meta))
|
if(hasExtra(meta))
|
||||||
return new TileEntityProxyCombo(false, false, true);
|
return new TileEntityProxyCombo(true, false, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -845,7 +845,7 @@ public class GUIHandler implements IGuiHandler {
|
|||||||
|
|
||||||
case ModBlocks.guiID_anvil: {
|
case ModBlocks.guiID_anvil: {
|
||||||
if(world.getBlock(x, y, z) instanceof NTMAnvil) {
|
if(world.getBlock(x, y, z) instanceof NTMAnvil) {
|
||||||
return new ContainerAnvil(player.inventory);
|
return new ContainerAnvil(player.inventory, ((NTMAnvil)world.getBlock(x, y, z)).tier);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,7 @@ public class AnvilRecipes {
|
|||||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||||
new OreDictStack("plateGold"),
|
new OreDictStack("plateGold"),
|
||||||
new AnvilOutput(new ItemStack(ModItems.wire_gold, 8))
|
new AnvilOutput(new ItemStack(ModItems.wire_gold, 8))
|
||||||
).setTier(1));
|
).setTierRange(1, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AnvilSmithingRecipe> getSmithing() {
|
public static List<AnvilSmithingRecipe> getSmithing() {
|
||||||
@ -151,7 +151,8 @@ public class AnvilRecipes {
|
|||||||
public static class AnvilConstructionRecipe {
|
public static class AnvilConstructionRecipe {
|
||||||
public List<AStack> input = new ArrayList();
|
public List<AStack> input = new ArrayList();
|
||||||
public List<AnvilOutput> output = new ArrayList();
|
public List<AnvilOutput> output = new ArrayList();
|
||||||
int tier = 0;
|
int tierLower = 0;
|
||||||
|
int tierUpper = -1;
|
||||||
OverlayType overlay = OverlayType.NONE;
|
OverlayType overlay = OverlayType.NONE;
|
||||||
|
|
||||||
public AnvilConstructionRecipe(AStack input, AnvilOutput output) {
|
public AnvilConstructionRecipe(AStack input, AnvilOutput output) {
|
||||||
@ -179,12 +180,21 @@ public class AnvilRecipes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AnvilConstructionRecipe setTier(int tier) {
|
public AnvilConstructionRecipe setTier(int tier) {
|
||||||
this.tier = tier;
|
this.tierLower = tier;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTier() {
|
public AnvilConstructionRecipe setTierRange(int lower, int upper) {
|
||||||
return this.tier;
|
this.tierLower = lower;
|
||||||
|
this.tierUpper = upper;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTierValid(int tier) {
|
||||||
|
if(this.tierUpper == -1)
|
||||||
|
return tier >= this.tierLower;
|
||||||
|
|
||||||
|
return tier >= this.tierLower && tier <= this.tierUpper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnvilConstructionRecipe setOverlay(OverlayType overlay) {
|
public AnvilConstructionRecipe setOverlay(OverlayType overlay) {
|
||||||
|
|||||||
@ -18,7 +18,10 @@ public class ContainerAnvil extends Container {
|
|||||||
public InventoryBasic input = new InventoryBasic("Input", false, 8);
|
public InventoryBasic input = new InventoryBasic("Input", false, 8);
|
||||||
public IInventory output = new InventoryCraftResult();
|
public IInventory output = new InventoryCraftResult();
|
||||||
|
|
||||||
public ContainerAnvil(InventoryPlayer inventory) {
|
public int tier; //because we can't trust these rascals with their packets
|
||||||
|
|
||||||
|
public ContainerAnvil(InventoryPlayer inventory, int tier) {
|
||||||
|
this.tier = tier;
|
||||||
|
|
||||||
this.addSlotToContainer(new SmithingSlot(input, 0, 17, 27));
|
this.addSlotToContainer(new SmithingSlot(input, 0, 17, 27));
|
||||||
this.addSlotToContainer(new SmithingSlot(input, 1, 53, 27));
|
this.addSlotToContainer(new SmithingSlot(input, 1, 53, 27));
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.inventory.gui;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.hbm.inventory.AnvilRecipes;
|
import com.hbm.inventory.AnvilRecipes;
|
||||||
@ -13,13 +14,11 @@ import com.hbm.inventory.RecipesCommon.ComparableStack;
|
|||||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||||
import com.hbm.inventory.container.ContainerAnvil;
|
import com.hbm.inventory.container.ContainerAnvil;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.packet.AuxButtonPacket;
|
|
||||||
import com.hbm.packet.PacketDispatcher;
|
|
||||||
|
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
@ -34,34 +33,90 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_anvil.png");
|
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_anvil.png");
|
||||||
|
|
||||||
private int tier;
|
private int tier;
|
||||||
|
private List<AnvilConstructionRecipe> originList = new ArrayList();
|
||||||
private List<AnvilConstructionRecipe> recipes = new ArrayList();
|
private List<AnvilConstructionRecipe> recipes = new ArrayList();
|
||||||
int index;
|
int index;
|
||||||
int size;
|
int size;
|
||||||
int selection;
|
int selection;
|
||||||
|
private GuiTextField search;
|
||||||
|
|
||||||
public GUIAnvil(InventoryPlayer player, int tier) {
|
public GUIAnvil(InventoryPlayer player, int tier) {
|
||||||
super(new ContainerAnvil(player));
|
super(new ContainerAnvil(player, tier));
|
||||||
|
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
this.xSize = 176;
|
this.xSize = 176;
|
||||||
this.ySize = 222;
|
this.ySize = 222;
|
||||||
this.index = 0;
|
|
||||||
this.selection = -1;
|
|
||||||
|
|
||||||
guiLeft = (this.width - this.xSize) / 2;
|
|
||||||
guiTop = (this.height - this.ySize) / 2;
|
|
||||||
|
|
||||||
for(AnvilConstructionRecipe recipe : AnvilRecipes.getConstruction()) {
|
for(AnvilConstructionRecipe recipe : AnvilRecipes.getConstruction()) {
|
||||||
if(recipe.getTier() <= this.tier)
|
if(recipe.isTierValid(this.tier))
|
||||||
this.recipes.add(recipe);
|
this.originList.add(recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.size = (int)Math.ceil((this.recipes.size() - 10) / 2D);
|
regenerateRecipes();
|
||||||
|
|
||||||
|
guiLeft = (this.width - this.xSize) / 2;
|
||||||
|
guiTop = (this.height - this.ySize) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
Keyboard.enableRepeatEvents(true);
|
||||||
|
this.search = new GuiTextField(this.fontRendererObj, guiLeft + 10, guiTop + 111, 84, 12);
|
||||||
|
this.search.setTextColor(-1);
|
||||||
|
this.search.setDisabledTextColour(-1);
|
||||||
|
this.search.setEnableBackgroundDrawing(false);
|
||||||
|
this.search.setMaxStringLength(25);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void regenerateRecipes() {
|
||||||
|
|
||||||
|
this.recipes.clear();
|
||||||
|
this.recipes.addAll(this.originList);
|
||||||
|
|
||||||
|
resetPaging();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void search(String search) {
|
||||||
|
|
||||||
|
search = search.toLowerCase();
|
||||||
|
|
||||||
|
this.recipes.clear();
|
||||||
|
|
||||||
|
if(search.isEmpty()) {
|
||||||
|
this.recipes.addAll(this.originList);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for(AnvilConstructionRecipe recipe : this.originList) {
|
||||||
|
List<String> list = recipeToSearchList(recipe);
|
||||||
|
|
||||||
|
for(String s : list) {
|
||||||
|
if(s.contains(search)) {
|
||||||
|
this.recipes.add(recipe);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resetPaging();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetPaging() {
|
||||||
|
|
||||||
|
this.index = 0;
|
||||||
|
this.selection = -1;
|
||||||
|
this.size = Math.max(0, (int)Math.ceil((this.recipes.size() - 10) / 2D));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void mouseClicked(int x, int y, int k) {
|
protected void mouseClicked(int x, int y, int k) {
|
||||||
super.mouseClicked(x, y, k);
|
super.mouseClicked(x, y, k);
|
||||||
|
|
||||||
|
this.search.mouseClicked(x, y, k);
|
||||||
|
|
||||||
if(guiLeft + 7 <= x && guiLeft + 7 + 9 > x && guiTop + 71 < y && guiTop + 71 + 36 >= y) {
|
if(guiLeft + 7 <= x && guiLeft + 7 + 9 > x && guiTop + 71 < y && guiTop + 71 + 36 >= y) {
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
if(this.index > 0)
|
if(this.index > 0)
|
||||||
@ -85,6 +140,12 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(guiLeft + 97 <= x && guiLeft + 97 + 18 > x && guiTop + 107 < y && guiTop + 107 + 18 >= y) {
|
||||||
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
|
search(this.search.getText());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = index * 2; i < index * 2 + 10; i++) {
|
for(int i = index * 2; i < index * 2 + 10; i++) {
|
||||||
|
|
||||||
if(i >= this.recipes.size())
|
if(i >= this.recipes.size())
|
||||||
@ -106,55 +167,24 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int mX, int mY) {
|
protected void drawGuiContainerForegroundLayer(int mX, int mY) {
|
||||||
String name = I18n.format("container.anvil", tier);
|
String name = I18n.format("container.anvil", tier);
|
||||||
this.fontRendererObj.drawString(name, 61 - this.fontRendererObj.getStringWidth(name) / 2, 8, 4210752);
|
this.fontRendererObj.drawString(name, 61 - this.fontRendererObj.getStringWidth(name) / 2, 8, 4210752);
|
||||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||||
|
|
||||||
if(this.selection >= 0) {
|
if(this.selection >= 0) {
|
||||||
int longest = 1;
|
|
||||||
List<String> list = new ArrayList();
|
|
||||||
AnvilConstructionRecipe recipe = recipes.get(this.selection);
|
AnvilConstructionRecipe recipe = recipes.get(this.selection);
|
||||||
|
List<String> list = recipeToList(recipe);
|
||||||
|
int longest = 0;
|
||||||
|
|
||||||
list.add(EnumChatFormatting.YELLOW + "Inputs:");
|
for(String s : list) {
|
||||||
|
int length = this.fontRendererObj.getStringWidth(s);
|
||||||
for(AStack stack : recipe.input) {
|
|
||||||
if(stack instanceof ComparableStack) {
|
if(length > longest)
|
||||||
ItemStack input = ((ComparableStack) stack).toStack();
|
longest = length;
|
||||||
String toAdd = ">" + input.stackSize + "x " + input.getDisplayName();
|
|
||||||
int len = this.fontRendererObj.getStringWidth(toAdd);
|
|
||||||
if(len > longest)
|
|
||||||
longest = len;
|
|
||||||
list.add(toAdd);
|
|
||||||
|
|
||||||
} else if(stack instanceof OreDictStack) {
|
|
||||||
OreDictStack input = (OreDictStack) stack;
|
|
||||||
ArrayList<ItemStack> ores = OreDictionary.getOres(input.name);
|
|
||||||
|
|
||||||
if(ores.size() > 0) {
|
|
||||||
ItemStack inStack = ores.get((int) (Math.abs(System.currentTimeMillis() / 1000) % ores.size()));
|
|
||||||
String toAdd = ">" + input.stacksize + "x " + inStack.getDisplayName();
|
|
||||||
int len = this.fontRendererObj.getStringWidth(toAdd);
|
|
||||||
if(len > longest)
|
|
||||||
longest = len;
|
|
||||||
list.add(toAdd);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
list.add("I AM ERROR");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
list.add("");
|
|
||||||
list.add(EnumChatFormatting.YELLOW + "Outputs:");
|
|
||||||
|
|
||||||
for(AnvilOutput stack : recipe.output) {
|
|
||||||
String toAdd = ">" + stack.stack.stackSize + "x " + stack.stack.getDisplayName() + (stack.chance != 1F ? (" (" + (stack.chance * 100) + "%)" ) : "");
|
|
||||||
int len = this.fontRendererObj.getStringWidth(toAdd);
|
|
||||||
if(len > longest)
|
|
||||||
longest = len;
|
|
||||||
list.add(toAdd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double scale = 0.5D;
|
double scale = 0.5D;
|
||||||
@ -173,27 +203,109 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the neat structured list for showing ingredients
|
||||||
|
* @param recipe
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<String> recipeToList(AnvilConstructionRecipe recipe) {
|
||||||
|
|
||||||
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
|
list.add(EnumChatFormatting.YELLOW + "Inputs:");
|
||||||
|
|
||||||
|
for(AStack stack : recipe.input) {
|
||||||
|
if(stack instanceof ComparableStack) {
|
||||||
|
ItemStack input = ((ComparableStack) stack).toStack();
|
||||||
|
list.add(">" + input.stackSize + "x " + input.getDisplayName());
|
||||||
|
|
||||||
|
} else if(stack instanceof OreDictStack) {
|
||||||
|
OreDictStack input = (OreDictStack) stack;
|
||||||
|
ArrayList<ItemStack> ores = OreDictionary.getOres(input.name);
|
||||||
|
|
||||||
|
if(ores.size() > 0) {
|
||||||
|
ItemStack inStack = ores.get((int) (Math.abs(System.currentTimeMillis() / 1000) % ores.size()));
|
||||||
|
list.add(">" + input.stacksize + "x " + inStack.getDisplayName());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
list.add("I AM ERROR");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add("");
|
||||||
|
list.add(EnumChatFormatting.YELLOW + "Outputs:");
|
||||||
|
|
||||||
|
for(AnvilOutput stack : recipe.output) {
|
||||||
|
list.add(">" + stack.stack.stackSize + "x " + stack.stack.getDisplayName() + (stack.chance != 1F ? (" (" + (stack.chance * 100) + "%)" ) : ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a simple, unstructured list of inputs (and all ore dict variants) and outputs for searching
|
||||||
|
* @param recipe
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<String> recipeToSearchList(AnvilConstructionRecipe recipe) {
|
||||||
|
|
||||||
|
List<String> list = new ArrayList();
|
||||||
|
|
||||||
|
for(AStack stack : recipe.input) {
|
||||||
|
if(stack instanceof ComparableStack) {
|
||||||
|
ItemStack input = ((ComparableStack) stack).toStack();
|
||||||
|
list.add(input.getDisplayName().toLowerCase());
|
||||||
|
|
||||||
|
} else if(stack instanceof OreDictStack) {
|
||||||
|
OreDictStack input = (OreDictStack) stack;
|
||||||
|
ArrayList<ItemStack> ores = OreDictionary.getOres(input.name);
|
||||||
|
|
||||||
|
if(ores.size() > 0) {
|
||||||
|
for(ItemStack ore : ores) {
|
||||||
|
list.add(ore.getDisplayName().toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(AnvilOutput stack : recipe.output) {
|
||||||
|
list.add(stack.stack.getDisplayName().toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
int lastSize = 1;
|
int lastSize = 1;
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float inter, int mX, int mY) {
|
protected void drawGuiContainerBackgroundLayer(float inter, int mX, int mY) {
|
||||||
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.mc.getTextureManager().bindTexture(texture);
|
this.mc.getTextureManager().bindTexture(texture);
|
||||||
|
|
||||||
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int slide = MathHelper.clamp_int(this.lastSize - 42, 0, 1000);
|
int slide = MathHelper.clamp_int(this.lastSize - 42, 0, 1000);
|
||||||
this.drawTexturedModalRect(guiLeft + 125 + slide, guiTop + 17, 125, 17, 54, 108);
|
this.drawTexturedModalRect(guiLeft + 125 + slide, guiTop + 17, 125, 17, 54, 108);
|
||||||
|
|
||||||
if(guiLeft + 7 <= mX && guiLeft + 7 + 9 > mX && guiTop + 71 < mY && guiTop + 71 + 36 >=mY) {
|
if(this.search.isFocused()) {
|
||||||
|
drawTexturedModalRect(guiLeft + 8, guiTop + 108, 168, 222, 88, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(guiLeft + 7 <= mX && guiLeft + 7 + 9 > mX && guiTop + 71 < mY && guiTop + 71 + 36 >= mY) {
|
||||||
drawTexturedModalRect(guiLeft + 7, guiTop + 71, 176, 186, 9, 36);
|
drawTexturedModalRect(guiLeft + 7, guiTop + 71, 176, 186, 9, 36);
|
||||||
}
|
}
|
||||||
if(guiLeft + 106 <= mX && guiLeft + 106 + 9 > mX && guiTop + 71 < mY && guiTop + 71 + 36 >=mY) {
|
if(guiLeft + 106 <= mX && guiLeft + 106 + 9 > mX && guiTop + 71 < mY && guiTop + 71 + 36 >= mY) {
|
||||||
drawTexturedModalRect(guiLeft + 106, guiTop + 71, 185, 186, 9, 36);
|
drawTexturedModalRect(guiLeft + 106, guiTop + 71, 185, 186, 9, 36);
|
||||||
}
|
}
|
||||||
if(guiLeft + 52 <= mX && guiLeft + 52 + 18 > mX && guiTop + 53 < mY && guiTop + 53 + 18 >=mY) {
|
if(guiLeft + 52 <= mX && guiLeft + 52 + 18 > mX && guiTop + 53 < mY && guiTop + 53 + 18 >= mY) {
|
||||||
drawTexturedModalRect(guiLeft + 52, guiTop + 53, 176, 150, 18, 18);
|
drawTexturedModalRect(guiLeft + 52, guiTop + 53, 176, 150, 18, 18);
|
||||||
}
|
}
|
||||||
|
if(guiLeft + 97 <= mX && guiLeft + 97 + 18 > mX && guiTop + 107 < mY && guiTop + 107 + 18 >= mY) {
|
||||||
|
drawTexturedModalRect(guiLeft + 97, guiTop + 107, 176, 168, 18, 18);
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = index * 2; i < index * 2 + 10; i++) {
|
for(int i = index * 2; i < index * 2 + 10; i++) {
|
||||||
if(i >= recipes.size())
|
if(i >= recipes.size())
|
||||||
@ -225,5 +337,22 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
if(selection == i)
|
if(selection == i)
|
||||||
this.drawTexturedModalRect(guiLeft + 16 + 18 * (ind / 2), guiTop + 71 + 18 * (ind % 2), 0, 222, 18, 18);
|
this.drawTexturedModalRect(guiLeft + 16 + 18 * (ind / 2), guiTop + 71 + 18 * (ind % 2), 0, 222, 18, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.search.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char c, int key) {
|
||||||
|
|
||||||
|
if(!this.search.textboxKeyTyped(c, key)) {
|
||||||
|
|
||||||
|
if(key == 28) {
|
||||||
|
this.search.setFocused(false);
|
||||||
|
search(this.search.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
super.keyTyped(c, key);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3488,7 +3488,7 @@ public class ModItems {
|
|||||||
.setHeat(2D)
|
.setHeat(2D)
|
||||||
.setMeltingPoint(5211).setUnlocalizedName("rbmk_fuel_heaus").setTextureName(RefStrings.MODID + ":rbmk_fuel_heaus");
|
.setMeltingPoint(5211).setUnlocalizedName("rbmk_fuel_heaus").setTextureName(RefStrings.MODID + ":rbmk_fuel_heaus");
|
||||||
rbmk_fuel_po210be = (ItemRBMKRod) new ItemRBMKRod(rbmk_pellet_po210be)
|
rbmk_fuel_po210be = (ItemRBMKRod) new ItemRBMKRod(rbmk_pellet_po210be)
|
||||||
.setYield(1000000D)
|
.setYield(25000000D)
|
||||||
.setStats(15, 40)
|
.setStats(15, 40)
|
||||||
.setFunction(EnumBurnFunc.SQUARE_ROOT)
|
.setFunction(EnumBurnFunc.SQUARE_ROOT)
|
||||||
.setHeat(0.1D)
|
.setHeat(0.1D)
|
||||||
@ -3506,7 +3506,7 @@ public class ModItems {
|
|||||||
.addRadiation(ItemHazard.rabe * ItemHazard.rod_rbmk).toItem()
|
.addRadiation(ItemHazard.rabe * ItemHazard.rod_rbmk).toItem()
|
||||||
.setUnlocalizedName("rbmk_fuel_ra226be").setTextureName(RefStrings.MODID + ":rbmk_fuel_ra226be");
|
.setUnlocalizedName("rbmk_fuel_ra226be").setTextureName(RefStrings.MODID + ":rbmk_fuel_ra226be");
|
||||||
rbmk_fuel_pu238be = (ItemRBMKRod) new ItemRBMKRod(rbmk_pellet_pu238be)
|
rbmk_fuel_pu238be = (ItemRBMKRod) new ItemRBMKRod(rbmk_pellet_pu238be)
|
||||||
.setYield(10000000D)
|
.setYield(50000000D)
|
||||||
.setStats(10, 50)
|
.setStats(10, 50)
|
||||||
.setFunction(EnumBurnFunc.SQUARE_ROOT)
|
.setFunction(EnumBurnFunc.SQUARE_ROOT)
|
||||||
.setHeat(0.1D)
|
.setHeat(0.1D)
|
||||||
|
|||||||
59
src/main/java/com/hbm/packet/AnvilCraftPacket.java
Normal file
59
src/main/java/com/hbm/packet/AnvilCraftPacket.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package com.hbm.packet;
|
||||||
|
|
||||||
|
import com.hbm.inventory.AnvilRecipes;
|
||||||
|
import com.hbm.inventory.AnvilRecipes.AnvilConstructionRecipe;
|
||||||
|
import com.hbm.inventory.container.ContainerAnvil;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class AnvilCraftPacket implements IMessage {
|
||||||
|
|
||||||
|
int recipeIndex;
|
||||||
|
int mode;
|
||||||
|
|
||||||
|
public AnvilCraftPacket() { }
|
||||||
|
|
||||||
|
public AnvilCraftPacket(AnvilConstructionRecipe recipe, int mode) {
|
||||||
|
this.recipeIndex = AnvilRecipes.getConstruction().indexOf(recipe);
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf) {
|
||||||
|
this.recipeIndex = buf.readInt();
|
||||||
|
this.mode = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf) {
|
||||||
|
buf.writeInt(this.recipeIndex);
|
||||||
|
buf.writeInt(this.mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Handler implements IMessageHandler<AnvilCraftPacket, IMessage> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(AnvilCraftPacket m, MessageContext ctx) {
|
||||||
|
|
||||||
|
if(m.recipeIndex < 0 || m.recipeIndex >= AnvilRecipes.getConstruction().size()) //recipe is out of range -> bad
|
||||||
|
return null;
|
||||||
|
|
||||||
|
EntityPlayer p = ctx.getServerHandler().playerEntity;
|
||||||
|
|
||||||
|
if(!(p.openContainer instanceof ContainerAnvil)) //player isn't even using an anvil -> bad
|
||||||
|
return null;
|
||||||
|
|
||||||
|
ContainerAnvil anvil = (ContainerAnvil)p.openContainer;
|
||||||
|
AnvilConstructionRecipe recipe = AnvilRecipes.getConstruction().get(m.recipeIndex);
|
||||||
|
|
||||||
|
if(!recipe.isTierValid(anvil.tier)) //player is using the wrong type of anvil -> bad
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -99,6 +99,8 @@ public class PacketDispatcher {
|
|||||||
wrapper.registerMessage(KeybindPacket.Handler.class, KeybindPacket.class, i++, Side.SERVER);
|
wrapper.registerMessage(KeybindPacket.Handler.class, KeybindPacket.class, i++, Side.SERVER);
|
||||||
//Packet to send NBT data from clients to serverside TEs
|
//Packet to send NBT data from clients to serverside TEs
|
||||||
wrapper.registerMessage(NBTControlPacket.Handler.class, NBTControlPacket.class, i++, Side.SERVER);
|
wrapper.registerMessage(NBTControlPacket.Handler.class, NBTControlPacket.class, i++, Side.SERVER);
|
||||||
|
//Packet to send for anvil recipes to be crafted
|
||||||
|
wrapper.registerMessage(AnvilCraftPacket.Handler.class, AnvilCraftPacket.class, i++, Side.SERVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,11 +42,11 @@ public class RenderFEL extends TileEntitySpecialRenderer {
|
|||||||
|
|
||||||
switch(fel.mode) {
|
switch(fel.mode) {
|
||||||
case 0: color = 0x303000; break;
|
case 0: color = 0x303000; break;
|
||||||
case 1: color = 0x400000; break;
|
case 1: color = 0xFF1010; break;
|
||||||
case 2: color = Color.HSBtoRGB(fel.getWorldObj().getTotalWorldTime() / 50.0F, 1F, 0.3F) & 16777215; break;
|
case 2: color = Color.HSBtoRGB(fel.getWorldObj().getTotalWorldTime() / 50.0F, 1F, 0.3F) & 16777215; break;
|
||||||
case 3: color = 0x100040; break;
|
case 3: color = 0x150560; break;
|
||||||
case 4: color = 0x003000; break;
|
case 4: color = 0x054005; break;
|
||||||
case 5: color = 0x306000; break;
|
case 5: color = 0x156015; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = 25;
|
int length = 25;
|
||||||
|
|||||||
@ -261,4 +261,19 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
|
|||||||
nbt.setDouble("progress", this.progress);
|
nbt.setDouble("progress", this.progress);
|
||||||
this.gas.writeToNBT(nbt, "gas");
|
this.gas.writeToNBT(nbt, "gas");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||||
|
return getOutput(itemStack) != null && i == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||||
|
return i == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||||
|
return new int[] {0, 1};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,9 @@ package com.hbm.util;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
@ -185,4 +188,11 @@ public class InventoryUtil {
|
|||||||
|
|
||||||
return stack1.getTagCompound().equals(stack2.getTagCompound());
|
return stack1.getTagCompound().equals(stack2.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean doesPlayerHaveAStacks(EntityPlayer player, List<AStack> stacks) {
|
||||||
|
|
||||||
|
//ItemStack[] inventory TODO
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.3 KiB |
Loading…
x
Reference in New Issue
Block a user