Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor packets #3295

Merged
merged 5 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/main/java/bartworks/MainMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import bartworks.common.loaders.RegisterGlassTiers;
import bartworks.common.loaders.RegisterServerCommands;
import bartworks.common.loaders.StaticRecipeChangeLoaders;
import bartworks.common.net.BWNetwork;
import bartworks.server.EventHandler.ServerEventHandler;
import bartworks.system.material.CircuitGeneration.CircuitImprintLoader;
import bartworks.system.material.CircuitGeneration.CircuitPartLoader;
Expand Down Expand Up @@ -106,8 +105,6 @@ public final class MainMod {
@Mod.Instance(MainMod.MOD_ID)
public static MainMod instance;

public static BWNetwork BW_Network_instance = new BWNetwork();

public MainMod() {

}
Expand Down
170 changes: 0 additions & 170 deletions src/main/java/bartworks/common/net/BWNetwork.java

This file was deleted.

88 changes: 0 additions & 88 deletions src/main/java/bartworks/common/net/CircuitProgrammerPacket.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@
import bartworks.MainMod;
import bartworks.system.material.TileEntityMetaGeneratedBlock;
import bartworks.util.MurmurHash3;
import gregtech.api.net.GTPacketNew;
import gregtech.api.net.GTPacket;
import io.netty.buffer.ByteBuf;

public class MetaBlockPacket extends GTPacketNew {
public class PacketBWMetaBlock extends GTPacket {

int x;
short y;
int z;
short meta;

public MetaBlockPacket(int x, int y, int z, int meta) {
super(false);
public PacketBWMetaBlock(int x, int y, int z, int meta) {
super();
this.x = x;
this.y = (short) y;
this.z = z;
this.meta = (short) meta;
}

public MetaBlockPacket() {
super(true);
public PacketBWMetaBlock() {
super();
}

@Override
public byte getPacketID() {
return 2;
return 24;
}

@Override
Expand All @@ -71,12 +71,12 @@ public void encode(ByteBuf aOut) {
}

@Override
public GTPacketNew decode(ByteArrayDataInput byteArrayDataInput) {
public GTPacket decode(ByteArrayDataInput byteArrayDataInput) {
this.x = byteArrayDataInput.readInt();
this.z = byteArrayDataInput.readInt();
this.y = byteArrayDataInput.readShort();
this.meta = byteArrayDataInput.readShort();
MetaBlockPacket todecode = new MetaBlockPacket(this.x, this.y, this.z, this.meta);
PacketBWMetaBlock todecode = new PacketBWMetaBlock(this.x, this.y, this.z, this.meta);
if (byteArrayDataInput.readInt() != MurmurHash3.murmurhash3_x86_32(
ByteBuffer.allocate(12)
.putInt(this.x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@
import bartworks.common.tileentities.multis.MTEBioVat;
import bartworks.util.BWColorUtil;
import bartworks.util.Coords;
import gregtech.api.net.GTPacketNew;
import gregtech.api.net.GTPacket;
import io.netty.buffer.ByteBuf;

public class RendererPacket extends GTPacketNew {
public class PacketBioVatRenderer extends GTPacket {

private Coords coords;
private int integer;
private byte removal;

public RendererPacket() {
super(true);
public PacketBioVatRenderer() {
super();
}

public RendererPacket(Coords coords, int integer, boolean removal) {
super(false);
public PacketBioVatRenderer(Coords coords, int integer, boolean removal) {
super();
this.coords = coords;
this.integer = integer;
this.removal = (byte) (removal ? 1 : 0);
}

@Override
public byte getPacketID() {
return 0;
return 23;
}

@Override
Expand All @@ -69,7 +69,7 @@ public void encode(ByteBuf aOut) {
}

@Override
public GTPacketNew decode(ByteArrayDataInput dataInput) {
public GTPacket decode(ByteArrayDataInput dataInput) {
this.coords = new Coords(dataInput.readInt(), dataInput.readShort(), dataInput.readInt(), dataInput.readInt());
this.integer = BWColorUtil
.getColorFromRGBArray(new int[] { dataInput.readByte(), dataInput.readByte(), dataInput.readByte() });
Expand All @@ -86,7 +86,7 @@ public GTPacketNew decode(ByteArrayDataInput dataInput) {
return null;
}

return new RendererPacket(this.coords, this.integer, this.removal == 1);
return new PacketBioVatRenderer(this.coords, this.integer, this.removal == 1);
}

@Override
Expand Down
Loading