Compare commits
No commits in common. 'main' and 'visibileWires' have entirely different histories.
main
...
visibileWi
@ -1,3 +1,32 @@
|
||||
# Astoria's Wiremod
|
||||
# Minimal Mod
|
||||
|
||||
TODO
|
||||
Babric example mod, without the examples.
|
||||
|
||||
## Prerequisites
|
||||
- JDK for Java 17 ([Eclipse Temurin](https://adoptium.net/temurin/releases/) recommended)
|
||||
- IntelliJ IDEA
|
||||
- Minecraft Development plugin (Optional, but highly recommended)
|
||||
|
||||
## Setup instructions
|
||||
|
||||
1. Download or clone this repository and put it somewhere.
|
||||
```
|
||||
git clone https://github.com/Turnip-Labs/bta-minimal-mod.git
|
||||
```
|
||||
|
||||
2. Import the project in IntelliJ IDEA, close it and open it again.
|
||||
|
||||
|
||||
3. Create a new run configuration by going in `Run > Edit Configurations`
|
||||
Then click on the plus icon and select Gradle. In the `Tasks and Arguments` field enter `build`
|
||||
Running it will build your finished jar files and put them in `build/libs/`
|
||||
|
||||
|
||||
4. Open `File > Settings` and head to `Build, Execution, Development > Build Tools > Gradle`
|
||||
Change `Build and run using` and `Run tests using` to `IntelliJ IDEA`
|
||||
|
||||
|
||||
5. Open `File > Project Structure`, select `Project` and set `Compiler output` to your project's path/out.
|
||||
|
||||
|
||||
6. Done! Now all that's left is to change every mention of `examplemod` to your own mod id. Happy modding!
|
||||
|
@ -1,83 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod;
|
||||
import com.moandjiezana.toml.Toml;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import static net.brokenmoon.afloydwiremod.WireMod.LOGGER;
|
||||
|
||||
public class WiremodConfig {
|
||||
|
||||
//Packet ID's
|
||||
public int programmerGuiPacket;
|
||||
public int programmingPacket;
|
||||
public int wiringGuiPacket;
|
||||
public int syncPacket;
|
||||
public int wiringPacket;
|
||||
public int wiringSettingsPacket;
|
||||
public int chipSettingsPacket;
|
||||
//Tiles
|
||||
public int chipTileID;
|
||||
public int linkTileInactiveID;
|
||||
public int linkTileActiveID;
|
||||
public int displayTileID;
|
||||
//Items
|
||||
public int programmerItemID;
|
||||
public int wiringItemID;
|
||||
public int redsilicaID;
|
||||
public int dieID;
|
||||
public int dieOvercookedID;
|
||||
public int scrollrate;
|
||||
|
||||
|
||||
public WiremodConfig(){
|
||||
Toml toml = new Toml().read(this.getConfig());
|
||||
//Packets
|
||||
programmingPacket = toml.getLong("ids.packet.programming", (long)109).intValue();
|
||||
programmerGuiPacket = toml.getLong("ids.packet.programmerGui", (long)110).intValue();
|
||||
wiringPacket = toml.getLong("ids.packet.wiring", (long)111).intValue();
|
||||
wiringGuiPacket = toml.getLong("ids.packet.wiringGui", (long)112).intValue();
|
||||
wiringSettingsPacket = toml.getLong("ids.packet.wiringSettingsGui", (long)113).intValue();
|
||||
syncPacket = toml.getLong("ids.packet.sync", (long)114).intValue();
|
||||
chipSettingsPacket = toml.getLong("ids.packet.chipSettingsGui", (long)115).intValue();
|
||||
//Tiles
|
||||
chipTileID = toml.getLong("ids.tile.chipTile", (long)905).intValue();
|
||||
linkTileInactiveID = toml.getLong("ids.tile.linkTileInactive", (long)906).intValue();
|
||||
linkTileActiveID = toml.getLong("ids.tile.linkTileActive", (long)907).intValue();
|
||||
displayTileID = toml.getLong("ids.tile.displayTile", (long)908).intValue();
|
||||
//Items
|
||||
programmerItemID = toml.getLong("ids.item.programmingTool", (long)909).intValue();
|
||||
wiringItemID = toml.getLong("ids.item.wiringTool", (long)910).intValue();
|
||||
redsilicaID = toml.getLong("ids.item.redSilica", (long)911).intValue();
|
||||
dieID = toml.getLong("ids.item.chipDie", (long)912).intValue();
|
||||
dieOvercookedID = toml.getLong("ids.item.chipDieOvercooked", (long)913).intValue();
|
||||
//Various settings
|
||||
scrollrate = toml.getLong("misc.scrollrate", (long)5).intValue();
|
||||
|
||||
}
|
||||
public static File getConfig() {
|
||||
File config = new File("config/AWM.toml");
|
||||
if (!config.exists()) {
|
||||
LOGGER.warn("Config For AWM Not Found! Creating new config based upon default :)");
|
||||
InputStream in;
|
||||
OutputStream out;
|
||||
try {
|
||||
File configDir = new File("config");
|
||||
if (!configDir.exists())
|
||||
configDir.mkdir();
|
||||
in = WireMod.class.getClassLoader().getResourceAsStream("assets/afloydwiremod/config.toml");
|
||||
out = new FileOutputStream(config);
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = in.read(buffer)) > 0) {
|
||||
out.write(buffer, 0, length);
|
||||
}
|
||||
return getConfig();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("Config for AWM loaded!");
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,161 +1,36 @@
|
||||
package net.brokenmoon.afloydwiremod.gui;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.WireMod;
|
||||
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
|
||||
import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerPacket;
|
||||
import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.*;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiProgrammer extends GuiScrollable {
|
||||
|
||||
private AbstractWireTileEntity wireEntity;
|
||||
|
||||
public int xSize = 100;
|
||||
public int ySize = 180;
|
||||
private int numOfElements = 0;
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
//this.height - 240 is top
|
||||
//This.width / 2
|
||||
numOfElements = 0;
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Constant"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Increment"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Decrement"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Counter"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Duplicate"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Addition"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Subtraction"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Multiplication"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Division"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Memory"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "Pulse"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "TRUE"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "FALSE"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "AND"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "NAND"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "OR"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "NOR"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "XOR"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "XNOR"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "NOT"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "=="));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "!="));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, ">"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, ">="));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "<"));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "<="));
|
||||
this.controlList.add(new GuiButtonExtended(numOfElements++, this.width, "<=>"));
|
||||
this.controlList.add(new GuiButtonExtended(1, this.width, "Constant"));
|
||||
this.controlList.add(new GuiButtonExtended(2, this.width, "Count"));
|
||||
}
|
||||
|
||||
public GuiProgrammer(EntityPlayer player, ChipTileEntity wireEntity) {
|
||||
public GuiProgrammer(EntityPlayer player, AbstractWireTileEntity wireEntity) {
|
||||
super.initGui();
|
||||
this.player = player;
|
||||
this.wireEntity = wireEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
switch(guibutton.displayString){
|
||||
case "Constant":
|
||||
this.setMode("constant");
|
||||
break;
|
||||
case "Increment":
|
||||
this.setMode("inc");
|
||||
break;
|
||||
case "Duplicate":
|
||||
this.setMode("dup");
|
||||
break;
|
||||
case "Addition":
|
||||
this.setMode("add");
|
||||
break;
|
||||
case "Subtraction":
|
||||
this.setMode("sub");
|
||||
break;
|
||||
case "Multiplication":
|
||||
this.setMode("mult");
|
||||
break;
|
||||
case "Division":
|
||||
this.setMode("div");
|
||||
break;
|
||||
case "Decrement":
|
||||
this.setMode("dec");
|
||||
break;
|
||||
case "Counter":
|
||||
this.setMode("incdec");
|
||||
break;
|
||||
case "Memory":
|
||||
this.setMode("mem");
|
||||
break;
|
||||
case "TRUE":
|
||||
case "FALSE":
|
||||
case "NOT":
|
||||
case "AND":
|
||||
case "OR":
|
||||
case "XOR":
|
||||
case "NAND":
|
||||
case "NOR":
|
||||
case "XNOR":
|
||||
case "==":
|
||||
case "!=":
|
||||
case ">":
|
||||
case ">=":
|
||||
case "<":
|
||||
case "<=":
|
||||
case "<=>":
|
||||
case "Pulse":
|
||||
this.setMode(guibutton.displayString);
|
||||
break;
|
||||
if(wireEntity instanceof ChipTileEntity) {
|
||||
if (guibutton.id == 1) {
|
||||
((ChipTileEntity) wireEntity).setMode("constant");
|
||||
} else if (guibutton.id == 2) {
|
||||
((ChipTileEntity) wireEntity).setMode("count");
|
||||
}
|
||||
}
|
||||
this.mc.displayGuiScreen(null);
|
||||
}
|
||||
|
||||
public void setMode(String string){
|
||||
if(this.player instanceof EntityClientPlayerMP){
|
||||
NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue;
|
||||
netclienthandler.addToSendQueue(new WiremodProgrammerPacket(string, wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord));
|
||||
return;
|
||||
}
|
||||
((ChipTileEntity)Minecraft.getMinecraft().theWorld.getBlockTileEntity(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord)).setMode(string);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float renderPartialTicks){
|
||||
this.drawDefaultBackground();
|
||||
//Draw the overlay
|
||||
this.drawGuiBackground(renderPartialTicks);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
GL11.glScissor((width / 2 - 60) * this.mc.resolution.scale, (height / 2 - 80) * this.mc.resolution.scale, 120 * this.mc.resolution.scale, 160 * this.mc.resolution.scale);
|
||||
int k = (this.height - this.ySize) / 2;
|
||||
int wheel = Mouse.getDWheel();
|
||||
if(wheel > 0)
|
||||
scroll += WireMod.config.scrollrate;
|
||||
if (wheel < 0)
|
||||
scroll -= WireMod.config.scrollrate;
|
||||
if(scroll > 0)
|
||||
scroll = 0;
|
||||
if(-scroll > (numOfElements - 16) * GuiButtonExtended.height)
|
||||
scroll = -((numOfElements - 16) * GuiButtonExtended.height);
|
||||
for (int i = 0; i < this.controlList.size(); ++i) {
|
||||
GuiButtonExtended guibutton = (GuiButtonExtended)this.controlList.get(i);
|
||||
guibutton.yPosition = k + (guibutton.height * (guibutton.id + 1) + scroll);
|
||||
guibutton.drawButton(this.mc, x, y);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
protected void drawGuiBackground(float f) {
|
||||
int guiTexture = this.mc.renderEngine.getTexture("/assets/afloydwiremod/gui/programmer.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(guiTexture);
|
||||
int j = (this.width - this.xSize) / 2;
|
||||
int k = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,31 @@
|
||||
package net.brokenmoon.afloydwiremod.gui;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.GuiButton;
|
||||
import net.minecraft.src.GuiScreen;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class GuiScrollable extends GuiScreen {
|
||||
public EntityPlayer player;
|
||||
public int scroll;
|
||||
private int scroll;
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float renderPartialTicks) {
|
||||
//TODO: Tweak these values later to fit all the stuff
|
||||
int wheel = Mouse.getDWheel();
|
||||
if(wheel > 0)
|
||||
scroll++;
|
||||
if (wheel < 0)
|
||||
scroll--;
|
||||
if(scroll > 150)
|
||||
scroll = 150;
|
||||
if(scroll < 0)
|
||||
scroll = 0;
|
||||
for (int i = 0; i < this.controlList.size(); ++i) {
|
||||
GuiButtonExtended guibutton = (GuiButtonExtended)this.controlList.get(i);
|
||||
if(scroll >= 0)
|
||||
guibutton.scroll = scroll;
|
||||
if(scroll <= 0)
|
||||
guibutton.scroll = scroll;
|
||||
if(guibutton.yPosition >= 50 && guibutton.yPosition <= 200)
|
||||
guibutton.drawButton(this.mc, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.mixin;
|
||||
|
||||
import net.minecraft.src.Packet;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(value = Packet.class, remap = false)
|
||||
public interface AccessorPacket {
|
||||
@Invoker("addIdClassMapping")
|
||||
static void callAddIdClassMapping(int i, boolean clientPacket, boolean serverPacket, Class class1) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.mixin;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
|
||||
import net.brokenmoon.afloydwiremod.item.ToolWiring;
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.IEntityPlayer;
|
||||
import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerGuiPacket;
|
||||
import net.brokenmoon.afloydwiremod.packet.WiremodWireGuiPacket;
|
||||
import net.brokenmoon.afloydwiremod.packet.WiremodWiringGuiPacket;
|
||||
import net.minecraft.src.*;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(value = EntityPlayerMP.class, remap = false)
|
||||
public class MixinEntityPlayerMP implements IEntityPlayer {
|
||||
@Shadow public NetServerHandler playerNetServerHandler;
|
||||
|
||||
@Override
|
||||
public void displayGuiProgrammer(AbstractWireTileEntity chip) {
|
||||
this.playerNetServerHandler.sendPacket(new WiremodProgrammerGuiPacket(0, chip.xCoord, chip.yCoord, chip.zCoord));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayGuiWiring(ToolWiring tool, AbstractWireTileEntity chip, int x, int y, int z) {
|
||||
this.playerNetServerHandler.sendPacket(new WiremodWiringGuiPacket(chip.xCoord, chip.yCoord, chip.zCoord, x, y, z));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayGuiSettings(AbstractWireTileEntity chip) {
|
||||
this.playerNetServerHandler.sendPacket(new WiremodProgrammerGuiPacket(1, chip.xCoord, chip.yCoord, chip.zCoord));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayGuiWireSettings() {
|
||||
this.playerNetServerHandler.sendPacket(new WiremodWireGuiPacket());
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.mixin;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.WireMod;
|
||||
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
|
||||
import net.brokenmoon.afloydwiremod.gui.GuiWiring;
|
||||
import net.brokenmoon.afloydwiremod.item.ToolWiring;
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.IEntityPlayer;
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.brokenmoon.afloydwiremod.packet.*;
|
||||
import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.NetClientHandler;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(value = NetClientHandler.class, remap = false)
|
||||
public class MixinNetClientHandler implements INetHandler {
|
||||
@Shadow
|
||||
Minecraft mc;
|
||||
@Override
|
||||
public void wiremodHandleOpenProgrammerGUI(WiremodProgrammerGuiPacket packet) {
|
||||
if(packet.mode == 0)
|
||||
((IEntityPlayer)this.mc.thePlayer).displayGuiProgrammer((ChipTileEntity)this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z));
|
||||
if(packet.mode == 1)
|
||||
((IEntityPlayer)this.mc.thePlayer).displayGuiSettings((AbstractWireTileEntity)this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleProgramTile(WiremodProgrammerPacket wiremodProgrammerPacket) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleOpenWiringGUI(WiremodWiringGuiPacket packet) {
|
||||
if(this.mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ToolWiring)
|
||||
((IEntityPlayer)this.mc.thePlayer).displayGuiWiring(((ToolWiring)this.mc.thePlayer.inventory.getCurrentItem().getItem()), (AbstractWireTileEntity) this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z), packet.x2, packet.y2, packet.z2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleIODisc(WiremodPacketSyncIO packet) {
|
||||
boolean test = this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z) instanceof ChipTileEntity;
|
||||
TileEntity tileentity;
|
||||
if (this.mc.theWorld.blockExists(packet.x, packet.y, packet.z) && (tileentity = this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z)) instanceof AbstractWireTileEntity) {
|
||||
AbstractWireTileEntity wireEntity = (AbstractWireTileEntity)tileentity;
|
||||
wireEntity.inputs = packet.io;
|
||||
wireEntity.outputs = packet.oi;
|
||||
wireEntity.onInventoryChanged();
|
||||
if(wireEntity instanceof ChipTileEntity){
|
||||
((ChipTileEntity) wireEntity).mode = packet.mode;
|
||||
((ChipTileEntity) wireEntity).tickAmount = packet.tickAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleWireChips(WiremodWiringPacket wiremodWiringPacket) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleWireToolSettingsGui(WiremodWireGuiPacket wiremodWireGuiPacket) {
|
||||
((IEntityPlayer)this.mc.thePlayer).displayGuiWireSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleSettings(WiremodSettingsPacket wiremodSettingsPacket) {
|
||||
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.mixin;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
|
||||
import net.brokenmoon.afloydwiremod.api.WireConnection;
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.brokenmoon.afloydwiremod.packet.*;
|
||||
import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.NetServerHandler;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Mixin(value = NetServerHandler.class, remap = false)
|
||||
public class MixinNetServerHandler implements INetHandler {
|
||||
@Shadow
|
||||
private MinecraftServer mcServer;
|
||||
@Shadow
|
||||
private EntityPlayerMP playerEntity;
|
||||
|
||||
@Override
|
||||
public void wiremodHandleOpenProgrammerGUI(WiremodProgrammerGuiPacket packet) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleProgramTile(WiremodProgrammerPacket packet) {
|
||||
((ChipTileEntity)this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x, packet.y, packet.z)).setMode(packet.mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleOpenWiringGUI(WiremodWiringGuiPacket wiremodWiringGuiPacket) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleIODisc(WiremodPacketSyncIO wiremodPacketSyncIO) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleWireChips(WiremodWiringPacket packet) {
|
||||
switch(packet.type){
|
||||
case 0:
|
||||
AbstractWireTileEntity wireEntity;
|
||||
if(!packet.backwired) {
|
||||
wireEntity = (AbstractWireTileEntity) this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x1, packet.y1, packet.z1);
|
||||
wireEntity.outputs[packet.slot1].wire = new WireConnection(packet.x2, packet.y2, packet.z2, packet.slot1, packet.slot2, packet.xadd, packet.yadd, packet.zadd, packet.sideadd, packet.backwired, packet.red, packet.green, packet.blue, packet.alpha, packet.width);
|
||||
} else{
|
||||
wireEntity = (AbstractWireTileEntity) this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x2, packet.y2, packet.z2);
|
||||
wireEntity.outputs[packet.slot2].wire = new WireConnection(packet.x1, packet.y1, packet.z1, packet.slot2, packet.slot1, packet.xadd, packet.yadd, packet.zadd, packet.sideadd, packet.backwired, packet.red, packet.green, packet.blue, packet.alpha, packet.width);
|
||||
}
|
||||
wireEntity.update();
|
||||
wireEntity.updateIO();
|
||||
break;
|
||||
case 1:
|
||||
AbstractWireTileEntity otherEntity = (AbstractWireTileEntity)this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x1, packet.y1, packet.z1);
|
||||
otherEntity.inputs[packet.slot2].wire = new WireConnection(packet.x2, packet.y2, packet.z2, packet.slot2, packet.slot1);
|
||||
otherEntity.update();
|
||||
otherEntity.updateIO();
|
||||
break;
|
||||
}
|
||||
this.mcServer.getWorldManager(this.playerEntity.dimension).markBlockNeedsUpdate(packet.x1, packet.y1, packet.z1);
|
||||
this.mcServer.getWorldManager(this.playerEntity.dimension).markBlockNeedsUpdate(packet.x2, packet.y2, packet.z2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleWireToolSettingsGui(WiremodWireGuiPacket wiremodWireGuiPacket) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wiremodHandleSettings(WiremodSettingsPacket packet) {
|
||||
AbstractWireTileEntity wireEntity = (AbstractWireTileEntity) this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x, packet.y, packet.z);
|
||||
switch(packet.mode){
|
||||
case 0:
|
||||
wireEntity.outputs[0].floatvalue = packet.value;
|
||||
wireEntity.update();
|
||||
break;
|
||||
case 1:
|
||||
((ChipTileEntity)wireEntity).tickAmount = (int)packet.value;
|
||||
wireEntity.update();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.mixinInterfaces;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.packet.*;
|
||||
|
||||
public interface INetHandler {
|
||||
void wiremodHandleOpenProgrammerGUI(WiremodProgrammerGuiPacket packet);
|
||||
|
||||
void wiremodHandleProgramTile(WiremodProgrammerPacket wiremodProgrammerPacket);
|
||||
|
||||
void wiremodHandleOpenWiringGUI(WiremodWiringGuiPacket wiremodWiringGuiPacket);
|
||||
|
||||
void wiremodHandleIODisc(WiremodPacketSyncIO wiremodPacketSyncIO);
|
||||
|
||||
void wiremodHandleWireChips(WiremodWiringPacket wiremodWiringPacket);
|
||||
|
||||
void wiremodHandleWireToolSettingsGui(WiremodWireGuiPacket wiremodWireGuiPacket);
|
||||
|
||||
void wiremodHandleSettings(WiremodSettingsPacket wiremodSettingsPacket);
|
||||
}
|
@ -1,306 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.packet;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.api.WireConnection;
|
||||
import net.brokenmoon.afloydwiremod.gui.WiringButton;
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WiremodPacketSyncIO extends Packet {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
private int size;
|
||||
public WiringButton[] io;
|
||||
public WiringButton[] oi;
|
||||
public String mode;
|
||||
public int tickAmount;
|
||||
public WiremodPacketSyncIO(){
|
||||
this.isChunkDataPacket = true;
|
||||
}
|
||||
public WiremodPacketSyncIO(int xCoord, int yCoord, int zCoord, WiringButton[] inputs, WiringButton[] outputs) {
|
||||
this.isChunkDataPacket = true;
|
||||
this.x = xCoord;
|
||||
this.y = yCoord;
|
||||
this.z = zCoord;
|
||||
this.io = inputs;
|
||||
this.oi = outputs;
|
||||
}
|
||||
|
||||
public WiremodPacketSyncIO(int xCoord, int yCoord, int zCoord, WiringButton[] inputs, WiringButton[] outputs, String mode, int tickamount) {
|
||||
this.isChunkDataPacket = true;
|
||||
this.x = xCoord;
|
||||
this.y = yCoord;
|
||||
this.z = zCoord;
|
||||
this.io = inputs;
|
||||
this.oi = outputs;
|
||||
this.mode = mode;
|
||||
this.tickAmount = tickamount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPacketData(DataInputStream dataInputStream) throws IOException {
|
||||
this.x = dataInputStream.readInt();
|
||||
this.y = dataInputStream.readInt();
|
||||
this.z = dataInputStream.readInt();
|
||||
if(dataInputStream.readBoolean()){
|
||||
//INPUT
|
||||
int length = dataInputStream.readInt();
|
||||
io = new WiringButton[length];
|
||||
for(int i = 0; i < length; ++i){
|
||||
io[i] = new WiringButton();
|
||||
io[i].x = dataInputStream.readInt();
|
||||
io[i].y = dataInputStream.readInt();
|
||||
io[i].slot = dataInputStream.readInt();
|
||||
io[i].buttonString = dataInputStream.readUTF();
|
||||
io[i].floatvalue = dataInputStream.readFloat();
|
||||
io[i].stringvalue = dataInputStream.readUTF();
|
||||
if(dataInputStream.readBoolean()){
|
||||
this.io[i].wire = new WireConnection();
|
||||
this.io[i].wire.x = dataInputStream.readInt();
|
||||
this.io[i].wire.y = dataInputStream.readInt();
|
||||
this.io[i].wire.z = dataInputStream.readInt();
|
||||
this.io[i].wire.thisslot = dataInputStream.readInt();
|
||||
this.io[i].wire.thatslot = dataInputStream.readInt();
|
||||
this.io[i].wire.red = dataInputStream.readFloat();
|
||||
this.io[i].wire.green = dataInputStream.readFloat();
|
||||
this.io[i].wire.blue = dataInputStream.readFloat();
|
||||
this.io[i].wire.alpha = dataInputStream.readFloat();
|
||||
this.io[i].wire.width = dataInputStream.readFloat();
|
||||
this.io[i].wire.backwired = dataInputStream.readBoolean();
|
||||
this.io[i].wire.isMade = dataInputStream.readBoolean();
|
||||
if(dataInputStream.readBoolean()){
|
||||
int ixlength = dataInputStream.readInt();
|
||||
for(int ix = 0; ix < ixlength; ix++){
|
||||
this.io[i].wire.xadd.add(dataInputStream.readInt());
|
||||
this.io[i].wire.yadd.add(dataInputStream.readInt());
|
||||
this.io[i].wire.zadd.add(dataInputStream.readInt());
|
||||
this.io[i].wire.sideadd.add(dataInputStream.readInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dataInputStream.readBoolean()){
|
||||
int length = dataInputStream.readInt();
|
||||
oi = new WiringButton[length];
|
||||
for(int i = 0; i < length; ++i){
|
||||
oi[i] = new WiringButton();
|
||||
oi[i].x = dataInputStream.readInt();
|
||||
oi[i].y = dataInputStream.readInt();
|
||||
oi[i].slot = dataInputStream.readInt();
|
||||
oi[i].buttonString = dataInputStream.readUTF();
|
||||
oi[i].floatvalue = dataInputStream.readFloat();
|
||||
oi[i].stringvalue = dataInputStream.readUTF();
|
||||
if(dataInputStream.readBoolean()){
|
||||
this.oi[i].wire = new WireConnection();
|
||||
this.oi[i].wire.x = dataInputStream.readInt();
|
||||
this.oi[i].wire.y = dataInputStream.readInt();
|
||||
this.oi[i].wire.z = dataInputStream.readInt();
|
||||
this.oi[i].wire.thisslot = dataInputStream.readInt();
|
||||
this.oi[i].wire.thatslot = dataInputStream.readInt();
|
||||
this.oi[i].wire.red = dataInputStream.readFloat();
|
||||
this.oi[i].wire.green = dataInputStream.readFloat();
|
||||
this.oi[i].wire.blue = dataInputStream.readFloat();
|
||||
this.oi[i].wire.alpha = dataInputStream.readFloat();
|
||||
this.oi[i].wire.width = dataInputStream.readFloat();
|
||||
this.oi[i].wire.backwired = dataInputStream.readBoolean();
|
||||
this.oi[i].wire.isMade = dataInputStream.readBoolean();
|
||||
if(dataInputStream.readBoolean()){
|
||||
int ixlength = dataInputStream.readInt();
|
||||
for(int ix = 0; ix < ixlength; ix++){
|
||||
this.oi[i].wire.xadd.add(dataInputStream.readInt());
|
||||
this.oi[i].wire.yadd.add(dataInputStream.readInt());
|
||||
this.oi[i].wire.zadd.add(dataInputStream.readInt());
|
||||
this.oi[i].wire.sideadd.add(dataInputStream.readInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dataInputStream.readBoolean()){
|
||||
this.mode = dataInputStream.readUTF();
|
||||
}
|
||||
if(dataInputStream.readBoolean()){
|
||||
this.tickAmount = dataInputStream.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
|
||||
dataOutputStream.writeInt(x);
|
||||
dataOutputStream.writeInt(y);
|
||||
dataOutputStream.writeInt(z);
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
if(io != null){
|
||||
dataOutputStream.writeBoolean(true);
|
||||
size++;
|
||||
dataOutputStream.writeInt(io.length);
|
||||
size = size + 4;
|
||||
for(int i = 0; i < this.io.length; ++i){
|
||||
dataOutputStream.writeInt(this.io[i].x);
|
||||
size = size + 4;
|
||||
dataOutputStream.writeInt(this.io[i].y);
|
||||
size = size + 4;
|
||||
dataOutputStream.writeInt(this.io[i].slot);
|
||||
size = size + 4;
|
||||
dataOutputStream.writeUTF(this.io[i].buttonString);
|
||||
size = size + this.io[i].buttonString.length();
|
||||
dataOutputStream.writeFloat(this.io[i].floatvalue);
|
||||
size = size + 4;
|
||||
dataOutputStream.writeUTF(this.io[i].stringvalue);
|
||||
size = size + this.io[i].stringvalue.length();
|
||||
if(io[i].wire != null){
|
||||
dataOutputStream.writeBoolean(true);
|
||||
size++;
|
||||
dataOutputStream.writeInt(this.io[i].wire.x);
|
||||
dataOutputStream.writeInt(this.io[i].wire.y);
|
||||
dataOutputStream.writeInt(this.io[i].wire.z);
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
dataOutputStream.writeInt(this.io[i].wire.thisslot);
|
||||
dataOutputStream.writeInt(this.io[i].wire.thatslot);
|
||||
dataOutputStream.writeFloat(this.io[i].wire.red);
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
dataOutputStream.writeFloat(this.io[i].wire.green);
|
||||
dataOutputStream.writeFloat(this.io[i].wire.blue);
|
||||
dataOutputStream.writeFloat(this.io[i].wire.alpha);
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
dataOutputStream.writeFloat(this.io[i].wire.width);
|
||||
dataOutputStream.writeBoolean(this.io[i].wire.backwired);
|
||||
dataOutputStream.writeBoolean(this.io[i].wire.isMade);
|
||||
size = size + 4;
|
||||
size++;
|
||||
size++;
|
||||
if(this.io[i].wire.xadd != null){
|
||||
dataOutputStream.writeBoolean(true);
|
||||
size++;
|
||||
dataOutputStream.writeInt(this.io[i].wire.xadd.size());
|
||||
size = size + 4;
|
||||
for(int ix = 0; ix < this.io[i].wire.xadd.size(); ix++){
|
||||
dataOutputStream.writeInt(this.io[i].wire.xadd.get(ix));
|
||||
dataOutputStream.writeInt(this.io[i].wire.yadd.get(ix));
|
||||
dataOutputStream.writeInt(this.io[i].wire.zadd.get(ix));
|
||||
dataOutputStream.writeInt(this.io[i].wire.sideadd.get(ix));
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
}
|
||||
} else {
|
||||
dataOutputStream.writeBoolean(false);
|
||||
size++;
|
||||
}
|
||||
} else{
|
||||
dataOutputStream.writeBoolean(false);
|
||||
size++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dataOutputStream.writeBoolean(false);
|
||||
size++;
|
||||
}
|
||||
if(oi != null){
|
||||
dataOutputStream.writeBoolean(true);
|
||||
size++;
|
||||
dataOutputStream.writeInt(oi.length);
|
||||
size = size + 4;
|
||||
for(int i = 0; i < this.oi.length; ++i){
|
||||
dataOutputStream.writeInt(this.oi[i].x);
|
||||
size = size + 4;
|
||||
dataOutputStream.writeInt(this.oi[i].y);
|
||||
size = size + 4;
|
||||
dataOutputStream.writeInt(this.oi[i].slot);
|
||||
size = size + 4;
|
||||
dataOutputStream.writeUTF(this.oi[i].buttonString);
|
||||
size = size + this.oi[i].buttonString.length();
|
||||
dataOutputStream.writeFloat(this.oi[i].floatvalue);
|
||||
size = size + 4;
|
||||
dataOutputStream.writeUTF(this.oi[i].stringvalue);
|
||||
size = size + this.oi[i].stringvalue.length();
|
||||
if(oi[i].wire != null){
|
||||
dataOutputStream.writeBoolean(true);
|
||||
size++;
|
||||
dataOutputStream.writeInt(this.oi[i].wire.x);
|
||||
dataOutputStream.writeInt(this.oi[i].wire.y);
|
||||
dataOutputStream.writeInt(this.oi[i].wire.z);
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
dataOutputStream.writeInt(this.oi[i].wire.thisslot);
|
||||
dataOutputStream.writeInt(this.oi[i].wire.thatslot);
|
||||
dataOutputStream.writeFloat(this.oi[i].wire.red);
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
dataOutputStream.writeFloat(this.oi[i].wire.green);
|
||||
dataOutputStream.writeFloat(this.oi[i].wire.blue);
|
||||
dataOutputStream.writeFloat(this.oi[i].wire.alpha);
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
dataOutputStream.writeFloat(this.oi[i].wire.width);
|
||||
dataOutputStream.writeBoolean(this.oi[i].wire.backwired);
|
||||
dataOutputStream.writeBoolean(this.oi[i].wire.isMade);
|
||||
size = size + 4;
|
||||
size++;
|
||||
size++;
|
||||
if(this.oi[i].wire.xadd != null){
|
||||
dataOutputStream.writeBoolean(true);
|
||||
size++;
|
||||
dataOutputStream.writeInt(this.oi[i].wire.xadd.size());
|
||||
size = size + 4;
|
||||
for(int ix = 0; ix < this.oi[i].wire.xadd.size(); ix++){
|
||||
dataOutputStream.writeInt(this.oi[i].wire.xadd.get(ix));
|
||||
dataOutputStream.writeInt(this.oi[i].wire.yadd.get(ix));
|
||||
dataOutputStream.writeInt(this.oi[i].wire.zadd.get(ix));
|
||||
dataOutputStream.writeInt(this.oi[i].wire.sideadd.get(ix));
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
size = size + 4;
|
||||
}
|
||||
} else {
|
||||
dataOutputStream.writeBoolean(false);
|
||||
size++;
|
||||
}
|
||||
} else{
|
||||
dataOutputStream.writeBoolean(false);
|
||||
size++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dataOutputStream.writeBoolean(false);
|
||||
size++;
|
||||
}
|
||||
dataOutputStream.writeBoolean(this.mode != null);
|
||||
if(this.mode != null){
|
||||
dataOutputStream.writeUTF(mode);
|
||||
}
|
||||
dataOutputStream.writeBoolean(this.tickAmount != 0);
|
||||
if(this.tickAmount != 0){
|
||||
dataOutputStream.writeInt(tickAmount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPacket(NetHandler netHandler) {
|
||||
((INetHandler)netHandler).wiremodHandleIODisc(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketSize() {
|
||||
return size;
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.packet;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WiremodProgrammerGuiPacket extends Packet {
|
||||
public int mode;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public WiremodProgrammerGuiPacket(){
|
||||
|
||||
}
|
||||
|
||||
public WiremodProgrammerGuiPacket(int i, int x, int y, int z){
|
||||
this.mode = i;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPacketData(DataInputStream dataInputStream) throws IOException {
|
||||
this.mode = dataInputStream.readInt();
|
||||
this.x = dataInputStream.readInt();
|
||||
this.y = dataInputStream.readInt();
|
||||
this.z = dataInputStream.readInt();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
|
||||
dataOutputStream.writeInt(this.mode);
|
||||
dataOutputStream.writeInt(this.x);
|
||||
dataOutputStream.writeInt(this.y);
|
||||
dataOutputStream.writeInt(this.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPacket(NetHandler netHandler) {
|
||||
((INetHandler)netHandler).wiremodHandleOpenProgrammerGUI(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketSize() {
|
||||
return 4 * 4;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.packet;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WiremodProgrammerPacket extends Packet {
|
||||
public WiremodProgrammerPacket(){
|
||||
|
||||
}
|
||||
public String mode;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public WiremodProgrammerPacket(String mode, int x, int y, int z){
|
||||
this.mode = mode;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
@Override
|
||||
public void readPacketData(DataInputStream dataInputStream) throws IOException {
|
||||
this.mode = dataInputStream.readUTF();
|
||||
this.x = dataInputStream.readInt();
|
||||
this.y = dataInputStream.readInt();
|
||||
this.z = dataInputStream.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
|
||||
dataOutputStream.writeUTF(mode);
|
||||
dataOutputStream.writeInt(this.x);
|
||||
dataOutputStream.writeInt(this.y);
|
||||
dataOutputStream.writeInt(this.z);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPacket(NetHandler netHandler) {
|
||||
((INetHandler)netHandler).wiremodHandleProgramTile(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketSize() {
|
||||
return (4 * 3) + this.mode.length();
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.packet;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WiremodSettingsPacket extends Packet {
|
||||
public int mode;
|
||||
public float value;
|
||||
public int size;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public WiremodSettingsPacket(){
|
||||
|
||||
}
|
||||
|
||||
//Settings which changes one variable
|
||||
public WiremodSettingsPacket(int mode, float amount, int x, int y, int z) {
|
||||
this.mode = mode;
|
||||
this.value = amount;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPacketData(DataInputStream dataInputStream) throws IOException {
|
||||
this.mode = dataInputStream.readInt();
|
||||
this.x = dataInputStream.readInt();
|
||||
this.y = dataInputStream.readInt();
|
||||
this.z = dataInputStream.readInt();
|
||||
if(mode == 0 || mode == 1){
|
||||
this.value = dataInputStream.readFloat();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
|
||||
dataOutputStream.writeInt(mode);
|
||||
dataOutputStream.writeInt(x);
|
||||
dataOutputStream.writeInt(y);
|
||||
dataOutputStream.writeInt(z);
|
||||
if(mode == 0 || mode == 1){
|
||||
dataOutputStream.writeFloat(value);
|
||||
size += 4;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPacket(NetHandler netHandler) {
|
||||
((INetHandler)netHandler).wiremodHandleSettings(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketSize() {
|
||||
return 16 + size;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.packet;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WiremodWireGuiPacket extends Packet {
|
||||
@Override
|
||||
public void readPacketData(DataInputStream dataInputStream) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPacket(NetHandler netHandler) {
|
||||
((INetHandler)netHandler).wiremodHandleWireToolSettingsGui(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketSize() {
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.packet;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WiremodWiringGuiPacket extends Packet {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public int x2;
|
||||
public int y2;
|
||||
public int z2;
|
||||
public WiremodWiringGuiPacket(){
|
||||
|
||||
}
|
||||
public WiremodWiringGuiPacket(int x, int y, int z, int x2, int y2, int z2){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.z2 = z2;
|
||||
}
|
||||
@Override
|
||||
public void readPacketData(DataInputStream dataInputStream) throws IOException {
|
||||
this.x = dataInputStream.readInt();
|
||||
this.y = dataInputStream.readInt();
|
||||
this.z = dataInputStream.readInt();
|
||||
this.x2 = dataInputStream.readInt();
|
||||
this.y2 = dataInputStream.readInt();
|
||||
this.z2 = dataInputStream.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
|
||||
dataOutputStream.writeInt(this.x);
|
||||
dataOutputStream.writeInt(this.y);
|
||||
dataOutputStream.writeInt(this.z);
|
||||
dataOutputStream.writeInt(this.x2);
|
||||
dataOutputStream.writeInt(this.y2);
|
||||
dataOutputStream.writeInt(this.z2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPacket(NetHandler netHandler) {
|
||||
((INetHandler)netHandler).wiremodHandleOpenWiringGUI(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketSize() {
|
||||
return 6 * 4;
|
||||
}
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.packet;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WiremodWiringPacket extends Packet {
|
||||
public int type;
|
||||
public int x1;
|
||||
public int y1;
|
||||
public int z1;
|
||||
public int x2;
|
||||
public int y2;
|
||||
public int z2;
|
||||
public int slot1;
|
||||
public int slot2;
|
||||
public ArrayList<Integer> xadd;
|
||||
public ArrayList<Integer> yadd;
|
||||
public ArrayList<Integer> zadd;
|
||||
public ArrayList<Integer> sideadd;
|
||||
public boolean backwired;
|
||||
public float red = 1.0f;
|
||||
public float green = 0f;
|
||||
public float blue = 0f;
|
||||
public float alpha = 1f;
|
||||
public float width = 0.5f;
|
||||
private int size = 0;
|
||||
public WiremodWiringPacket(){
|
||||
}
|
||||
public WiremodWiringPacket(int x1, int y1, int z1, int x2, int y2, int z2, int slot1, int slot2, ArrayList<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> sideadd, boolean b, float red, float green, float blue, float alpha, float width) {
|
||||
this.type = 0;
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
this.z1 = z1;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.z2 = z2;
|
||||
this.slot1 = slot1;
|
||||
this.slot2 = slot2;
|
||||
this.xadd = xadd;
|
||||
this.yadd = yadd;
|
||||
this.zadd = zadd;
|
||||
this.sideadd = sideadd;
|
||||
this.backwired = b;
|
||||
this.red = red;
|
||||
this.blue = blue;
|
||||
this.green = green;
|
||||
this.alpha = alpha;
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public WiremodWiringPacket(int x1, int y1, int z1, int x2, int y2, int z2, int slot1, int slot2) {
|
||||
this.type = 1;
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
this.z1 = z1;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.z2 = z2;
|
||||
this.slot1 = slot1;
|
||||
this.slot2 = slot2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readPacketData(DataInputStream dataInputStream) throws IOException {
|
||||
this.type = dataInputStream.readInt();
|
||||
this.x1 = dataInputStream.readInt();
|
||||
this.y1 = dataInputStream.readInt();
|
||||
this.z1 = dataInputStream.readInt();
|
||||
this.x2 = dataInputStream.readInt();
|
||||
this.y2 = dataInputStream.readInt();
|
||||
this.z2 = dataInputStream.readInt();
|
||||
this.slot1 = dataInputStream.readInt();
|
||||
this.slot2 = dataInputStream.readInt();
|
||||
backwired = dataInputStream.readBoolean();
|
||||
red = dataInputStream.readFloat();
|
||||
green = dataInputStream.readFloat();
|
||||
blue = dataInputStream.readFloat();
|
||||
alpha = dataInputStream.readFloat();
|
||||
width = dataInputStream.readFloat();
|
||||
boolean isxadd = dataInputStream.readBoolean();
|
||||
xadd = new ArrayList<>();
|
||||
yadd = new ArrayList<>();
|
||||
zadd = new ArrayList<>();
|
||||
sideadd = new ArrayList<>();
|
||||
if(isxadd){
|
||||
int length = dataInputStream.readInt();
|
||||
for(int i = 0; i < length; i++) {
|
||||
xadd.add(dataInputStream.readInt());
|
||||
yadd.add(dataInputStream.readInt());
|
||||
zadd.add(dataInputStream.readInt());
|
||||
sideadd.add(dataInputStream.readInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
|
||||
dataOutputStream.writeInt(type);
|
||||
dataOutputStream.writeInt(x1);
|
||||
dataOutputStream.writeInt(y1);
|
||||
dataOutputStream.writeInt(z1);
|
||||
dataOutputStream.writeInt(x2);
|
||||
dataOutputStream.writeInt(y2);
|
||||
dataOutputStream.writeInt(z2);
|
||||
dataOutputStream.writeInt(slot1);
|
||||
dataOutputStream.writeInt(slot2);
|
||||
dataOutputStream.writeBoolean(backwired);
|
||||
dataOutputStream.writeFloat(red);
|
||||
dataOutputStream.writeFloat(green);
|
||||
dataOutputStream.writeFloat(blue);
|
||||
dataOutputStream.writeFloat(alpha);
|
||||
dataOutputStream.writeFloat(width);
|
||||
dataOutputStream.writeBoolean(xadd != null);
|
||||
if(xadd != null){
|
||||
dataOutputStream.writeInt(xadd.size());
|
||||
size = 4;
|
||||
for(int i = 0; i < xadd.size(); i++){
|
||||
dataOutputStream.writeInt(xadd.get(i));
|
||||
size += 4;
|
||||
dataOutputStream.writeInt(yadd.get(i));
|
||||
size += 4;
|
||||
dataOutputStream.writeInt(zadd.get(i));
|
||||
size += 4;
|
||||
dataOutputStream.writeInt(sideadd.get(i));
|
||||
size += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPacket(NetHandler netHandler) {
|
||||
((INetHandler)netHandler).wiremodHandleWireChips(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketSize() {
|
||||
return 14 * 4 + 2 + size;
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.ter;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
|
||||
import net.brokenmoon.afloydwiremod.api.AbstractWireTileSided;
|
||||
import net.brokenmoon.afloydwiremod.tileentity.DisplayTileEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.FontRenderer;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class TERDisplay extends TileEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d, double e, double f, float g) {
|
||||
this.renderDisplay((DisplayTileEntity)tileEntity, d, e, f, g);
|
||||
}
|
||||
|
||||
private void renderDisplay(DisplayTileEntity tileEntity, double d, double e, double f, float g) {
|
||||
if(tileEntity.inputs != null){
|
||||
for(int it = 0; it < tileEntity.inputs.length; it++){
|
||||
if(tileEntity.inputs[it] != null && tileEntity.isLineReversed != null){
|
||||
this.renderTextLine(d, e, f, it, tileEntity.inputs[it].floatvalue, tileEntity.inputs[it].stringvalue, tileEntity.isLineReversed[it], Minecraft.getMinecraft().theWorld.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTextLine(double d, double d1, double d2, int line, float floatvalue, String stringvalue, boolean reversed, int meta) {
|
||||
String strToRender;
|
||||
if(reversed) {
|
||||
strToRender = floatvalue + stringvalue;
|
||||
}else{
|
||||
strToRender = stringvalue + floatvalue;
|
||||
}
|
||||
FontRenderer fontRenderer = this.getFontRenderer();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)d, (float)d1, (float)d2);
|
||||
float yoff = 0.151f;
|
||||
switch(meta) {
|
||||
case 5:
|
||||
GL11.glTranslatef(0.5f, yoff, 0.53f);
|
||||
GL11.glRotatef(-90f, 1, 0, 0);
|
||||
break;
|
||||
case 0:
|
||||
GL11.glTranslatef(0.5f, 1 - yoff, 0.47f);
|
||||
GL11.glRotatef(90f, 1, 0, 0);
|
||||
break;
|
||||
case 4:
|
||||
GL11.glTranslatef(0.5f, 0.47f, 1 - yoff);
|
||||
GL11.glRotatef(180f, 0, 1, 0);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslatef(0.5f, 0.47f, yoff);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(90f, 0, 1, 0);
|
||||
GL11.glTranslatef(-0.5f, 0.47f, yoff);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glRotatef(-90f, 0, 1, 0);
|
||||
GL11.glTranslatef(0.5f, 0.47f, - 1 + yoff);
|
||||
break;
|
||||
}
|
||||
GL11.glScalef(0.02f, -0.02f, 0.02f);
|
||||
fontRenderer.drawString(strToRender, -fontRenderer.getStringWidth(strToRender) / 2, line * 10 - 4 * 5, 0xFFFFFF);
|
||||
fontRenderer.drawString(strToRender, -fontRenderer.getStringWidth(strToRender) / 2, line * 10 - 4 * 5, 0xFFFFFF);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.tile;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.api.AbstractWireTileSided;
|
||||
import net.brokenmoon.afloydwiremod.tileentity.DisplayTileEntity;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.TileEntity;
|
||||
|
||||
public class DisplayTile extends AbstractWireTileSided {
|
||||
public DisplayTile(int i, Material material) {
|
||||
super(i, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TileEntity getBlockEntity() {
|
||||
return new DisplayTileEntity();
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package net.brokenmoon.afloydwiremod.tileentity;
|
||||
|
||||
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
|
||||
import net.brokenmoon.afloydwiremod.gui.WiringButton;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
|
||||
public class DisplayTileEntity extends AbstractWireTileEntity {
|
||||
public boolean[] isLineReversed = new boolean[4];
|
||||
public DisplayTileEntity(){
|
||||
super();
|
||||
inputs = new WiringButton[4];
|
||||
inputs[0] = new WiringButton(214, 220, "Line 1", 0);
|
||||
inputs[1] = new WiringButton(214, 220, "Line 2", 1);
|
||||
inputs[2] = new WiringButton(214, 220, "Line 3", 2);
|
||||
inputs[3] = new WiringButton(214, 220, "Line 4", 3);
|
||||
outputs = new WiringButton[0];
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
for(int i = 0; i < isLineReversed.length; i++){
|
||||
isLineReversed[i] = nbttagcompound.getBoolean("reverse" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
for(int i = 0; i < isLineReversed.length; i++){
|
||||
nbttagcompound.setBoolean("reverse" + i, isLineReversed[i]);
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 312 B |
@ -1,26 +0,0 @@
|
||||
[ids]
|
||||
|
||||
[ids.tile]
|
||||
chipTile = 905
|
||||
linkTileInactive = 906
|
||||
linkTileActive = 907
|
||||
displayTile = 908
|
||||
|
||||
[ids.item]
|
||||
programmingTool = 909
|
||||
wiringTool = 910
|
||||
redSilica = 911
|
||||
chipDie = 912
|
||||
chipDieOvercooked = 913
|
||||
|
||||
[ids.packet]
|
||||
programming = 109
|
||||
programmerGui = 110
|
||||
wiring = 111
|
||||
wiringGui = 112
|
||||
wiringSettingsGui = 113
|
||||
sync = 114
|
||||
chipSettingsGui = 115
|
||||
|
||||
[misc]
|
||||
scrollrate = 5
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 637 B |
Binary file not shown.
Before Width: | Height: | Size: 297 B |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 276 B |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 288 B |
Loading…
Reference in New Issue