fabric inventory stuff

This commit is contained in:
dfsek
2021-02-24 23:46:43 -07:00
parent 4a47815be7
commit 4ca2f0c08d
14 changed files with 153 additions and 53 deletions

View File

@@ -15,4 +15,8 @@ public class BukkitContainer extends BukkitBlockState implements Container {
return new BukkitInventory(((org.bukkit.block.Container) getHandle()).getInventory());
}
@Override
public boolean update(boolean applyPhysics) {
return false; // This clears the inventory. we don't want that.
}
}

View File

@@ -6,7 +6,7 @@ import com.dfsek.terra.api.platform.inventory.item.ItemMeta;
import com.dfsek.terra.bukkit.world.BukkitAdapter;
public class BukkitItemStack implements ItemStack {
private org.bukkit.inventory.ItemStack delegate;
private final org.bukkit.inventory.ItemStack delegate;
public BukkitItemStack(org.bukkit.inventory.ItemStack delegate) {
this.delegate = delegate;
@@ -27,18 +27,6 @@ public class BukkitItemStack implements ItemStack {
return BukkitAdapter.adapt(delegate.getType());
}
@Override
public ItemStack clone() {
BukkitItemStack clone;
try {
clone = (BukkitItemStack) super.clone();
clone.delegate = delegate.clone();
} catch(CloneNotSupportedException e) {
throw new Error(e);
}
return clone;
}
@Override
public ItemMeta getItemMeta() {
return BukkitItemMeta.newInstance(delegate.getItemMeta());