1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-31 01:27:55 +00:00

time to make a diff of the fabric branch with ours to see what we are miss

This commit is contained in:
Devan-Kerman
2020-08-30 08:35:07 -05:00
parent afb12eb342
commit c64644b9ec
2 changed files with 54 additions and 45 deletions

View File

@@ -3,43 +3,48 @@
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared.network.container;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.computer.core.ServerComputer;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.Identifier;
public class ComputerContainerData implements ContainerData
{
private final int id;
private final ComputerFamily family;
public class ComputerContainerData implements ContainerData {
private static final Identifier IDENTIFIER = new Identifier(ComputerCraft.MOD_ID, "computerContainerData");
private int id;
private ComputerFamily family;
public ComputerContainerData( ServerComputer computer )
{
public ComputerContainerData(ServerComputer computer) {
this.id = computer.getInstanceID();
this.family = computer.getFamily();
}
public ComputerContainerData( PacketByteBuf buf )
{
@Override
public Identifier getId() {
return IDENTIFIER;
}
@Override
public void fromBytes(PacketByteBuf buf) {
this.id = buf.readInt();
this.family = buf.readEnumConstant(ComputerFamily.class);
}
@Override
public void toBytes( PacketByteBuf buf )
{
public void toBytes(PacketByteBuf buf) {
buf.writeInt(id);
buf.writeEnumConstant(family);
}
public int getInstanceId()
{
public int getInstanceId() {
return id;
}
public ComputerFamily getFamily()
{
public ComputerFamily getFamily() {
return family;
}
}

View File

@@ -3,60 +3,64 @@
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared.network.container;
import javax.annotation.Nonnull;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.core.terminal.Terminal;
import dan200.computercraft.shared.computer.core.ServerComputer;
import javax.annotation.Nonnull;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.Identifier;
/**
* View an arbitrary computer on the client.
*
* @see dan200.computercraft.shared.command.CommandComputerCraft
*/
public class ViewComputerContainerData extends ComputerContainerData
{
private final int width;
private final int height;
public class ViewComputerContainerData extends ComputerContainerData {
private int width;
private int height;
public ViewComputerContainerData( ServerComputer computer )
{
public ViewComputerContainerData(ServerComputer computer) {
super(computer);
Terminal terminal = computer.getTerminal();
if( terminal != null )
{
if (terminal != null) {
width = terminal.getWidth();
height = terminal.getHeight();
}
else
{
} else {
width = height = 0;
}
}
public ViewComputerContainerData( PacketByteBuf buffer )
{
super( buffer );
width = buffer.readVarInt();
height = buffer.readVarInt();
private static final Identifier IDENTIFIER = new Identifier(ComputerCraft.MOD_ID, "viewComputerContainerData");
@Override
public Identifier getId() {
return IDENTIFIER;
}
@Override
public void toBytes( @Nonnull PacketByteBuf buf )
{
public void fromBytes(PacketByteBuf buf) {
super.fromBytes(buf);
width = buf.readVarInt();
height = buf.readVarInt();
}
@Override
public void toBytes(@Nonnull PacketByteBuf buf) {
super.toBytes(buf);
buf.writeVarInt(width);
buf.writeVarInt(height);
}
public int getWidth()
{
public int getWidth() {
return width;
}
public int getHeight()
{
public int getHeight() {
return height;
}
}