remove Better ShulkerBox and Update Upstream(Luminol)
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ group=fun.bm.lophine
|
||||
version=1.21.6-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.6
|
||||
|
||||
luminolRef=9ff4bda08c2b7825b56d915a7e7395b9089f658f
|
||||
luminolRef=ba38b137c9d338430a15728d109562128a82295b
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":luminol-api")) // Luminol
|
||||
+ implementation(project(":lophine-api")) // Luminol // Lophine
|
||||
implementation("com.electronwill.night-config:toml:3.8.2") // Luminol - Night config
|
||||
// Abomination start
|
||||
+ implementation(project(":lophine-api")) // Lophine
|
||||
// Luminol start - Dependenices insert
|
||||
implementation("com.electronwill.night-config:toml:3.8.2") // Night config
|
||||
implementation("com.github.luben:zstd-jni:1.5.4-1")
|
||||
@@ -264,14 +_,14 @@
|
||||
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ index 6868b915bf3deb85783a638d4441a15fea6da2dc..70740381c6501c1a518c52b24381edd1
|
||||
double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1);
|
||||
if (rangeY != -1) {
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 990ea0359c9015f867dc529a284148cd4846f5e8..5c2796a072228e6cb6d7f27ec2536a94b9f3ac40 100644
|
||||
index b936d50e8c3668783d4b8d9d65b33706787f7791..bbe96ce3b9c0634018c74dcbe77e9ac67a5edcd6 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -147,7 +147,7 @@ import net.minecraft.world.waypoints.WaypointTransmitter;
|
||||
@@ -30,7 +30,7 @@ index 990ea0359c9015f867dc529a284148cd4846f5e8..5c2796a072228e6cb6d7f27ec2536a94
|
||||
// CraftBukkit start
|
||||
private static final int CURRENT_LEVEL = 2;
|
||||
public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first snapTo
|
||||
@@ -6363,4 +6363,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -6353,4 +6353,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
// Paper end - Expose entity id counter
|
||||
|
||||
public boolean shouldTickHot() { return this.tickCount > 20 * 10 && this.isAlive(); } // KioCG
|
||||
|
||||
@@ -37,7 +37,7 @@ index 5d6ed73d332722ed23b2ffa8aaef38d31274dfd8..5942f8a75343ead4ee2925f193c56ab7
|
||||
if (count > i) {
|
||||
source.sendFailure(Component.translatable("commands.give.failed.toomanyitems", i, itemStack.getDisplayName()));
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 4ced5b334fbfe68ce8eef38eeea5af6d007cea00..a770d2c84e1dfa41cdf1a4458b62c23e3cc78113 100644
|
||||
index f4c3214306f72c27ced87624c18e12b9689b0262..e1593211d311253a6d8a6eae6b0d975053251e35 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3066,7 +3066,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -123,10 +123,10 @@ index d907e24d563e27acab2f2bf9711b1755ea9afd19..6189cb7c1745a242b610e89c859cc849
|
||||
if (min > 0) {
|
||||
other.grow(min);
|
||||
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 244996de73d75e812e27aa896cd3875a14179b74..74e207b9e173facc8279db27b2dd1dd4faf71313 100644
|
||||
index 8b318426d3aff4be920181bb8b882c43119e1571..8d67df8732f3b71eee044e535c4536930fd6e405 100644
|
||||
--- a/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -271,10 +271,45 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -279,10 +279,45 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
|
||||
private boolean isMergable() {
|
||||
ItemStack item = this.getItem();
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Sat, 14 Jun 2025 05:32:51 +0800
|
||||
Subject: [PATCH] Better ShulkerBox
|
||||
|
||||
You can open shulker box with shift & right click
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 528d0a111b36e51d8943a013b36c378d442ef2dd..2e03b114dd2b8c0816621c7522fb9654025d7111 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2450,6 +2450,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
this.containerMenu.removed(this);
|
||||
this.inventoryMenu.transferState(this.containerMenu);
|
||||
this.containerMenu = this.inventoryMenu;
|
||||
+ fun.bm.lophine.utils.ShulkerBoxesUtil.clearMap(this); // Lophine - better shulker box
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/world/entity/player/Inventory.java b/net/minecraft/world/entity/player/Inventory.java
|
||||
index 53210a7d32241c47c2b1cd698b515726f0a1fd0d..399a7424712471329ca82094839859bbac8ed087 100644
|
||||
--- a/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -316,6 +316,11 @@ public class Inventory implements Container, Nameable {
|
||||
|
||||
int i = this.getMaxStackLeaves(item) - item.getCount();
|
||||
int min = Math.min(count, i);
|
||||
+ // Lophine start - better shulker box
|
||||
+ if (fun.bm.lophine.config.modules.misc.ContainerExpansionConfig.betterShulker) {
|
||||
+ fun.bm.lophine.utils.ShulkerBoxesUtil.inventoryCallBack(player, slot);
|
||||
+ }
|
||||
+ // Lophine end - better shulker box
|
||||
if (min == 0) {
|
||||
return count;
|
||||
} else {
|
||||
@@ -368,6 +373,11 @@ public class Inventory implements Container, Nameable {
|
||||
if (slot >= 0) {
|
||||
this.items.set(slot, stack.copyAndClear());
|
||||
this.items.get(slot).setPopTime(5);
|
||||
+ // Lophine start - better shulker box
|
||||
+ if (fun.bm.lophine.config.modules.misc.ContainerExpansionConfig.betterShulker) {
|
||||
+ fun.bm.lophine.utils.ShulkerBoxesUtil.inventoryCallBack(player, slot);
|
||||
+ }
|
||||
+ // Lophine end - better shulker box
|
||||
return true;
|
||||
} else if (this.player.hasInfiniteMaterials()) {
|
||||
stack.setCount(0);
|
||||
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
||||
index 283991c8da3ff07359c89482a72a7238c2cb7e26..5320f57897d673f3468b2bfecee4768bb00ef783 100644
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -605,11 +605,13 @@ public abstract class Player extends LivingEntity {
|
||||
// Paper start - special close for unloaded inventory
|
||||
public void closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
|
||||
this.containerMenu = this.inventoryMenu;
|
||||
+ fun.bm.lophine.utils.ShulkerBoxesUtil.clearMap(this); // Lophine - better shulker box
|
||||
}
|
||||
// Paper end - special close for unloaded inventory
|
||||
|
||||
public void closeContainer() {
|
||||
this.containerMenu = this.inventoryMenu;
|
||||
+ fun.bm.lophine.utils.ShulkerBoxesUtil.clearMap(this); // Lophine - better shulker box
|
||||
}
|
||||
|
||||
protected void doCloseContainer() {
|
||||
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 379ccae078370b4e8fc909e642f1a70066f70ebf..c28629f8900bf4c51a0daa1a8effd6c405ab1526 100644
|
||||
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -658,6 +658,11 @@ public abstract class AbstractContainerMenu {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Lophine start - better shulker box
|
||||
+ if (fun.bm.lophine.config.modules.misc.ContainerExpansionConfig.betterShulker) {
|
||||
+ fun.bm.lophine.utils.ShulkerBoxesUtil.inventoryCallBack(player, slotId - 54);
|
||||
+ }
|
||||
+ // Lophine end - better shulker box
|
||||
}
|
||||
|
||||
private boolean tryItemClickBehaviourOverride(Player player, ClickAction action, Slot slot, ItemStack clickedItem, ItemStack carriedItem) {
|
||||
diff --git a/net/minecraft/world/inventory/ShulkerBoxMenu.java b/net/minecraft/world/inventory/ShulkerBoxMenu.java
|
||||
index 903025c659e6a9423224fe65973696405c69ec6a..eb20f83d5aa2c06f60c3941e8a54434737c017c4 100644
|
||||
--- a/net/minecraft/world/inventory/ShulkerBoxMenu.java
|
||||
+++ b/net/minecraft/world/inventory/ShulkerBoxMenu.java
|
||||
@@ -53,7 +53,7 @@ public class ShulkerBoxMenu extends AbstractContainerMenu {
|
||||
|
||||
@Override
|
||||
public boolean stillValid(Player player) {
|
||||
- if (!this.checkReachable) return true; // CraftBukkit
|
||||
+ if (!this.checkReachable || fun.bm.lophine.utils.ShulkerBoxesUtil.checkIfValid(player)) return true; // CraftBukkit // Lophine - better shulker box
|
||||
return this.container.stillValid(player);
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/item/Item.java b/net/minecraft/world/item/Item.java
|
||||
index 40cb5e6bbcf9dbdb400f1503e86c0804b60e07be..8c279c6ed58f1af451170f9633e3a32f9ab59ee0 100644
|
||||
--- a/net/minecraft/world/item/Item.java
|
||||
+++ b/net/minecraft/world/item/Item.java
|
||||
@@ -187,6 +187,13 @@ public class Item implements FeatureElement, ItemLike {
|
||||
player.startUsingItem(hand);
|
||||
return InteractionResult.CONSUME;
|
||||
} else {
|
||||
+ // Lophine start - better shulker box
|
||||
+ if (fun.bm.lophine.config.modules.misc.ContainerExpansionConfig.betterShulker
|
||||
+ && player.isShiftKeyDown()
|
||||
+ && fun.bm.lophine.utils.ShulkerBoxesUtil.checkIfCanOpen(itemInHand)) {
|
||||
+ fun.bm.lophine.utils.ShulkerBoxesUtil.openShulkerBox(player, itemInHand, hand);
|
||||
+ }
|
||||
+ // Lophine end - better shulker box
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/item/component/ItemContainerContents.java b/net/minecraft/world/item/component/ItemContainerContents.java
|
||||
index ecf794f94177fc7b6df483516d920719fbc6fa43..4fda59a4c17009a0009f3d3c13258f4ffcb300c3 100644
|
||||
--- a/net/minecraft/world/item/component/ItemContainerContents.java
|
||||
+++ b/net/minecraft/world/item/component/ItemContainerContents.java
|
||||
@@ -33,7 +33,7 @@ public final class ItemContainerContents implements TooltipProvider {
|
||||
public final NonNullList<ItemStack> items;
|
||||
private final int hashCode;
|
||||
|
||||
- private ItemContainerContents(NonNullList<ItemStack> items) {
|
||||
+ public ItemContainerContents(NonNullList<ItemStack> items) { // Lophine - better shulker box
|
||||
if (items.size() > 256) {
|
||||
throw new IllegalArgumentException("Got " + items.size() + " items, but maximum is 256");
|
||||
} else {
|
||||
diff --git a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
index ebea67223ce1d350087c73dff0cc3fe6d7b47ca0..efbe87de81ad23d0d248dfa487d20190c6049cf4 100644
|
||||
--- a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
@@ -46,6 +46,10 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
private ShulkerBoxBlockEntity.AnimationStatus animationStatus = ShulkerBoxBlockEntity.AnimationStatus.CLOSED;
|
||||
private float progress;
|
||||
private float progressOld;
|
||||
+ // Lophine start - better shulker box
|
||||
+ public boolean haveRealBlock = true;
|
||||
+ public int slot;
|
||||
+ // Lophine end - better shulker box
|
||||
@Nullable
|
||||
private final DyeColor color;
|
||||
|
||||
@@ -236,6 +240,15 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
return Component.translatable("container.shulkerBox");
|
||||
}
|
||||
|
||||
+ // Lophine start - better shulker box
|
||||
+ public void setItem(int index, ItemStack stack) {
|
||||
+ super.setItem(index, stack);
|
||||
+ if (fun.bm.lophine.config.modules.misc.ContainerExpansionConfig.betterShulker && !haveRealBlock) {
|
||||
+ fun.bm.lophine.utils.ShulkerBoxesUtil.shulkerBoxEntityCallBack(this);
|
||||
+ }
|
||||
+ }
|
||||
+ // Lophine end - better shulker box
|
||||
+
|
||||
@Override
|
||||
protected void loadAdditional(ValueInput input) {
|
||||
super.loadAdditional(input);
|
||||
@@ -258,12 +271,12 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected NonNullList<ItemStack> getItems() {
|
||||
+ public NonNullList<ItemStack> getItems() { // Lophine - better shulker box
|
||||
return this.itemStacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void setItems(NonNullList<ItemStack> items) {
|
||||
+ public void setItems(NonNullList<ItemStack> items) { // Lophine - better shulker box
|
||||
this.itemStacks = items;
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ Subject: [PATCH] Spawn invulnerable time
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 2e03b114dd2b8c0816621c7522fb9654025d7111..4394341c31fec6bffbb4da0c8b5043170f8e9ea4 100644
|
||||
index ef650ac8c83731d677d24124c9f9af471c00a12e..17e249c073783d229561122d4809586872ad0ef1 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -232,6 +232,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
+1
-1
@@ -27,7 +27,7 @@ index 93d722d437121e605cee0e168ac17ee9bef0610e..3f2755aab2c3c1715f7b6056181fff4a
|
||||
CraftBlockState blockstate = worldData.capturedBlockStates.get(pos); // Folia - region threading
|
||||
if (blockstate == null) {
|
||||
diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index d4c02b9bb9bfc10484a79ede35985ba35c99bada..fd6afb7c572a370f0db4bf3937a0cff10e844a96 100644
|
||||
index 834e27ef2f7b342b074ff9e1e390e02f3ca1c399..f5765e3bbf9e735d6f959e1bf6ee1846ee11b4e9 100644
|
||||
--- a/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -770,6 +770,14 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -96,7 +96,7 @@ public class CullTask implements Runnable {
|
||||
lastCheckedTime = (System.currentTimeMillis() - start);
|
||||
}
|
||||
}
|
||||
}finally {
|
||||
} finally {
|
||||
if (this.scheduleNext) {
|
||||
this.worker.execute(this);
|
||||
}
|
||||
|
||||
-5
@@ -20,11 +20,6 @@ public class ContainerExpansionConfig implements IConfigModule {
|
||||
range: 1~64""")
|
||||
public static int shulkerCount = 1;
|
||||
|
||||
@ConfigInfo(baseName = "better_shulker_box", comments =
|
||||
"""
|
||||
Enable sneak + use to open shulker box.""")
|
||||
public static boolean betterShulker = false;
|
||||
|
||||
@Override
|
||||
public EnumConfigCategory getCategory() {
|
||||
return EnumConfigCategory.MISC;
|
||||
|
||||
@@ -7,6 +7,7 @@ import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
|
||||
public class RemovedConfig implements IConfigModule {
|
||||
@TransformedConfig(name = "old_nether_portal_collision", category = {"misc", "old-feature"}, transform = false)
|
||||
@TransformedConfig(name = "better_shulker_box", category = {"misc", "container_expansion"}, transform = false)
|
||||
@ConfigInfo(baseName = "removed", comments =
|
||||
"""
|
||||
RemovedConfig redirect to here, no any function.""")
|
||||
|
||||
@@ -32,10 +32,10 @@ import java.util.function.BiConsumer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/*
|
||||
* authored by: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
* modified by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
|
||||
* Some of diff form Leaves
|
||||
*/
|
||||
* authored by: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
* modified by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
|
||||
* Some of diff form Leaves
|
||||
*/
|
||||
public class ServerI18nUtil {
|
||||
|
||||
private static final Logger logger = Logger.getLogger("LangLoader");
|
||||
|
||||
@@ -1,31 +1,18 @@
|
||||
package fun.bm.lophine.utils;
|
||||
|
||||
import fun.bm.lophine.config.modules.misc.ContainerExpansionConfig;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.SlotAccess;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.item.component.ItemContainerContents;
|
||||
import net.minecraft.world.level.block.ShulkerBoxBlock;
|
||||
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ShulkerBoxesUtil {
|
||||
// Better ShulkerBoxes used
|
||||
public static HashMap<Player, ShulkerBoxBlockEntity> shulkerMap = new HashMap<>();
|
||||
public static HashMap<ShulkerBoxBlockEntity, Player> playerMap = new HashMap<>();
|
||||
|
||||
// Stackable ShulkerBoxes part
|
||||
public static boolean shouldCheck() {
|
||||
return ContainerExpansionConfig.shulkerCount > 1 && ContainerExpansionConfig.shulkerCount <= 64;
|
||||
}
|
||||
@@ -88,76 +75,4 @@ public class ShulkerBoxesUtil {
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
// Better ShulkerBox part
|
||||
public static boolean checkIfCanOpen(ItemStack itemStack) {
|
||||
return checkIsShulkerBox(itemStack) && itemStack.getCount() == 1;
|
||||
}
|
||||
|
||||
public static boolean checkIfValid(Player player) {
|
||||
return shulkerMap.get(player) != null;
|
||||
}
|
||||
|
||||
public static void openShulkerBox(Player player, ItemStack item, InteractionHand hand) {
|
||||
ItemStack itemInHand = item.copy();
|
||||
ShulkerBoxBlockEntity shulkerBoxEntity = new ShulkerBoxBlockEntity(
|
||||
player.blockPosition(),
|
||||
((BlockItem) itemInHand.getItem()).getBlock().defaultBlockState()
|
||||
);
|
||||
ItemContainerContents container = itemInHand.getOrDefault(
|
||||
DataComponents.CONTAINER,
|
||||
ItemContainerContents.EMPTY
|
||||
);
|
||||
|
||||
NonNullList<ItemStack> items = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
for (int i = 0; i < container.items.size(); i++) {
|
||||
items.set(i, container.items.get(i));
|
||||
}
|
||||
|
||||
shulkerBoxEntity.setItems(items);
|
||||
|
||||
shulkerBoxEntity.haveRealBlock = false;
|
||||
shulkerBoxEntity.slot = hand == InteractionHand.MAIN_HAND ? player.getInventory().getSelectedSlot() : 40;
|
||||
shulkerBoxEntity.setLevel(player.level());
|
||||
|
||||
shulkerMap.put(player, shulkerBoxEntity);
|
||||
playerMap.put(shulkerBoxEntity, player);
|
||||
|
||||
if (player.openMenu(shulkerBoxEntity).isPresent()) {
|
||||
player.awardStat(Stats.OPEN_SHULKER_BOX);
|
||||
}
|
||||
}
|
||||
|
||||
public static void shulkerBoxEntityCallBack(ShulkerBoxBlockEntity shulkerBoxEntity) {
|
||||
Player player = playerMap.get(shulkerBoxEntity);
|
||||
if (player != null) {
|
||||
SlotAccess slot = player.getSlot(shulkerBoxEntity.slot);
|
||||
ItemStack currentItem = slot.get();
|
||||
ItemStack copy = currentItem.copy();
|
||||
|
||||
copy.set(DataComponents.CONTAINER, ItemContainerContents.fromItems(shulkerBoxEntity.getItems()));
|
||||
|
||||
slot.set(copy);
|
||||
}
|
||||
}
|
||||
|
||||
public static void inventoryCallBack(Player player, int slotId) {
|
||||
ShulkerBoxBlockEntity entity = shulkerMap.get(player);
|
||||
if (entity != null) {
|
||||
if ((slotId == entity.slot) && player instanceof ServerPlayer serverPlayer)
|
||||
serverPlayer.closeContainer();
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearMap(Player p) {
|
||||
ShulkerBoxBlockEntity e = shulkerMap.get(p);
|
||||
if (e != null) playerMap.remove(e);
|
||||
shulkerMap.remove(p);
|
||||
}
|
||||
|
||||
public static void clearMap(ShulkerBoxBlockEntity e) {
|
||||
Player p = playerMap.get(e);
|
||||
if (p != null) shulkerMap.remove(p);
|
||||
playerMap.remove(e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user