mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
* init 1.21.4, and boom! * build change, but weight not work * just work * Build changes, and delete timings * Fix API patches (#406) * Fix API patches * merge --------- Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com> * 0006/0129 * 0009/0129 * 0011/0129 * 0018/0129 * 0030/0129 * 0035/0129 * 0043/0129 * 0048/0129 * 0049/0129 * 0057/0129 * 0065/0129 * 0086/0129 (#408) * 0072/0129 * 0080/0129 * Readd patch infos * 0086/0129 * Delete applied patches * 0087/0129 * 0091/0129 * 0097/0129 * 0101/0129 * 102/129 * 0107/0129 * 0112/0129 * 0118/0129 * 0129/0129, 100% patched * fix some * server work * Protocol... (#409) * Jade v7 * Fix changed part for Jade * Formatting imports, add Lms Paster protocol * REI payloads 5/8 * Add REI support, remove unnecessary content in Jade * Rename * Make jade better * Make action work * fix action jar * Fix some protocol * Fix bot action, and entity tickCount * Fix Warden GameEventListener register on load * Fix extra Raider drop * Fix grindstone overstacking * Update Paper, and some doc * Merge * [ci skip] Update Action --------- Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
290 lines
13 KiB
Diff
290 lines
13 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Mon, 3 Feb 2025 13:17:03 +0800
|
|
Subject: [PATCH] PCA sync protocol
|
|
|
|
This patch is Powered by plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
|
|
|
diff --git a/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
index d52a8315f1e6876c26c732f4c4caa47bc6bebf6e..8f287d11ab9ce493d34bf70780964c0f9a7faaa0 100644
|
|
--- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
+++ b/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
@@ -422,6 +422,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
|
|
|
@Override
|
|
public void containerChanged(Container invBasic) {
|
|
+ // Leaves start - pca
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncEntityToClient(this);
|
|
+ }
|
|
+ // Leaves end - pca
|
|
boolean isSaddled = this.isSaddled();
|
|
this.syncSaddleToClients();
|
|
if (this.tickCount > 20 && !isSaddled && this.isSaddled()) {
|
|
diff --git a/net/minecraft/world/entity/npc/AbstractVillager.java b/net/minecraft/world/entity/npc/AbstractVillager.java
|
|
index a71d16d968bb90fd7aca6f01a3dd56df4f9a7ce6..18a087a52070b9bdee4d02ff3fc6a3c063e444d4 100644
|
|
--- a/net/minecraft/world/entity/npc/AbstractVillager.java
|
|
+++ b/net/minecraft/world/entity/npc/AbstractVillager.java
|
|
@@ -65,6 +65,15 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
|
super(entityType, level);
|
|
this.setPathfindingMalus(PathType.DANGER_FIRE, 16.0F);
|
|
this.setPathfindingMalus(PathType.DAMAGE_FIRE, -1.0F);
|
|
+ // Leaves start - pca
|
|
+ if (!this.level().isClientSide()) {
|
|
+ this.inventory.addListener(inventory -> {
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncEntityToClient(this);
|
|
+ }
|
|
+ });
|
|
+ }
|
|
+ // Leaves end - pca
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
|
index 516b230769fb9ddaa49adca9b6aa64d4510810da..c279e2cdafbb710b799a730e5cf7056dd2142d3b 100644
|
|
--- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
|
+++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
|
@@ -64,6 +64,11 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
|
|
|
@Override
|
|
public void setChanged() {
|
|
+ // Leaves start - pca
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncEntityToClient(this);
|
|
+ }
|
|
+ // Leaves end - pca
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
index cb4b8567c029e3a53aafda2755e3773ea8b95af7..77e7188180cce9ef881de64b263c704b219b610a 100644
|
|
--- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
@@ -434,6 +434,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
|
}
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ @Override
|
|
+ public void setChanged() {
|
|
+ super.setChanged();
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - pca
|
|
+
|
|
@Override
|
|
public void setRecipeUsed(@Nullable RecipeHolder<?> recipe) {
|
|
if (recipe != null) {
|
|
diff --git a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
index 0f808855f58281578c2758513787f0f7330c9291..e31f55ad12160c8406c0ab719f593d4c35ac9100 100644
|
|
--- a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
@@ -120,6 +120,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
|
this.items = items;
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ @Override
|
|
+ public void setChanged() {
|
|
+ super.setChanged();
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - pca
|
|
+
|
|
@Override
|
|
protected Component getDefaultName() {
|
|
return Component.translatable("container.barrel");
|
|
diff --git a/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
|
index 47582c2cbae227c47684b8451c7bac39bce7e0aa..56e65301adba14c0c8af161a7aa9049949ecaddc 100644
|
|
--- a/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
|
@@ -151,6 +151,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
|
super.setChanged();
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ // Leaves end - pca
|
|
return list;
|
|
}
|
|
|
|
@@ -208,6 +213,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
|
this.level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(bee, this.getBlockState()));
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ // Leaves end - pca
|
|
bee.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.ENTER_BLOCK); // CraftBukkit - add Bukkit remove cause
|
|
super.setChanged();
|
|
}
|
|
@@ -329,6 +339,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
|
if (releaseOccupant(level, pos, state, beeData.toOccupant(), null, beeReleaseStatus, savedFlowerPos)) {
|
|
flag = true;
|
|
iterator.remove();
|
|
+ // Leaves start - pca
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(java.util.Objects.requireNonNull(level.getBlockEntity(pos)));
|
|
+ }
|
|
+ // Leaves end - pca
|
|
}
|
|
// Paper start - Fix bees aging inside; use exitTickCounter to keep actual bee life
|
|
else {
|
|
@@ -372,6 +387,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
|
this.maxBees = tag.getInt("Bukkit.MaxEntities");
|
|
}
|
|
// CraftBukkit end
|
|
+ // Leaves start - pca
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ // Leaves end - pca
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
index 94f9477e78600eded6eecc4c961576501001d187..a9a85655aac78a0be91100e8b411a28eb066162d 100644
|
|
--- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
@@ -324,4 +324,14 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
|
protected AbstractContainerMenu createMenu(int id, Inventory player) {
|
|
return new BrewingStandMenu(id, player, this, this.dataAccess);
|
|
}
|
|
+
|
|
+ // Leaves start - pca
|
|
+ @Override
|
|
+ public void setChanged() {
|
|
+ super.setChanged();
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - pca
|
|
}
|
|
diff --git a/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
index afd9d657e3dc5715f22a49acb100412d00df7b7a..c59bf8a56e61cfcae064fc8a92d2c9840f733b77 100644
|
|
--- a/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
@@ -198,6 +198,16 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
otherChest.setItems(items);
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ @Override
|
|
+ public void setChanged() {
|
|
+ super.setChanged();
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - pca
|
|
+
|
|
@Override
|
|
protected AbstractContainerMenu createMenu(int id, Inventory player) {
|
|
return ChestMenu.threeRows(id, player, this);
|
|
diff --git a/net/minecraft/world/level/block/entity/ComparatorBlockEntity.java b/net/minecraft/world/level/block/entity/ComparatorBlockEntity.java
|
|
index d3bff18645f4d3c5b71a9ee232b8e51fa8aaaaa0..2922ce789b7ae5bcd4adb70ab153ecb19355e030 100644
|
|
--- a/net/minecraft/world/level/block/entity/ComparatorBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/ComparatorBlockEntity.java
|
|
@@ -24,6 +24,16 @@ public class ComparatorBlockEntity extends BlockEntity {
|
|
this.output = tag.getInt("OutputSignal");
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ @Override
|
|
+ public void setChanged() {
|
|
+ super.setChanged();
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - pca
|
|
+
|
|
public int getOutputSignal() {
|
|
return this.output;
|
|
}
|
|
diff --git a/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
index 33ca79c5713961a657d3a7af1f53b89e9449eba9..3c62662e626d3f0e309d2a973c73e6ac1055cae3 100644
|
|
--- a/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
@@ -99,6 +99,16 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
|
return stack;
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ @Override
|
|
+ public void setChanged() {
|
|
+ super.setChanged();
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - pca
|
|
+
|
|
@Override
|
|
protected Component getDefaultName() {
|
|
return Component.translatable("container.dispenser");
|
|
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
index 5cd1326ad5d046c88b2b3449d610a78fa880b4cd..42a29e700d2549de7cd905c373212e9757bcfcf1 100644
|
|
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
@@ -118,6 +118,16 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
this.facing = blockState.getValue(HopperBlock.FACING);
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ @Override
|
|
+ public void setChanged() {
|
|
+ super.setChanged();
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - pca
|
|
+
|
|
@Override
|
|
protected Component getDefaultName() {
|
|
return Component.translatable("container.hopper");
|
|
@@ -194,6 +204,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
if (flag) {
|
|
blockEntity.setCooldown(level.spigotConfig.hopperTransfer); // Spigot
|
|
setChanged(level, pos, state);
|
|
+ // Leaves start - pca
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(blockEntity);
|
|
+ }
|
|
+ // Leaves end - pca
|
|
return true;
|
|
}
|
|
}
|
|
diff --git a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
index a2ae4b47d742e7fb9809cfc4575517c06400ec61..cc8781c0a357eebc2bff936b4e7be53cc316716d 100644
|
|
--- a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
@@ -258,6 +258,16 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
|
this.itemStacks = items;
|
|
}
|
|
|
|
+ // Leaves start - pca
|
|
+ @Override
|
|
+ public void setChanged() {
|
|
+ super.setChanged();
|
|
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
|
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - pca
|
|
+
|
|
@Override
|
|
public int[] getSlotsForFace(Direction side) {
|
|
return SLOTS;
|