9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-29 20:09:23 +00:00

fix 0057 0059 0074

This commit is contained in:
MC_XiaoHei
2025-07-03 17:26:57 +08:00
parent 92a373d570
commit 77b7cc2d2b
3 changed files with 9 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Container open passthrough
diff --git a/net/minecraft/world/entity/decoration/ItemFrame.java b/net/minecraft/world/entity/decoration/ItemFrame.java
index 90fd3ca5ecd29befa9237222e9f86a8a79a011e4..96524408ceae907d92f7554b1084ee1519d7b572 100644
index 90fd3ca5ecd29befa9237222e9f86a8a79a011e4..cc26f2bfd8992207fffd74b89752275abe2be623 100644
--- a/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -412,6 +412,20 @@ public class ItemFrame extends HangingEntity {
@@ -14,10 +14,10 @@ index 90fd3ca5ecd29befa9237222e9f86a8a79a011e4..96524408ceae907d92f7554b1084ee15
} else {
+ // Leaves start - itemFrameContainerPassthrough
+ if (org.leavesmc.leaves.LeavesConfig.modify.containerPassthrough && !player.isShiftKeyDown()) {
+ BlockPos pos1 = this.pos.relative(this.direction.getOpposite());
+ BlockPos pos1 = this.pos.relative(this.getDirection().getOpposite());
+ if (level().getBlockEntity(pos1) instanceof net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity) {
+ BlockState blockState = level().getBlockState(pos1);
+ net.minecraft.world.phys.BlockHitResult hitResult = new net.minecraft.world.phys.BlockHitResult(Vec3.atCenterOf(pos1), this.direction, pos1, false);
+ net.minecraft.world.phys.BlockHitResult hitResult = new net.minecraft.world.phys.BlockHitResult(Vec3.atCenterOf(pos1), this.getDirection(), pos1, false);
+ if (flag1) {
+ return blockState.useItemOn(itemInHand, level(), player, hand, hitResult);
+ } else {

View File

@@ -148,20 +148,20 @@ index a251ba67644cd02a0b00d7c8b0e2c64aa5e26291..59d48e7dc0911557c57a7e07f5f9013c
- } else {
- optional = Optional.empty();
+ // The palette that will be serialized
+ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> hashPalette = null;
+ org.leavesmc.leaves.lithium.common.world.chunk.LithiumHashPalette<T> hashPalette = null;
+
+ final Palette<T> palette = this.data.palette();
+ final BitStorage storage = this.data.storage();
+ if (storage instanceof ZeroBitStorage || palette.getSize() == 1) {
+ // If the palette only contains one entry, don't attempt to repack it.
+ elements = List.of(palette.valueFor(0));
+ } else if (palette instanceof net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> lithiumHashPalette) {
+ } else if (palette instanceof org.leavesmc.leaves.lithium.common.world.chunk.LithiumHashPalette<T> lithiumHashPalette) {
+ hashPalette = lithiumHashPalette;
}
- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional);
+ if (elements == null) {
+ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> compactedPalette = new net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<>(registry, storage.getBits(), this.dummyPaletteResize);
+ org.leavesmc.leaves.lithium.common.world.chunk.LithiumHashPalette<T> compactedPalette = new org.leavesmc.leaves.lithium.common.world.chunk.LithiumHashPalette<>(registry, storage.getBits(), this.dummyPaletteResize);
+ short[] array = this.getOrCreate(strategy.size());
+
+ storage.compact(this.data.palette(), compactedPalette, array);

View File

@@ -142,7 +142,7 @@ index 4a34e43d5471bb12ef2535a1a9246376310c56f1..d50d0874aa34578af3ff8a6bb7c889ba
}
// Leaves end - skip
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index e74ca7f4c98590941fe88935d9fea0917c7b5c50..968a6bbff3540d781c0925a0db96c0492283d1f2 100644
index e74ca7f4c98590941fe88935d9fea0917c7b5c50..769010299668550ddca53deda5dfdcd679f5767c 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -130,6 +130,7 @@ public abstract class PlayerList {
@@ -259,7 +259,7 @@ index e74ca7f4c98590941fe88935d9fea0917c7b5c50..968a6bbff3540d781c0925a0db96c049
+ this.server.getCustomBossEvents().onPlayerConnect(player);
+ }
+
+ worldserver1 = player.serverLevel();
+ worldserver1 = player.level();
+ java.util.Iterator<net.minecraft.world.effect.MobEffectInstance> iterator = player.getActiveEffects().iterator();
+ while (iterator.hasNext()) {
+ MobEffectInstance mobeffect = iterator.next();
@@ -286,7 +286,7 @@ index e74ca7f4c98590941fe88935d9fea0917c7b5c50..968a6bbff3540d781c0925a0db96c049
+ // Leaves start - replay mod api
+ public void removePhotographer(org.leavesmc.leaves.replay.ServerPhotographer entityplayer) {
+ ServerLevel worldserver = entityplayer.serverLevel();
+ ServerLevel worldserver = entityplayer.level();
+
+ entityplayer.awardStat(Stats.LEAVE_GAME);
+