From 2fbf303aa54442b38b0c9b7e665a711f615d7728 Mon Sep 17 00:00:00 2001 From: Jab125 <67534807+Jab125@users.noreply.github.com> Date: Sat, 23 Mar 2024 15:14:57 +1100 Subject: [PATCH 1/2] Update README.md (#103) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35446706..a36e7a4f 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ ## License Notes Some code is used from other projects with other licenses. -* The package `com.jab125` and all it's subpackages are licensed under All Rights Reserved. -* Everything in [updater/](updater) also is licensed under All Rights Reserved. +* The package `com.jab125` and all it's subpackages are licensed the GPL 3.0. +* Everything in [updater/](updater) also is licensed under the GPL 3.0. [@MrCrayfish](https://github.com/MrCrayfish) has said on his discord server that we can use his code and even the assets for this port. From 4335a28e9f28435c30eda3cba7219df44e88c22f Mon Sep 17 00:00:00 2001 From: Jab125 <67534807+Jab125@users.noreply.github.com> Date: Thu, 28 Mar 2024 14:38:29 +1100 Subject: [PATCH 2/2] Fix seat entity despawning when block 2 blocks under is air. (#105) --- .../ultreon/devices/entity/SeatEntity.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/ultreon/devices/entity/SeatEntity.java b/common/src/main/java/com/ultreon/devices/entity/SeatEntity.java index 1139583a..d9782e6d 100644 --- a/common/src/main/java/com/ultreon/devices/entity/SeatEntity.java +++ b/common/src/main/java/com/ultreon/devices/entity/SeatEntity.java @@ -3,6 +3,7 @@ import com.ultreon.devices.init.DeviceEntities; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; @@ -15,6 +16,7 @@ public class SeatEntity extends Entity { private double yOffset; + private BlockPos blockPos; public SeatEntity(EntityType type, Level worldIn) { super(type, worldIn); @@ -31,6 +33,7 @@ public SeatEntity(Level worldIn, BlockPos pos, double yOffset) { this(DeviceEntities.SEAT.get(), worldIn); this.setPos(pos.getX() + 0.5, pos.getY() + yOffset, pos.getZ() + 0.5); + this.blockPos = pos; } @@ -39,6 +42,7 @@ public void setYOffset(double offset) { } public void setViaYOffset(BlockPos pos) { + blockPos = pos; this.setPos(pos.getX() + 0.5, pos.getY() + yOffset, pos.getZ() + 0.5); } @@ -57,7 +61,7 @@ protected void defineSynchedData() { @Override public void tick() { - if(!this.level().isClientSide && (!this.hasExactlyOnePlayerPassenger() || this.level().isEmptyBlock(this.getOnPos()))) + if(!this.level().isClientSide && (blockPos == null || !this.hasExactlyOnePlayerPassenger() || this.level().isEmptyBlock(blockPos))) { this.kill(); } @@ -79,8 +83,17 @@ public Packet getAddEntityPacket() { // protected void.json init() {} @Override - protected void readAdditionalSaveData(CompoundTag compound) {} + protected void readAdditionalSaveData(CompoundTag compound) { + if (compound.contains("DevicesChairX", Tag.TAG_INT) && compound.contains("DevicesChairY", Tag.TAG_INT) && compound.contains("DevicesChairZ", Tag.TAG_INT)) { + blockPos = new BlockPos(compound.getInt("DevicesChairX"), compound.getInt("DevicesChairY"), compound.getInt("DevicesChairZ")); + } + } @Override - protected void addAdditionalSaveData(CompoundTag compound) {} + protected void addAdditionalSaveData(CompoundTag compound) { + if (blockPos == null) return; + compound.putInt("DevicesChairX", blockPos.getX()); + compound.putInt("DevicesChairY", blockPos.getY()); + compound.putInt("DevicesChairZ", blockPos.getZ()); + } }