Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Java by registered user Gadse ( 4 years ago )
import net.minecraft.server.v1_16_R3.*;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class Wrapper1_16_R3 {
private int getRealNextContainerId(Player player) {
return toNMS(player).nextContainerCounter();
}
public int getNextContainerId(Object container) {
return ((LecternContainer) container).getContainerId();
}
public void handleInventoryCloseEvent(Player player) {
CraftEventFactory.handleInventoryCloseEvent(toNMS(player));
}
public void sendPacketOpenWindow(Player player, int containerId, String guiTitle) {
toNMS(player).playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerId, Containers.LECTERN, new ChatMessage(guiTitle)));
}
public void sendPacketCloseWindow(Player player, int containerId) {
toNMS(player).playerConnection.sendPacket(new PacketPlayOutCloseWindow(containerId));
}
public void setActiveContainerDefault(Player player) {
toNMS(player).activeContainer = toNMS(player).defaultContainer;
}
public void setActiveContainer(Player player, Object container) {
toNMS(player).activeContainer = (Container) container;
}
public void addActiveContainerSlotListener(Object container, Player player) {
((Container) container).addSlotListener(toNMS(player));
}
public void setPage(Object container, int page) {
((ContainerLectern) container).a(0, page);
}
public Inventory toBukkitInventory(Object container) {
return ((Container) container).getBukkitView().getTopInventory();
}
public LecternContainer newContainerLectern(Player player, ItemStack bookItem) {
return new LecternContainer(player, bookItem);
}
private EntityPlayer toNMS(Player player) {
return ((CraftPlayer) player).getHandle();
}
private class LecternContainer extends ContainerLectern {
public LecternContainer(Player player, ItemStack bookItem) {
super(getRealNextContainerId(player), toNMS(player).inventory);
this.checkReachable = false;
setItem(0, CraftItemStack.asNMSCopy(bookItem));
}
@Override
public void b(EntityHuman entityhuman) {}
@Override
protected void a(EntityHuman entityhuman, World world, IInventory iinventory) {}
public int getContainerId() {
return windowId;
}
}
}
Revise this Paste