Compare commits

...

8 Commits
4.0.3 ... 4.0.5

Author SHA1 Message Date
Jikoo
ec07637e9f Bump version to 4.0.6-SNAPSHOT for development 2019-07-19 16:26:24 -04:00
Jikoo
b269f3509c Bump version to 4.0.5 for release 2019-07-19 16:26:03 -04:00
Jikoo
f2e4c8a3ad Fix barrel triggering AnyContainer (#108) 2019-07-19 16:24:58 -04:00
Jikoo
35839f1548 Bump version to 4.0.5-SNAPSHOT for development 2019-07-19 07:21:37 -04:00
Jikoo
a4a462a1fa Bump version to 4.0.4 for release 2019-07-19 07:21:16 -04:00
Jikoo
b9f901af66 Add silent barrels - fixes #106 2019-07-19 07:18:23 -04:00
Jikoo
1333056613 Correct item order - fixes #107 2019-07-19 07:13:11 -04:00
Jikoo
fb23df313a Bump version to 4.0.4-SNAPSHOT for development 2019-05-27 20:53:44 -04:00
11 changed files with 49 additions and 21 deletions

View File

@@ -21,7 +21,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</parent>
<artifactId>openinvapi</artifactId>

View File

@@ -21,7 +21,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</parent>
<artifactId>openinvassembly</artifactId>

View File

@@ -21,7 +21,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</parent>
<artifactId>openinvcommon</artifactId>
@@ -31,7 +31,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvapi</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>

View File

@@ -20,7 +20,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</parent>
<artifactId>openinvinternal</artifactId>

View File

@@ -21,7 +21,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_13_R2</artifactId>
@@ -37,7 +37,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -22,7 +22,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_14_R1</artifactId>
@@ -32,13 +32,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.14.2-R0.1-SNAPSHOT</version>
<version>1.14.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -21,6 +21,7 @@ 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.BlockBarrel;
import net.minecraft.server.v1_14_R1.BlockChest;
import net.minecraft.server.v1_14_R1.BlockChestTrapped;
import net.minecraft.server.v1_14_R1.BlockEnderChest;
@@ -78,11 +79,16 @@ public class AnySilentContainer implements IAnySilentContainer {
}
BlockState state = bukkitBlock.getState();
return state instanceof org.bukkit.block.Chest
|| state instanceof org.bukkit.block.ShulkerBox;
|| state instanceof org.bukkit.block.ShulkerBox
|| state instanceof org.bukkit.block.Barrel;
}
@Override
public boolean isAnyContainerNeeded(@NotNull final Player p, @NotNull final org.bukkit.block.Block bukkitBlock) {
if (bukkitBlock.getType() == Material.BARREL) {
return false;
}
EntityPlayer player = PlayerDataManager.getHandle(p);
World world = player.world;
BlockPosition blockPosition = new BlockPosition(bukkitBlock.getX(), bukkitBlock.getY(), bukkitBlock.getZ());
@@ -258,6 +264,10 @@ public class AnySilentContainer implements IAnySilentContainer {
bukkitPlayer.incrementStatistic(Statistic.SHULKER_BOX_OPENED);
}
if (block instanceof BlockBarrel) {
bukkitPlayer.incrementStatistic(Statistic.OPEN_BARREL);
}
// AnyChest only - SilentChest not active, container unsupported, or unnecessary.
if (!silentchest || player.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR) {
player.openContainer(tileInventory);
@@ -287,6 +297,7 @@ public class AnySilentContainer implements IAnySilentContainer {
case CHEST:
case ENDER_CHEST:
case SHULKER_BOX:
case BARREL:
break;
default:
return;

View File

@@ -57,7 +57,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
private boolean playerOnline;
private EntityHuman player;
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) {
super(PlayerDataManager.getHandle(bukkitPlayer));
@@ -76,10 +76,14 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
EntityPlayer entityPlayer = PlayerDataManager.getHandle(player);
entityPlayer.inventory.transaction.addAll(this.transaction);
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.armor = this.player.inventory.armor;
this.extraSlots = this.player.inventory.extraSlots;
this.f = ImmutableList.of(this.items, this.armor, this.extraSlots);
this.playerOnline = true;
}
}
@@ -119,6 +123,19 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
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
public IChatBaseComponent getDisplayName() {
return new ChatMessage(this.player.getName());

View File

@@ -21,7 +21,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_8_R3</artifactId>
@@ -37,7 +37,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -21,7 +21,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</parent>
<artifactId>openinvplugincore</artifactId>
@@ -31,7 +31,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>

View File

@@ -21,7 +21,7 @@
<artifactId>openinvparent</artifactId>
<name>OpenInvParent</name>
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
<version>4.0.3</version>
<version>4.0.6-SNAPSHOT</version>
<packaging>pom</packaging>