Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minecraft 1.6.1 incompatibility? #5

Closed
oloflarsson opened this issue Jul 2, 2013 · 3 comments
Closed

Minecraft 1.6.1 incompatibility? #5

oloflarsson opened this issue Jul 2, 2013 · 3 comments
Labels

Comments

@oloflarsson
Copy link

I am using Spigot #979 and ProtocolLib #88
You previously helped me with this piece of source code:
https://github.com/MassiveCraft/mcore/blob/master/src/com/massivecraft/mcore/integration/protocollib/EntityPotionColorPacketAdapter.java#L70

Looking at http://wiki.vg/Protocol_History I see no changes to the entity metadata packet.

Does this error imply protocol lib is not yet compatible with 1.6.1?:

11:47:12 [INFO] Cayorion[/127.0.0.1:54569] logged in with entity id 0 at ([regalia] -233.6768976721056, 72.0, 773.0377111100919)
11:47:13 [INFO] Caught java.lang.ClassCastException exception in EntityPotionColorPacketAdapter#onPacketSending
11:47:13 [INFO] Message: java.lang.Byte cannot be cast to java.lang.Integer
11:47:13 [INFO] Stack Trace:
11:47:13 [SEVERE] java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.Integer
11:47:13 [SEVERE] at com.massivecraft.mcore.integration.protocollib.EntityPotionColorPacketAdapter.onPacketSending(EntityPotionColorPacketAdapter.java:70)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:113)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:495)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:475)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.spigot.SpigotPacketInjector.packetQueued(SpigotPacketInjector.java:400)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.spigot.SpigotPacketInjector.packetQueued(SpigotPacketInjector.java:380)
11:47:13 [SEVERE] at com.comphenix.protocol.injector.spigot.SpigotPacketInjector$2.intercept(SpigotPacketInjector.java:172)
11:47:13 [SEVERE] at org.spigotmc.netty.PacketListener$$EnhancerByCGLIB$$65c16b2d.packetQueued()
11:47:13 [SEVERE] at org.spigotmc.netty.PacketListener.callQueued(PacketListener.java:73)
11:47:13 [SEVERE] at org.spigotmc.netty.NettyNetworkManager.queue0(NettyNetworkManager.java:192)
11:47:13 [SEVERE] at org.spigotmc.netty.NettyNetworkManager.access$000(NettyNetworkManager.java:34)
11:47:13 [SEVERE] at org.spigotmc.netty.NettyNetworkManager$3.run(NettyNetworkManager.java:182)
11:47:13 [SEVERE] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:353)
11:47:13 [SEVERE] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:365)
11:47:13 [SEVERE] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
11:47:13 [SEVERE] at java.lang.Thread.run(Unknown Source)

@aadnk
Copy link
Owner

aadnk commented Jul 2, 2013

Looks like the potion effect color (index 8) and the hide potion effects (index 9) is one less each in 1.6.1:

if (this.updateEffects) {
  if (!this.world.isStatic) {
    if (this.effects.isEmpty()) {
      this.datawatcher.watch(8, Byte.valueOf((byte)0));
      this.datawatcher.watch(7, Integer.valueOf(0));
      setInvisible(false);
    } else {
      int i = PotionBrewer.a(this.effects.values());
      this.datawatcher.watch(8, Byte.valueOf((byte)(PotionBrewer.b(this.effects.values()) ? 1 : 0)));
      this.datawatcher.watch(7, Integer.valueOf(i));
      setInvisible(hasEffect(MobEffectList.INVISIBILITY.id));
    }
  }

  this.updateEffects = false;
}

And here's 1.5.2 (taken from EntityLiving.java):

if (this.updateEffects) {
  if (!this.world.isStatic) {
    if (this.effects.isEmpty()) {
      this.datawatcher.watch(9, Byte.valueOf((byte)0));
      this.datawatcher.watch(8, Integer.valueOf(0));
      setInvisible(false);
    } else {
      int i = PotionBrewer.a(this.effects.values());
      this.datawatcher.watch(9, Byte.valueOf((byte)(PotionBrewer.b(this.effects.values()) ? 1 : 0)));
      this.datawatcher.watch(8, Integer.valueOf(i));
      setInvisible(hasEffect(MobEffectList.INVISIBILITY.id));
    }
  }

  this.updateEffects = false;
}

So - potion effect is now 7 in 1.6.1, not 8 as in 1.5.2 and earlier.

You can simply change the index and leave it at that. But if you need, you could check the server version first, and look up the correct index that way.

@oloflarsson
Copy link
Author

Thanks man :)

@aadnk
Copy link
Owner

aadnk commented Jul 3, 2013

By the way, I just created a Jenkins build project for MCore, since people were waiting for BukkitDev to approve it. I hope you don't mind - I can remove it if it's a problem.

dmulloy2 added a commit that referenced this issue Nov 29, 2014
Fix EnumWrappers referencing a changed packet
Thanks @Minecrell!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants