Spawning an entity on wool creates game event
Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically, [^2022-01-03 17-23-48.mp4] but in reverse
Also, it's obvious that there is no occlusion check in the code...
Code Analysis - Yarn 22w05a
SpawnEggItem.java
public ActionResult useOnBlock(ItemUsageContext context) { World world = context.getWorld(); if (!(world instanceof ServerWorld)) return ActionResult.SUCCESS; ItemStack itemStack = context.getStack(); BlockPos blockPos = context.getBlockPos(); Direction direction = context.getSide(); //... EntityType<?> entityType2 = this.getEntityType(itemStack.getNbt()); if (entityType2.spawnFromItemStack( (ServerWorld)world, itemStack, context.getPlayer(), blockPos2, SpawnReason.SPAWN_EGG, true, !Objects.equals(blockPos, blockPos2) && direction == Direction.UP ) != null) { itemStack.decrement(1); world.emitGameEvent(context.getPlayer(), GameEvent.ENTITY_PLACE, blockPos); //Game Event called here } return ActionResult.CONSUME; }
As you can see in the code analysis, the game event is called without first checking the block below to see if its occluding
Created Issue:
Spawning an entity on wool creates game event
Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically do this but in reverseAlso, it's obvious that there is no occlusion check in the code...
Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically do this but in reverseAlso, it's obvious that there is no occlusion check in the code...
Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically, [^2022-01-03 17-23-48.mp4] but in reverseAlso, it's obvious that there is no occlusion check in the code...
Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically, [^2022-01-03 17-23-48.mp4]but in reverseAlso, it's obvious that there is no occlusion check in the code...
Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically, this video but in reverseAlso, it's obvious that there is no occlusion check in the code...
Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically, this videobut in reverseA
lso, it's obvious that there is no occlusioncheckin thecode...Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically, [^2022-01-03 17-23-48.mp4] but in reverseAlso, it's obvious that there is no occlusion check in the code...
Code Analysis - Yarn 22w05a
public ActionResult useOnBlock(ItemUsageContext context) { World world = context.getWorld(); if (!(world instanceof ServerWorld)) return ActionResult.SUCCESS; ItemStack itemStack = context.getStack(); BlockPos blockPos = context.getBlockPos(); Direction direction = context.getSide(); //... EntityType<?> entityType2 = this.getEntityType(itemStack.getNbt()); if (entityType2.spawnFromItemStack( (ServerWorld)world, itemStack, context.getPlayer(), blockPos2, SpawnReason.SPAWN_EGG, true, !Objects.equals(blockPos, blockPos2) && direction == Direction.UP ) != null) { itemStack.decrement(1); world.emitGameEvent(context.getPlayer(), GameEvent.ENTITY_PLACE, blockPos); //Game Event called here } return ActionResult.CONSUME; }As you can see in the code analysis, the game event is called without first checking the block below to see if its occluding
Spawning an entity on wool should not create a game event.
Currently, this bug is harder to notice due to this bug, which does not offset the game event location. Although a game event is still made.
Steps to recreate:
1. Place a wool block on the floor
2. Place a block 1 higher and to the side
3. Use a spawn egg against that block, notice it does not occlude
Basically, [^2022-01-03 17-23-48.mp4] but in reverseAlso, it's obvious that there is no occlusion check in the code...
Code Analysis - Yarn 22w05a
SpawnEggItem.javapublic ActionResult useOnBlock(ItemUsageContext context) { World world = context.getWorld(); if (!(world instanceof ServerWorld)) return ActionResult.SUCCESS; ItemStack itemStack = context.getStack(); BlockPos blockPos = context.getBlockPos(); Direction direction = context.getSide(); //... EntityType<?> entityType2 = this.getEntityType(itemStack.getNbt()); if (entityType2.spawnFromItemStack( (ServerWorld)world, itemStack, context.getPlayer(), blockPos2, SpawnReason.SPAWN_EGG, true, !Objects.equals(blockPos, blockPos2) && direction == Direction.UP ) != null) { itemStack.decrement(1); world.emitGameEvent(context.getPlayer(), GameEvent.ENTITY_PLACE, blockPos); //Game Event called here } return ActionResult.CONSUME; }As you can see in the code analysis, the game event is called without first checking the block below to see if its occluding
Can you provide the code analysis of this?
While sculk sensors have a concept of occlusion, game events are a generic system and events are supposed to be emitted regardless. If there are in-game problems with the sensors. please post a bug about the player-facing effects.