Make InvContainerItemProvider

This commit is contained in:
mmxw11 2017-09-24 21:35:38 +03:00
parent ce219e208c
commit 343e316e4c
4 changed files with 36 additions and 0 deletions

View File

@ -1,10 +1,12 @@
package us.myles.ViaVersion.bukkit.platform;
import lombok.AllArgsConstructor;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import us.myles.ViaVersion.ViaVersionPlugin;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
@ -12,9 +14,11 @@ import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.platform.ViaPlatformLoader;
import us.myles.ViaVersion.bukkit.listeners.UpdateListener;
import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.*;
import us.myles.ViaVersion.bukkit.providers.BukkitInvContainerItemProvider;
import us.myles.ViaVersion.bukkit.providers.BukkitViaBulkChunkTranslator;
import us.myles.ViaVersion.bukkit.providers.BukkitViaMovementTransmitter;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InvContainerItemProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
@ -60,6 +64,7 @@ public class BukkitViaLoader implements ViaPlatformLoader {
/* Providers */
Via.getManager().getProviders().use(BulkChunkTranslatorProvider.class, new BukkitViaBulkChunkTranslator());
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BukkitViaMovementTransmitter());
Via.getManager().getProviders().use(InvContainerItemProvider.class, new BukkitInvContainerItemProvider());
Via.getManager().getProviders().use(HandItemProvider.class, new HandItemProvider() {
@Override
public Item getHandItem(final UserConnection info) {

View File

@ -0,0 +1,13 @@
package us.myles.ViaVersion.bukkit.providers;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InvContainerItemProvider;
public class BukkitInvContainerItemProvider extends InvContainerItemProvider {
@Override
public boolean registerInvClickPacket(int windowId, short slotId, byte button, short amumber, int mode, UserConnection uconnection) {
// TODO: lets add some stuff here :)
return true;
}
}

View File

@ -12,6 +12,7 @@ import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_12Types;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.platform.providers.ViaProviders;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
@ -19,6 +20,7 @@ import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.version.Types1_12;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers.InvContainerItemProvider;
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
@ -384,6 +386,11 @@ public class Protocol1_12To1_11_1 extends Protocol {
newId += 3;
return newId;
}
@Override
protected void register(ViaProviders providers) {
providers.register(InvContainerItemProvider.class, new InvContainerItemProvider());
}
@Override
public void init(UserConnection userConnection) {

View File

@ -0,0 +1,11 @@
package us.myles.ViaVersion.protocols.protocol1_12to1_11_1.providers;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.platform.providers.Provider;
public class InvContainerItemProvider implements Provider {
public boolean registerInvClickPacket(int windowId, short slotId, byte button, short amumber, int mode, UserConnection uconnection) {
return false; // not supported :/ plays very sad violin
}
}