Port to 1.18-pre2 without worldgen

This commit is contained in:
modmuss50 2021-11-16 22:38:31 +00:00
parent f5c3b85773
commit 4a2e81550f
38 changed files with 132 additions and 158 deletions

View file

@ -145,10 +145,10 @@ public class RenderUtil {
float l = (endColor >> 8 & 0xFF) / 255.0F;
float m = (endColor & 0xFF) / 255.0F;
bufferBuilder.vertex(matrices.peek().getModel(), right, top, zLevel).color(g, h, i, f).next();
bufferBuilder.vertex(matrices.peek().getModel(), left, top, zLevel).color(g, h, i, f).next();
bufferBuilder.vertex(matrices.peek().getModel(), left, bottom, zLevel).color(k, l, m, j).next();
bufferBuilder.vertex(matrices.peek().getModel(), right, bottom, zLevel).color(k, l, m, j).next();
bufferBuilder.vertex(matrices.peek().getPositionMatrix(), right, top, zLevel).color(g, h, i, f).next();
bufferBuilder.vertex(matrices.peek().getPositionMatrix(), left, top, zLevel).color(g, h, i, f).next();
bufferBuilder.vertex(matrices.peek().getPositionMatrix(), left, bottom, zLevel).color(k, l, m, j).next();
bufferBuilder.vertex(matrices.peek().getPositionMatrix(), right, bottom, zLevel).color(k, l, m, j).next();
tessellator.draw();
RenderSystem.disableBlend();

View file

@ -50,7 +50,7 @@ public abstract class BaseBlockEntityProvider extends Block implements BlockEnti
return Optional.empty();
}
ItemStack newStack = stack.copy();
NbtCompound blockEntityData = blockEntity.writeNbt(new NbtCompound());
NbtCompound blockEntityData = blockEntity.createNbt();
stripLocationData(blockEntityData);
if (!newStack.hasNbt()) {
newStack.setNbt(new NbtCompound());

View file

@ -126,12 +126,13 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
@Nullable
@Override
public BlockEntityUpdateS2CPacket toUpdatePacket() {
return new BlockEntityUpdateS2CPacket(getPos(), 0, toInitialChunkDataNbt());
return BlockEntityUpdateS2CPacket.create(this);
}
@Override
public NbtCompound toInitialChunkDataNbt() {
NbtCompound compound = super.writeNbt(new NbtCompound());
NbtCompound compound = new NbtCompound();
super.writeNbt(compound);
writeNbt(compound);
return compound;
}
@ -257,7 +258,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
}
@Override
public NbtCompound writeNbt(NbtCompound tagCompound) {
public void writeNbt(NbtCompound tagCompound) {
super.writeNbt(tagCompound);
if (getOptionalInventory().isPresent()) {
getOptionalInventory().get().write(tagCompound);
@ -273,7 +274,6 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
}
upgradeInventory.write(tagCompound, "Upgrades");
tagCompound.put("redstoneConfig", redstoneConfiguration.write());
return tagCompound;
}
private boolean isItemValidForSlot(int index, ItemStack stack) {

View file

@ -125,7 +125,7 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
}
@Override
public NbtCompound writeNbt(NbtCompound data) {
public void writeNbt(NbtCompound data) {
super.writeNbt(data);
if (isMultiblockSaveDelegate() && isConnected()) {
@ -133,7 +133,6 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
this.controller.write(multiblockData);
data.put("multiblockData", multiblockData);
}
return data;
}
@Override
@ -175,7 +174,7 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
public BlockEntityUpdateS2CPacket toUpdatePacket() {
NbtCompound packetData = new NbtCompound();
encodeDescriptionPacket(packetData);
return new BlockEntityUpdateS2CPacket(getPos(), 0, packetData);
return BlockEntityUpdateS2CPacket.create(this);
}
// /// Things to override in most implementations (IMultiblockPart)

View file

@ -556,7 +556,7 @@ public abstract class MultiblockControllerBase {
// Ensure that we save our data, even if the our save
// delegate is in has no TEs.
WorldChunk chunkToSave = this.worldObj.getChunk(x, z);
chunkToSave.markDirty();
chunkToSave.needsSaving();
}
}
}

View file

@ -39,7 +39,7 @@ import java.util.List;
public class ClientBoundPackets {
public static IdentifiedPacket createCustomDescriptionPacket(BlockEntity blockEntity) {
return createCustomDescriptionPacket(blockEntity.getPos(), blockEntity.writeNbt(new NbtCompound()));
return createCustomDescriptionPacket(blockEntity.getPos(), blockEntity.createNbt());
}
public static IdentifiedPacket createCustomDescriptionPacket(BlockPos blockPos, NbtCompound nbt) {

View file

@ -352,12 +352,11 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
}
@Override
public NbtCompound writeNbt(NbtCompound tag) {
public void writeNbt(NbtCompound tag) {
super.writeNbt(tag);
NbtCompound data = new NbtCompound();
data.putLong("energy", getStored());
tag.put("PowerAcceptor", data);
return tag;
}
@Override