WorldEdit

WorldEdit

43M Downloads

Unsafe ServerPlayer cast, causes crash with mods

MehVahdJukaar opened this issue ยท 2 comments

commented

WorldEdit Version

7.2.15

Platform Version

forge

Confirmations

  • I am using the most recent Minecraft release.
  • I am using a version of WorldEdit compatible with my Minecraft version.
  • I am using the latest or recommended version of my platform software.
  • I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
  • I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)

Bug Description

Bug happens on a server with just world edit and 4 other mods.
Issue is in ForgeWorldEdit class in onPlayerInteract.

Latest.log snippet:

java.lang.ClassCastException: class net.mehvahdjukaar.moonlight.core.fake_player.FakeGenericPlayer cannot be cast to class net.minecraft.server.level.ServerPlayer (net.mehvahdjukaar.moonlight.core.fake_player.FakeGenericPlayer is in module [email protected] of loader 'TRANSFORMER' @64da6cbd; net.minecraft.server.level.ServerPlayer is in module [email protected] of loader 'TRANSFORMER' @64da6cbd)
	at TRANSFORMER/[email protected]+6463-5ca4dff/com.sk89q.worldedit.forge.ForgeWorldEdit.onPlayerInteract(ForgeWorldEdit.java:288)
	at TRANSFORMER/[email protected]+6463-5ca4dff/com.sk89q.worldedit.forge.__ForgeWorldEdit_onPlayerInteract_PlayerInteractEvent.invoke(.dynamic)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
	at TRANSFORMER/[email protected]/net.minecraftforge.common.ForgeHooks.onItemRightClick(ForgeHooks.java:750)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.forge.SuppPlatformStuffImpl.fireItemUseEvent(SuppPlatformStuffImpl.java:164)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.SuppPlatformStuff.fireItemUseEvent(SuppPlatformStuff.java)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.common.block.fire_behaviors.GenericProjectileBehavior.createEntity(GenericProjectileBehavior.java:108)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.common.block.fire_behaviors.GenericProjectileBehavior.calculateData(GenericProjectileBehavior.java:35)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.common.block.fire_behaviors.IBallisticBehavior.fire(IBallisticBehavior.java:23)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.common.block.fire_behaviors.AlternativeBehavior.fire(AlternativeBehavior.java:15)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.common.block.fire_behaviors.IFireItemBehavior.fire(IFireItemBehavior.java:17)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.common.block.tiles.CannonBlockTile.shootProjectile(CannonBlockTile.java:344)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.common.block.tiles.CannonBlockTile.fire(CannonBlockTile.java:317)
	at TRANSFORMER/[email protected]/net.mehvahdjukaar.supplementaries.common.block.tiles.CannonBlockTile.tick(CannonBlockTile.java:305)
	at TRANSFORMER/[email protected]/net.minecraft.world.level.chunk.LevelChunk$BoundTickingBlockEntity.m_142224_(LevelChunk.java:689)
	at TRANSFORMER/[email protected]/net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper.m_142224_(LevelChunk.java:782)
	at TRANSFORMER/[email protected]/net.minecraft.world.level.Level.m_46463_(Level.java:468)
	at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:351)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:893)

Expected Behavior

Not crashing

Reproduction Steps

Pass a fake player to on item use forge event ForgeHooks.onItemRightClick

Anything Else?

Apologies if this is the wrong repo. There are many forks i hope i got the right one. I checked the new neoforge classes and i dont see an issue there

commented

We don't support older versions, if there's no issue in the new version we won't do anything.

commented

Alright I'll mark supplementaries as incompatible then