Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5fbab1ab8f | ||
|
d97b092978 | ||
|
154bf56c2a | ||
|
d65a9caeb2 | ||
|
b3c4253606 | ||
|
b64000e89b | ||
|
3faf41ef18 | ||
|
db27d25a93 | ||
|
0f02e6fe66 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,7 +3,7 @@
|
|||||||
**/.project
|
**/.project
|
||||||
**/.classpath
|
**/.classpath
|
||||||
**/.idea
|
**/.idea
|
||||||
**/.iml
|
**.iml
|
||||||
**/target
|
**/target
|
||||||
**/bin
|
**/bin
|
||||||
**/out
|
**/out
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvapi</artifactId>
|
<artifactId>openinvapi</artifactId>
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvassembly</artifactId>
|
<artifactId>openinvassembly</artifactId>
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvapi</artifactId>
|
<artifactId>openinvapi</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_13_R2</artifactId>
|
<artifactId>openinvadapter1_13_R2</artifactId>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
|
|||||||
private final CraftInventory inventory = new CraftInventory(this);
|
private final CraftInventory inventory = new CraftInventory(this);
|
||||||
private boolean playerOnline;
|
private boolean playerOnline;
|
||||||
private NonNullList<ItemStack> items, armor, extraSlots;
|
private NonNullList<ItemStack> items, armor, extraSlots;
|
||||||
private final List<NonNullList<ItemStack>> f;
|
private List<NonNullList<ItemStack>> f;
|
||||||
|
|
||||||
public SpecialPlayerInventory(final Player bukkitPlayer, final Boolean online) {
|
public SpecialPlayerInventory(final Player bukkitPlayer, final Boolean online) {
|
||||||
super(PlayerDataManager.getHandle(bukkitPlayer));
|
super(PlayerDataManager.getHandle(bukkitPlayer));
|
||||||
@@ -73,10 +73,14 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
|
|||||||
EntityPlayer entityPlayer = PlayerDataManager.getHandle(player);
|
EntityPlayer entityPlayer = PlayerDataManager.getHandle(player);
|
||||||
entityPlayer.inventory.transaction.addAll(this.transaction);
|
entityPlayer.inventory.transaction.addAll(this.transaction);
|
||||||
this.player = entityPlayer;
|
this.player = entityPlayer;
|
||||||
this.player.inventory.a(this);
|
for (int i = 0; i < getSize(); ++i) {
|
||||||
|
this.player.inventory.setItem(i, getRawItem(i));
|
||||||
|
}
|
||||||
|
this.player.inventory.itemInHandIndex = this.itemInHandIndex;
|
||||||
this.items = this.player.inventory.items;
|
this.items = this.player.inventory.items;
|
||||||
this.armor = this.player.inventory.armor;
|
this.armor = this.player.inventory.armor;
|
||||||
this.extraSlots = this.player.inventory.extraSlots;
|
this.extraSlots = this.player.inventory.extraSlots;
|
||||||
|
this.f = ImmutableList.of(this.items, this.armor, this.extraSlots);
|
||||||
this.playerOnline = true;
|
this.playerOnline = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,6 +120,19 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
|
|||||||
return list.get(i);
|
return list.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ItemStack getRawItem(int i) {
|
||||||
|
NonNullList<ItemStack> list = null;
|
||||||
|
for (NonNullList<ItemStack> next : this.f) {
|
||||||
|
if (i < next.size()) {
|
||||||
|
list = next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i -= next.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
return list == null ? ItemStack.a : list.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IChatBaseComponent getDisplayName() {
|
public IChatBaseComponent getDisplayName() {
|
||||||
return new ChatMessage(this.player.getName());
|
return new ChatMessage(this.player.getName());
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_14_R1</artifactId>
|
<artifactId>openinvadapter1_14_R1</artifactId>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@@ -18,8 +18,6 @@ package com.lishid.openinv.internal.v1_14_R1;
|
|||||||
|
|
||||||
import com.lishid.openinv.internal.IAnySilentContainer;
|
import com.lishid.openinv.internal.IAnySilentContainer;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import net.minecraft.server.v1_14_R1.AxisAlignedBB;
|
|
||||||
import net.minecraft.server.v1_14_R1.Block;
|
import net.minecraft.server.v1_14_R1.Block;
|
||||||
import net.minecraft.server.v1_14_R1.BlockBarrel;
|
import net.minecraft.server.v1_14_R1.BlockBarrel;
|
||||||
import net.minecraft.server.v1_14_R1.BlockChest;
|
import net.minecraft.server.v1_14_R1.BlockChest;
|
||||||
@@ -31,11 +29,9 @@ import net.minecraft.server.v1_14_R1.BlockShulkerBox;
|
|||||||
import net.minecraft.server.v1_14_R1.ChatMessage;
|
import net.minecraft.server.v1_14_R1.ChatMessage;
|
||||||
import net.minecraft.server.v1_14_R1.Container;
|
import net.minecraft.server.v1_14_R1.Container;
|
||||||
import net.minecraft.server.v1_14_R1.ContainerChest;
|
import net.minecraft.server.v1_14_R1.ContainerChest;
|
||||||
import net.minecraft.server.v1_14_R1.Entity;
|
|
||||||
import net.minecraft.server.v1_14_R1.EntityCat;
|
|
||||||
import net.minecraft.server.v1_14_R1.EntityHuman;
|
import net.minecraft.server.v1_14_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_14_R1.EntityPlayer;
|
import net.minecraft.server.v1_14_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_14_R1.EnumDirection;
|
import net.minecraft.server.v1_14_R1.EnumChatFormat;
|
||||||
import net.minecraft.server.v1_14_R1.EnumGamemode;
|
import net.minecraft.server.v1_14_R1.EnumGamemode;
|
||||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||||
import net.minecraft.server.v1_14_R1.IChatBaseComponent;
|
import net.minecraft.server.v1_14_R1.IChatBaseComponent;
|
||||||
@@ -47,15 +43,23 @@ import net.minecraft.server.v1_14_R1.PlayerInventory;
|
|||||||
import net.minecraft.server.v1_14_R1.TileEntity;
|
import net.minecraft.server.v1_14_R1.TileEntity;
|
||||||
import net.minecraft.server.v1_14_R1.TileEntityChest;
|
import net.minecraft.server.v1_14_R1.TileEntityChest;
|
||||||
import net.minecraft.server.v1_14_R1.TileEntityEnderChest;
|
import net.minecraft.server.v1_14_R1.TileEntityEnderChest;
|
||||||
import net.minecraft.server.v1_14_R1.TileEntityShulkerBox;
|
import net.minecraft.server.v1_14_R1.TileEntityLootable;
|
||||||
import net.minecraft.server.v1_14_R1.TileInventory;
|
import net.minecraft.server.v1_14_R1.TileInventory;
|
||||||
import net.minecraft.server.v1_14_R1.VoxelShapes;
|
|
||||||
import net.minecraft.server.v1_14_R1.World;
|
import net.minecraft.server.v1_14_R1.World;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Statistic;
|
import org.bukkit.Statistic;
|
||||||
|
import org.bukkit.block.Barrel;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.EnderChest;
|
||||||
|
import org.bukkit.block.ShulkerBox;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.block.data.Directional;
|
||||||
|
import org.bukkit.block.data.type.Chest;
|
||||||
|
import org.bukkit.entity.Cat;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
|
import org.bukkit.util.BoundingBox;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class AnySilentContainer implements IAnySilentContainer {
|
public class AnySilentContainer implements IAnySilentContainer {
|
||||||
@@ -84,92 +88,80 @@ public class AnySilentContainer implements IAnySilentContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAnyContainerNeeded(@NotNull final Player p, @NotNull final org.bukkit.block.Block bukkitBlock) {
|
public boolean isAnyContainerNeeded(@NotNull final Player p, @NotNull final org.bukkit.block.Block block) {
|
||||||
if (bukkitBlock.getType() == Material.BARREL) {
|
BlockState blockState = block.getState();
|
||||||
|
|
||||||
|
// Barrels do not require AnyContainer.
|
||||||
|
if (blockState instanceof Barrel) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPlayer player = PlayerDataManager.getHandle(p);
|
// Enderchests require a non-occluding block on top to open.
|
||||||
World world = player.world;
|
if (blockState instanceof EnderChest) {
|
||||||
BlockPosition blockPosition = new BlockPosition(bukkitBlock.getX(), bukkitBlock.getY(), bukkitBlock.getZ());
|
return block.getRelative(0, 1, 0).getType().isOccluding();
|
||||||
IBlockData blockData = world.getType(blockPosition);
|
|
||||||
Block block = blockData.getBlock();
|
|
||||||
|
|
||||||
if (block instanceof BlockShulkerBox) {
|
|
||||||
return this.isBlockedShulkerBox(world, blockPosition, blockData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block instanceof BlockEnderChest) {
|
// Shulker boxes require 1/2 a block clear in the direction they open.
|
||||||
// Ender chests are not blocked by ocelots.
|
if (blockState instanceof ShulkerBox) {
|
||||||
return world.getType(blockPosition.up()).isOccluding(world, blockPosition);
|
BoundingBox boundingBox = block.getBoundingBox();
|
||||||
|
if (boundingBox.getVolume() > 1) {
|
||||||
|
// Shulker box is already open.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockData blockData = block.getBlockData();
|
||||||
|
if (!(blockData instanceof Directional)) {
|
||||||
|
// Shouldn't be possible. Just in case, demand AnyChest.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Directional directional = (Directional) blockData;
|
||||||
|
BlockFace face = directional.getFacing();
|
||||||
|
boundingBox.shift(face.getDirection());
|
||||||
|
// Return whether or not bounding boxes overlap.
|
||||||
|
return block.getRelative(face, 1).getBoundingBox().overlaps(boundingBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if chest is blocked or has an ocelot on top
|
if (!(blockState instanceof org.bukkit.block.Chest)) {
|
||||||
if (this.isBlockedChest(world, blockPosition)) {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isBlockedChest(block)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for matching adjacent chests that are blocked or have an ocelot on top
|
BlockData blockData = block.getBlockData();
|
||||||
BlockPropertyChestType chestType = blockData.get(BlockChest.b);
|
if (!(blockData instanceof Chest) || ((Chest) blockData).getType() == Chest.Type.SINGLE) {
|
||||||
|
|
||||||
if (chestType == BlockPropertyChestType.SINGLE) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPosition adjacentBlockPosition = blockPosition.shift(BlockChest.j(blockData));
|
Chest chest = (Chest) blockData;
|
||||||
IBlockData adjacentBlockData = world.getType(adjacentBlockPosition);
|
int ordinal = (chest.getFacing().ordinal() + 4 + (chest.getType() == Chest.Type.RIGHT ? -1 : 1)) % 4;
|
||||||
|
BlockFace relativeFace = BlockFace.values()[ordinal];
|
||||||
|
org.bukkit.block.Block relative = block.getRelative(relativeFace);
|
||||||
|
|
||||||
if (adjacentBlockData.getBlock() == block) {
|
if (relative.getType() != block.getType()) {
|
||||||
|
|
||||||
BlockPropertyChestType adjacentChestType = adjacentBlockData.get(BlockChest.b);
|
|
||||||
|
|
||||||
if (adjacentChestType != BlockPropertyChestType.SINGLE && chestType != adjacentChestType
|
|
||||||
&& adjacentBlockData.get(BlockChest.FACING) == blockData.get(BlockChest.FACING)) {
|
|
||||||
|
|
||||||
return this.isBlockedChest(world, adjacentBlockPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBlockedShulkerBox(final World world, final BlockPosition blockPosition,
|
|
||||||
final IBlockData blockData) {
|
|
||||||
// For reference, look at net.minecraft.server.BlockShulkerBox
|
|
||||||
TileEntity tile = world.getTileEntity(blockPosition);
|
|
||||||
|
|
||||||
if (!(tile instanceof TileEntityShulkerBox)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumDirection enumDirection = blockData.get(BlockShulkerBox.a);
|
BlockData relativeData = relative.getBlockData();
|
||||||
if (((TileEntityShulkerBox) tile).s() == TileEntityShulkerBox.AnimationPhase.CLOSED) {
|
if (!(relativeData instanceof Chest)) {
|
||||||
AxisAlignedBB axisAlignedBB = VoxelShapes.b().getBoundingBox()
|
return false;
|
||||||
.b(0.5F * enumDirection.getAdjacentX(), 0.5F * enumDirection.getAdjacentY(), 0.5F * enumDirection.getAdjacentZ())
|
}
|
||||||
.a(enumDirection.getAdjacentX(), enumDirection.getAdjacentY(), enumDirection.getAdjacentZ());
|
|
||||||
return !world.getCubes(null, axisAlignedBB.a(blockPosition.shift(enumDirection)));
|
Chest relativeChest = (Chest) relativeData;
|
||||||
|
if (relativeChest.getFacing() != chest.getFacing()
|
||||||
|
|| relativeChest.getType() != (chest.getType() == Chest.Type.RIGHT ? Chest.Type.LEFT : Chest.Type.RIGHT)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return isBlockedChest(relative);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBlockedChest(final World world, final BlockPosition blockPosition) {
|
private boolean isBlockedChest(org.bukkit.block.Block block) {
|
||||||
// For reference, loot at net.minecraft.server.BlockChest
|
org.bukkit.block.Block relative = block.getRelative(0, 1, 0);
|
||||||
return world.getType(blockPosition.up()).isOccluding(world, blockPosition) || this.hasOcelotOnTop(world, blockPosition);
|
return relative.getType().isOccluding()
|
||||||
}
|
|| block.getWorld().getNearbyEntities(BoundingBox.of(relative), entity -> entity instanceof Cat).size() > 0;
|
||||||
|
|
||||||
private boolean hasOcelotOnTop(final World world, final BlockPosition blockPosition) {
|
|
||||||
for (Entity entity : world.a(EntityCat.class,
|
|
||||||
new AxisAlignedBB(blockPosition.getX(), blockPosition.getY() + 1,
|
|
||||||
blockPosition.getZ(), blockPosition.getX() + 1, blockPosition.getY() + 2,
|
|
||||||
blockPosition.getZ() + 1))) {
|
|
||||||
EntityCat entityCat = (EntityCat) entity;
|
|
||||||
if (entityCat.isSitting()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -187,7 +179,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
|||||||
|
|
||||||
final World world = player.world;
|
final World world = player.world;
|
||||||
final BlockPosition blockPosition = new BlockPosition(bukkitBlock.getX(), bukkitBlock.getY(), bukkitBlock.getZ());
|
final BlockPosition blockPosition = new BlockPosition(bukkitBlock.getX(), bukkitBlock.getY(), bukkitBlock.getZ());
|
||||||
final Object tile = world.getTileEntity(blockPosition);
|
final TileEntity tile = world.getTileEntity(blockPosition);
|
||||||
|
|
||||||
if (tile == null) {
|
if (tile == null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -232,16 +224,17 @@ public class AnySilentContainer implements IAnySilentContainer {
|
|||||||
if (adjacentTile instanceof TileEntityChest && tileInventory instanceof TileEntityChest) {
|
if (adjacentTile instanceof TileEntityChest && tileInventory instanceof TileEntityChest) {
|
||||||
TileEntityChest rightChest = chestType == BlockPropertyChestType.RIGHT ? ((TileEntityChest) tileInventory) : (TileEntityChest) adjacentTile;
|
TileEntityChest rightChest = chestType == BlockPropertyChestType.RIGHT ? ((TileEntityChest) tileInventory) : (TileEntityChest) adjacentTile;
|
||||||
TileEntityChest leftChest = chestType == BlockPropertyChestType.RIGHT ? (TileEntityChest) adjacentTile : ((TileEntityChest) tileInventory);
|
TileEntityChest leftChest = chestType == BlockPropertyChestType.RIGHT ? (TileEntityChest) adjacentTile : ((TileEntityChest) tileInventory);
|
||||||
|
|
||||||
|
if (rightChest.lootTable != null || leftChest.lootTable != null) {
|
||||||
|
player.a(new ChatMessage("Loot not generated! Please disable /silentcontainer.").a(EnumChatFormat.RED), true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
tileInventory = new ITileInventory() {
|
tileInventory = new ITileInventory() {
|
||||||
@Nullable
|
|
||||||
public Container createMenu(int containerCounter, PlayerInventory playerInventory, EntityHuman entityHuman) {
|
public Container createMenu(int containerCounter, PlayerInventory playerInventory, EntityHuman entityHuman) {
|
||||||
if (leftChest.e(entityHuman) && rightChest.e(entityHuman)) {
|
leftChest.d(playerInventory.player);
|
||||||
leftChest.d(playerInventory.player);
|
rightChest.d(playerInventory.player);
|
||||||
rightChest.d(playerInventory.player);
|
return ContainerChest.b(containerCounter, playerInventory, new InventoryLargeChest(rightChest, leftChest));
|
||||||
return ContainerChest.b(containerCounter, playerInventory, new InventoryLargeChest(rightChest, leftChest));
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IChatBaseComponent getScoreboardDisplayName() {
|
public IChatBaseComponent getScoreboardDisplayName() {
|
||||||
@@ -279,6 +272,14 @@ public class AnySilentContainer implements IAnySilentContainer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tile instanceof TileEntityLootable) {
|
||||||
|
TileEntityLootable lootable = (TileEntityLootable) tile;
|
||||||
|
if (lootable.lootTable != null) {
|
||||||
|
player.a(new ChatMessage("Loot not generated! Please disable /silentcontainer.").a(EnumChatFormat.RED), true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EnumGamemode gamemode = player.playerInteractManager.getGameMode();
|
EnumGamemode gamemode = player.playerInteractManager.getGameMode();
|
||||||
this.forceGameMode(player, EnumGamemode.SPECTATOR);
|
this.forceGameMode(player, EnumGamemode.SPECTATOR);
|
||||||
player.openContainer(tileInventory);
|
player.openContainer(tileInventory);
|
||||||
|
@@ -132,7 +132,22 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||||||
}, nmsPlayer, nmsPlayer.nextContainerCounter()) {
|
}, nmsPlayer, nmsPlayer.nextContainerCounter()) {
|
||||||
@Override
|
@Override
|
||||||
public Containers<?> getType() {
|
public Containers<?> getType() {
|
||||||
return inventory instanceof SpecialEnderChest ? Containers.GENERIC_9X3 : Containers.GENERIC_9X5;
|
switch (inventory.getBukkitInventory().getSize()) {
|
||||||
|
case 9:
|
||||||
|
return Containers.GENERIC_9X1;
|
||||||
|
case 18:
|
||||||
|
return Containers.GENERIC_9X2;
|
||||||
|
case 27:
|
||||||
|
default:
|
||||||
|
return Containers.GENERIC_9X3;
|
||||||
|
case 36:
|
||||||
|
return Containers.GENERIC_9X4;
|
||||||
|
case 41: // PLAYER
|
||||||
|
case 45:
|
||||||
|
return Containers.GENERIC_9X5;
|
||||||
|
case 54:
|
||||||
|
return Containers.GENERIC_9X6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_8_R3</artifactId>
|
<artifactId>openinvadapter1_8_R3</artifactId>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvplugincore</artifactId>
|
<artifactId>openinvplugincore</artifactId>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
|
@@ -5,6 +5,7 @@ author: lishid
|
|||||||
authors: [Jikoo, ShadowRanger]
|
authors: [Jikoo, ShadowRanger]
|
||||||
description: >
|
description: >
|
||||||
This plugin allows you to open a player's inventory as a chest and interact with it in real time.
|
This plugin allows you to open a player's inventory as a chest and interact with it in real time.
|
||||||
|
api-version: "1.13"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
OpenInv.any.default:
|
OpenInv.any.default:
|
||||||
|
2
pom.xml
2
pom.xml
@@ -21,7 +21,7 @@
|
|||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<name>OpenInvParent</name>
|
<name>OpenInvParent</name>
|
||||||
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
|
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
|
||||||
<version>4.0.6-SNAPSHOT</version>
|
<version>4.0.8-SNAPSHOT</version>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user