Move sendToServer to ClientNetworkManager to finalise the client/server split :)

This commit is contained in:
modmuss50 2022-08-03 19:57:40 +01:00
parent 3313f3165f
commit 88d448c3a5
16 changed files with 34 additions and 35 deletions

View file

@ -32,7 +32,6 @@ import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.common.chunkloading.ChunkLoaderManager; import reborncore.common.chunkloading.ChunkLoaderManager;
import reborncore.common.network.NetworkManager;
import reborncore.common.network.ServerBoundPackets; import reborncore.common.network.ServerBoundPackets;
import java.util.ArrayList; import java.util.ArrayList;
@ -50,7 +49,7 @@ public class ClientChunkManager {
public static void toggleLoadedChunks(BlockPos chunkLoader) { public static void toggleLoadedChunks(BlockPos chunkLoader) {
if (loadedChunks.size() == 0) { if (loadedChunks.size() == 0) {
NetworkManager.sendToServer(ServerBoundPackets.requestChunkLoaderChunks(chunkLoader)); ClientNetworkManager.sendToServer(ServerBoundPackets.requestChunkLoaderChunks(chunkLoader));
} else { } else {
loadedChunks.clear(); loadedChunks.clear();
} }

View file

@ -30,6 +30,7 @@ import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.common.network.ExtendedPacketBuffer; import reborncore.common.network.ExtendedPacketBuffer;
import reborncore.common.network.IdentifiedPacket;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -45,4 +46,8 @@ public class ClientNetworkManager {
client.execute(() -> consumer.accept(value)); client.execute(() -> consumer.accept(value));
}); });
} }
public static void sendToServer(IdentifiedPacket packet) {
ClientPlayNetworking.send(packet.channel(), packet.packetByteBuf());
}
} }

View file

@ -27,11 +27,11 @@ package reborncore.client.gui.builder;
import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.ClientNetworkManager;
import reborncore.client.RenderUtil; import reborncore.client.RenderUtil;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.blockentity.RedstoneConfiguration; import reborncore.common.blockentity.RedstoneConfiguration;
import reborncore.common.network.IdentifiedPacket; import reborncore.common.network.IdentifiedPacket;
import reborncore.common.network.NetworkManager;
import reborncore.common.network.ServerBoundPackets; import reborncore.common.network.ServerBoundPackets;
import java.util.Locale; import java.util.Locale;
@ -84,7 +84,7 @@ public class RedstoneConfigGui {
} }
RedstoneConfiguration.State nextState = RedstoneConfiguration.State.values()[ns]; RedstoneConfiguration.State nextState = RedstoneConfiguration.State.values()[ns];
IdentifiedPacket packet = ServerBoundPackets.createPacketSetRedstoneSate(guiBase.getMachine().getPos(), element, nextState); IdentifiedPacket packet = ServerBoundPackets.createPacketSetRedstoneSate(guiBase.getMachine().getPos(), element, nextState);
NetworkManager.sendToServer(packet); ClientNetworkManager.sendToServer(packet);
return true; return true;
} }
i++; i++;

View file

