PlayerHooks#closeContainer

This commit is contained in:
shedaniel
2020-11-08 23:28:59 +08:00
parent fd371dd9cd
commit a86e762524
4 changed files with 18 additions and 1 deletions

View File

@@ -33,8 +33,14 @@ public final class PlayerHooks {
return IMPL.isFake(player);
}
public static void closeContainer(Player player) {
IMPL.closeContainer(player);
}
public interface Impl {
boolean isFake(Player player);
void closeContainer(Player player);
}
static {

View File

@@ -24,4 +24,9 @@ public class PlayerHooksImpl implements PlayerHooks.Impl {
public boolean isFake(Player player) {
return false;
}
@Override
public void closeContainer(Player player) {
player.closeContainer();
}
}

View File

@@ -50,4 +50,5 @@ mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties dy
accessible method net/minecraft/world/entity/Entity getEncodeId ()Ljava/lang/String;
accessible field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set;
mutable field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set;
accessible field net/minecraft/world/item/DyeColor textureDiffuseColor I
accessible field net/minecraft/world/item/DyeColor textureDiffuseColor I
accessible method net/minecraft/world/entity/player/Player closeContainer ()V

View File

@@ -25,4 +25,9 @@ public class PlayerHooksImpl implements PlayerHooks.Impl {
public boolean isFake(PlayerEntity playerEntity) {
return playerEntity instanceof FakePlayer;
}
@Override
public void closeContainer(PlayerEntity playerEntity) {
playerEntity.closeContainer();
}
}