SpongePowered / Sponge

The SpongeAPI implementation targeting vanilla Minecraft and 3rd party platforms.
MIT License
390 stars 211 forks source link

CooldownTracker doesn't exist #3722

Closed MrHell228 closed 11 months ago

MrHell228 commented 2 years ago

Affected Product(s)

SpongeForge

Version

1.16.5-36.2.5-8.1.0-RC1153

Operating System

Windows

Java Version

11

Plugins/Mods

Just my plugin

Describe the bug

This code

ItemType itemType = ...;
ServerPlayer player = ...l
player.cooldownTracker().setCooldown(itemType, Ticks.of(20))

Causes this error

java.lang.ClassCastException: class net.minecraft.util.ServerCooldownTracker cannot be cast to class org.spongepowered.common.bridge.world.item.ItemCooldownsBridge (net.minecraft.util.ServerCooldownTracker and org.spongepowered.common.bridge.world.item.ItemCooldownsBridge are in unnamed module of loader cpw.mods.modlauncher.TransformingClassLoader @63f9b562)
    at net.minecraft.util.CooldownTracker.setCooldown(SourceFile:579) ~[?:?]
    at org.spongepowered.common.event.listener.StartListener_Events_shieldAndOther11.handle(Unknown Source) ~[?:?]
    at org.spongepowered.common.event.manager.RegisteredListener.handle(RegisteredListener.java:88) ~[spongeforge:1.16.5-36.2.5-8.1.0-RC1153]
    at org.spongepowered.common.event.manager.SpongeEventManager.post(SpongeEventManager.java:390) ~[spongeforge:1.16.5-36.2.5-8.1.0-RC1153]
    at org.spongepowered.common.event.manager.SpongeEventManager.post(SpongeEventManager.java:417) ~[spongeforge:1.16.5-36.2.5-8.1.0-RC1153]
    at org.spongepowered.forge.launch.event.ForgeEventManager.post(ForgeEventManager.java:146) ~[spongeforge:1.16.5-36.2.5-8.1.0-RC1153]
    at org.spongepowered.common.SpongeCommon.post(SpongeCommon.java:117) ~[spongeforge:1.16.5-36.2.5-8.1.0-RC1153]
    at net.minecraft.entity.LivingEntity.handler$zic000$impl$onSetActiveItemStack(LivingEntity.java:8242) ~[?:?]
    at net.minecraft.entity.LivingEntity.func_184598_c(LivingEntity.java:2766) ~[?:?]
    at net.minecraft.item.ShieldItem.func_77659_a(SourceFile:53) ~[?:?]
    at net.minecraft.item.ItemStack.func_77957_a(ItemStack.java:217) ~[?:?]
    at net.minecraft.server.management.PlayerInteractionManager.func_187250_a(PlayerInteractionManager.java:287) ~[?:?]
    at net.minecraft.network.play.ServerPlayNetHandler.redirect$zze000$impl$onHandleUseItem(ServerPlayNetHandler.java:1595) ~[?:?]
    at net.minecraft.network.play.ServerPlayNetHandler.func_147346_a(ServerPlayNetHandler.java:982) ~[?:?]
    at net.minecraft.network.play.client.CPlayerTryUseItemPacket.func_148833_a(SourceFile:31) ~[?:?]
    at net.minecraft.network.play.client.CPlayerTryUseItemPacket.func_148833_a(SourceFile:9) ~[?:?]
    at org.spongepowered.common.event.tracking.phase.packet.PacketPhaseUtil.onProcessPacket(PacketPhaseUtil.java:262) ~[spongeforge:1.16.5-36.2.5-8.1.0-RC1153]
    at net.minecraft.network.PacketThreadUtil.md4306c6$lambda$tracker$redirectProcessPacket$0$0(SourceFile:552) ~[?:?]
    at net.minecraft.util.concurrent.TickDelayedTask.run(SourceFile:18) ~[?:?]
    at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144) ~[?:?]
    at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) ~[?:?]
    at net.minecraft.server.MinecraftServer.redirect$zca000$tracker$wrapAndPerformContextSwitch(MinecraftServer.java:4315) ~[?:?]
    at net.minecraft.server.MinecraftServer.func_213166_h(MinecraftServer.java:734) ~[?:?]
    at net.minecraft.server.MinecraftServer.func_213166_h(MinecraftServer.java:159) ~[?:?]
    at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118) ~[?:?]
    at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:717) ~[?:?]
    at net.minecraft.server.MinecraftServer.func_213168_p(MinecraftServer.java:711) ~[?:?]
    at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213161_c(SourceFile:127) ~[?:?]
    at net.minecraft.server.MinecraftServer.func_213202_o(MinecraftServer.java:697) ~[?:?]
    at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:646) ~[?:?]
    at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) ~[?:?]

Link to logs

No response

Yeregorix commented 2 years ago

Probably fixed by e5b76b6.