@ -32,13 +32,13 @@ import net.minecraft.screen.slot.Slot;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import reborncore.client.ClientChatUtils; import reborncore.client.ClientChatUtils;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.GuiUtil; import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.elements.ConfigSlotElement; import reborncore.client.gui.builder.slot.elements.ConfigSlotElement;
import reborncore.client.gui.builder.slot.elements.ElementBase; import reborncore.client.gui.builder.slot.elements.ElementBase;
import reborncore.client.gui.builder.slot.elements.SlotType; import reborncore.client.gui.builder.slot.elements.SlotType;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.network.NetworkManager;
import reborncore.common.network.ServerBoundPackets; import reborncore.common.network.ServerBoundPackets;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.util.Color; import reborncore.common.util.Color;
@ -119,7 +119,7 @@ public class SlotConfigGui {
String json = MinecraftClient.getInstance().keyboard.getClipboard(); String json = MinecraftClient.getInstance().keyboard.getClipboard();
try { try {
machine.getSlotConfiguration().readJson(json, machine.getClass().getCanonicalName()); machine.getSlotConfiguration().readJson(json, machine.getClass().getCanonicalName());
NetworkManager.sendToServer(ServerBoundPackets.createPacketConfigSave(machine.getPos(), machine.getSlotConfiguration())); ClientNetworkManager.sendToServer(ServerBoundPackets.createPacketConfigSave(machine.getPos(), machine.getSlotConfiguration()));
ClientChatUtils.addHudMessage(Text.literal("Slot configuration loaded from clipboard")); ClientChatUtils.addHudMessage(Text.literal("Slot configuration loaded from clipboard"));
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
ClientChatUtils.addHudMessage(Text.literal(e.getMessage())); ClientChatUtils.addHudMessage(Text.literal(e.getMessage()));

View file

@ -41,12 +41,12 @@ import net.minecraft.util.math.Quaternion;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.Vec3f;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.RebornCore; import reborncore.RebornCore;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.GuiUtil; import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.blockentity.FluidConfiguration; import reborncore.common.blockentity.FluidConfiguration;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.network.IdentifiedPacket; import reborncore.common.network.IdentifiedPacket;
import reborncore.common.network.NetworkManager;
import reborncore.common.network.ServerBoundPackets; import reborncore.common.network.ServerBoundPackets;
import reborncore.common.util.Color; import reborncore.common.util.Color;
import reborncore.common.util.MachineFacing; import reborncore.common.util.MachineFacing;
@ -117,7 +117,7 @@ public class FluidConfigPopupElement extends ElementBase {
FluidConfiguration.FluidConfig newConfig = new FluidConfiguration.FluidConfig(side, fluidIO); FluidConfiguration.FluidConfig newConfig = new FluidConfiguration.FluidConfig(side, fluidIO);
IdentifiedPacket packetSave = ServerBoundPackets.createPacketFluidConfigSave(guiBase.be.getPos(), newConfig); IdentifiedPacket packetSave = ServerBoundPackets.createPacketFluidConfigSave(guiBase.be.getPos(), newConfig);
NetworkManager.sendToServer(packetSave); ClientNetworkManager.sendToServer(packetSave);
} }
public void updateCheckBox(CheckBoxElement checkBoxElement, String type, GuiBase<?> guiBase) { public void updateCheckBox(CheckBoxElement checkBoxElement, String type, GuiBase<?> guiBase) {
@ -132,7 +132,7 @@ public class FluidConfigPopupElement extends ElementBase {
} }
IdentifiedPacket packetFluidIOSave = ServerBoundPackets.createPacketFluidIOSave(guiBase.be.getPos(), input, output); IdentifiedPacket packetFluidIOSave = ServerBoundPackets.createPacketFluidIOSave(guiBase.be.getPos(), input, output);
NetworkManager.sendToServer(packetFluidIOSave); ClientNetworkManager.sendToServer(packetFluidIOSave);
} }
@Override @Override

View file

@ -41,12 +41,12 @@ import net.minecraft.util.math.Quaternion;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.Vec3f;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.RebornCore; import reborncore.RebornCore;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.GuiUtil; import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blockentity.SlotConfiguration; import reborncore.common.blockentity.SlotConfiguration;
import reborncore.common.network.IdentifiedPacket; import reborncore.common.network.IdentifiedPacket;
import reborncore.common.network.NetworkManager;
import reborncore.common.network.ServerBoundPackets; import reborncore.common.network.ServerBoundPackets;
import reborncore.common.util.Color; import reborncore.common.util.Color;
import reborncore.common.util.MachineFacing; import reborncore.common.util.MachineFacing;
@ -126,7 +126,7 @@ public class SlotConfigPopupElement extends ElementBase {
SlotConfiguration.SlotIO slotIO = new SlotConfiguration.SlotIO(nextConfig); SlotConfiguration.SlotIO slotIO = new SlotConfiguration.SlotIO(nextConfig);
SlotConfiguration.SlotConfig newConfig = new SlotConfiguration.SlotConfig(side, slotIO, id); SlotConfiguration.SlotConfig newConfig = new SlotConfiguration.SlotConfig(side, slotIO, id);
IdentifiedPacket packetSlotSave = ServerBoundPackets.createPacketSlotSave(guiBase.be.getPos(), newConfig); IdentifiedPacket packetSlotSave = ServerBoundPackets.createPacketSlotSave(guiBase.be.getPos(), newConfig);
NetworkManager.sendToServer(packetSlotSave); ClientNetworkManager.sendToServer(packetSlotSave);
} }
public void updateCheckBox(CheckBoxElement checkBoxElement, String type, GuiBase<?> guiBase) { public void updateCheckBox(CheckBoxElement checkBoxElement, String type, GuiBase<?> guiBase) {
@ -145,7 +145,7 @@ public class SlotConfigPopupElement extends ElementBase {
} }
IdentifiedPacket packetSlotSave = ServerBoundPackets.createPacketIOSave(guiBase.be.getPos(), id, input, output, filter); IdentifiedPacket packetSlotSave = ServerBoundPackets.createPacketIOSave(guiBase.be.getPos(), id, input, output, filter);
NetworkManager.sendToServer(packetSlotSave); ClientNetworkManager.sendToServer(packetSlotSave);
} }
private void drawSlotSateColor(MatrixStack matrices, MachineBaseBlockEntity machineBase, Direction side, int slotID, int inx, int iny, GuiBase<?> gui) { private void drawSlotSateColor(MatrixStack matrices, MachineBaseBlockEntity machineBase, Direction side, int slotID, int inx, int iny, GuiBase<?> gui) {

View file

@ -25,7 +25,6 @@
package reborncore.common.network; package reborncore.common.network;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.PacketSender; import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.PlayerLookup; import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
@ -65,10 +64,6 @@ public class NetworkManager {
return createClientBoundPacket(identifier, extendedPacketBuffer -> extendedPacketBuffer.writeCodec(codec, value)); return createClientBoundPacket(identifier, extendedPacketBuffer -> extendedPacketBuffer.writeCodec(codec, value));
} }
public static void sendToServer(IdentifiedPacket packet) {
ClientPlayNetworking.send(packet.channel(), packet.packetByteBuf());
}
public static void sendToAll(IdentifiedPacket packet, MinecraftServer server) { public static void sendToAll(IdentifiedPacket packet, MinecraftServer server) {
send(packet, PlayerLookup.all(server)); send(packet, PlayerLookup.all(server));
} }

View file

@ -27,10 +27,10 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType; import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
import reborncore.common.network.NetworkManager;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity; import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity;
@ -87,6 +87,6 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
} }
public void onClick(int amount) { public void onClick(int amount) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(amount, hasShiftDown(), hasControlDown(), blockEntity)); ClientNetworkManager.sendToServer(ServerboundPackets.createPacketAesu(amount, hasShiftDown(), hasControlDown(), blockEntity));
} }
} }

