mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
More work! Networking is just about complete, and all filter creation and edit GUIs now have replace stack slots and replace required buttons.
This commit is contained in:
1 parent
e66d4c5d93
commit
ad505cf882
6 files changed
+168
-58
No files matched your search
@@ -265,21 +265,6 @@ public class GuiDigitalMiner extends GuiMekanism
|
||||
}
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
int x = guiWidth + 144;
|
||||
int y = guiHeight + 27;
|
||||
drawGradientRect(x, y, x + 16, y + 16, -2130706433, -2130706433);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,49 +316,6 @@ public class GuiDigitalMiner extends GuiMekanism
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43)
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.thePlayer.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock)
|
||||
{
|
||||
toUse = stack.copy();
|
||||
toUse.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
{
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(2);
|
||||
|
||||
if(stack != null)
|
||||
{
|
||||
data.add(false);
|
||||
data.add(MekanismUtils.getID(toUse));
|
||||
data.add(toUse.getItemDamage());
|
||||
}
|
||||
else {
|
||||
data.add(true);
|
||||
}
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
@@ -10,6 +12,7 @@ import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
|
||||
import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket;
|
||||
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
|
||||
import mekanism.common.network.PacketNewFilter.NewFilterMessage;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
@@ -133,6 +136,15 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(filter.replaceStack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), filter.replaceStack, 149, 19);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59)
|
||||
{
|
||||
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis);
|
||||
@@ -258,6 +270,36 @@ public class GuiMItemStackFilter extends GuiMekanism
|
||||
filter.itemType = null;
|
||||
}
|
||||
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
|
||||
if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35)
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.thePlayer.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock)
|
||||
{
|
||||
toUse = stack.copy();
|
||||
toUse.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
{
|
||||
filter.replaceStack = toUse;
|
||||
}
|
||||
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,15 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(filter.replaceStack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), filter.replaceStack, 149, 19);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59)
|
||||
{
|
||||
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis);
|
||||
@@ -258,6 +267,36 @@ public class GuiMMaterialFilter extends GuiMekanism
|
||||
filter.materialItem = null;
|
||||
}
|
||||
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
|
||||
if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35)
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.thePlayer.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock)
|
||||
{
|
||||
toUse = stack.copy();
|
||||
toUse.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
{
|
||||
filter.replaceStack = toUse;
|
||||
}
|
||||
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,12 @@ import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -171,6 +174,15 @@ public class GuiMModIDFilter extends GuiMekanism
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
if(filter.replaceStack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), filter.replaceStack, 149, 19);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59)
|
||||
{
|
||||
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis);
|
||||
@@ -305,6 +317,36 @@ public class GuiMModIDFilter extends GuiMekanism
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
filter.requireStack = !filter.requireStack;
|
||||
}
|
||||
|
||||
if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35)
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.thePlayer.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock)
|
||||
{
|
||||
toUse = stack.copy();
|
||||
toUse.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
{
|
||||
filter.replaceStack = toUse;
|
||||
}
|
||||
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,11 @@ import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -174,6 +176,15 @@ public class GuiMOreDictFilter extends GuiMekanism
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
if(filter.replaceStack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), filter.replaceStack, 149, 19);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59)
|
||||
{
|
||||
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.requireReplace") + ": " + LangUtils.transYesNo(filter.requireStack), xAxis, yAxis);
|
||||
@@ -308,6 +319,36 @@ public class GuiMOreDictFilter extends GuiMekanism
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
filter.requireStack = !filter.requireStack;
|
||||
}
|
||||
|
||||
if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35)
|
||||
{
|
||||
boolean doNull = false;
|
||||
ItemStack stack = mc.thePlayer.inventory.getItemStack();
|
||||
ItemStack toUse = null;
|
||||
|
||||
if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
if(stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock)
|
||||
{
|
||||
toUse = stack.copy();
|
||||
toUse.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
doNull = true;
|
||||
}
|
||||
|
||||
if(toUse != null || doNull)
|
||||
{
|
||||
filter.replaceStack = toUse;
|
||||
}
|
||||
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ public abstract class MinerFilter
|
||||
|
||||
public void write(ArrayList data)
|
||||
{
|
||||
data.add(requireStack);
|
||||
|
||||
if(replaceStack != null)
|
||||
{
|
||||
data.add(true);
|
||||
@@ -54,6 +56,8 @@ public abstract class MinerFilter
|
||||
|
||||
protected void read(ByteBuf dataStream)
|
||||
{
|
||||
requireStack = dataStream.readBoolean();
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
{
|
||||
replaceStack = new ItemStack(Block.getBlockById(dataStream.readInt()), 1, dataStream.readInt());
|
||||
|
||||
Reference in new issue
Block a user