View file

@ -30,9 +30,9 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.CraftingRecipe;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.network.NetworkManager;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import techreborn.blockentity.machine.tier1.AutoCraftingTableBlockEntity; import techreborn.blockentity.machine.tier1.AutoCraftingTableBlockEntity;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -88,7 +88,7 @@ public class GuiAutoCrafting extends GuiBase<BuiltScreenHandler> {
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (isPointInRect(145, 4, 20, 12, mouseX, mouseY)) { if (isPointInRect(145, 4, 20, 12, mouseX, mouseY)) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAutoCraftingTableLock(blockEntityAutoCraftingTable, !blockEntityAutoCraftingTable.locked)); ClientNetworkManager.sendToServer(ServerboundPackets.createPacketAutoCraftingTableLock(blockEntityAutoCraftingTable, !blockEntityAutoCraftingTable.locked));
return true; return true;
} }
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);

View file

@ -29,10 +29,10 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.ClientChunkManager; import reborncore.client.ClientChunkManager;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType; import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
import reborncore.common.network.NetworkManager;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity; import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -69,6 +69,6 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
} }
public void onClick(int amount) { public void onClick(int amount) {
NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity, ClientChunkManager.hasChunksForLoader(blockEntity.getPos()))); ClientNetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity, ClientChunkManager.hasChunksForLoader(blockEntity.getPos())));
} }
} }

View file

@ -29,12 +29,12 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended; import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType; import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.network.NetworkManager;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.util.Color; import reborncore.common.util.Color;
@ -123,7 +123,7 @@ public class GuiFusionReactor extends GuiBase<BuiltScreenHandler> {
} }
private void sendSizeChange(int sizeDelta) { private void sendSizeChange(int sizeDelta) {
NetworkManager.sendToServer(ServerboundPackets.createPacketFusionControlSize(sizeDelta, blockEntity.getPos())); ClientNetworkManager.sendToServer(ServerboundPackets.createPacketFusionControlSize(sizeDelta, blockEntity.getPos()));
} }
public Optional<Pair<Integer, Integer>> getCoilStackCount() { public Optional<Pair<Integer, Integer>> getCoilStackCount() {

View file

@ -31,9 +31,9 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.network.NetworkManager;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity; import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -51,7 +51,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
} }
public void onClick() { public void onClick() {
NetworkManager.sendToServer(ServerboundPackets.createPacketExperience(blockEntity)); ClientNetworkManager.sendToServer(ServerboundPackets.createPacketExperience(blockEntity));
} }
@Override @Override

View file

@ -31,8 +31,8 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.widget.GuiButtonExtended; import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.common.network.NetworkManager;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -70,7 +70,7 @@ public class GuiManual extends Screen {
if (TechRebornConfig.allowManualRefund) { if (TechRebornConfig.allowManualRefund) {
addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 140, 60, 20, Text.translatable("techreborn.manual.refundbtn"), var1 -> { addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 140, 60, 20, Text.translatable("techreborn.manual.refundbtn"), var1 -> {
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket()); ClientNetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
this.client.setScreen(null); this.client.setScreen(null);
})); }));
} }

View file

@ -27,9 +27,9 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
import reborncore.common.network.NetworkManager;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import techreborn.blockentity.machine.tier1.PlayerDetectorBlockEntity; import techreborn.blockentity.machine.tier1.PlayerDetectorBlockEntity;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -44,7 +44,7 @@ public class GuiPlayerDetector extends GuiBase<BuiltScreenHandler> {
} }
private void onClick(int amount) { private void onClick(int amount) {
NetworkManager.sendToServer(ServerboundPackets.createPacketPlayerDetector(amount, blockEntity)); ClientNetworkManager.sendToServer(ServerboundPackets.createPacketPlayerDetector(amount, blockEntity));
} }
@Override @Override

View file

@ -26,9 +26,9 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.network.NetworkManager;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity; import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -77,7 +77,7 @@ public class GuiRollingMachine extends GuiBase<BuiltScreenHandler> {
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (isPointInRect(130, 4, 20, 12, mouseX, mouseY)) { if (isPointInRect(130, 4, 20, 12, mouseX, mouseY)) {
NetworkManager.sendToServer(ServerboundPackets.createPacketRollingMachineLock(rollingMachine, !rollingMachine.locked)); ClientNetworkManager.sendToServer(ServerboundPackets.createPacketRollingMachineLock(rollingMachine, !rollingMachine.locked));
return true; return true;
} }
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);

View file

@ -27,8 +27,8 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.network.NetworkManager;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity; import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import techreborn.packets.ServerboundPackets; import techreborn.packets.ServerboundPackets;
@ -85,7 +85,7 @@ public class GuiStorageUnit extends GuiBase<BuiltScreenHandler> {
@Override @Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (isPointInRect(150, 4, 20, 12, mouseX, mouseY) && storageEntity.canModifyLocking()) { if (isPointInRect(150, 4, 20, 12, mouseX, mouseY) && storageEntity.canModifyLocking()) {
NetworkManager.sendToServer(ServerboundPackets.createPacketStorageUnitLock(storageEntity, !storageEntity.isLocked())); ClientNetworkManager.sendToServer(ServerboundPackets.createPacketStorageUnitLock(storageEntity, !storageEntity.isLocked()));
return true; return true;
} }
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);