Skip to content

Commit

Permalink
Small block fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaHelios committed Jan 2, 2025
1 parent 68b9541 commit 518b7b5
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.block.ShapeContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPlacementContext;
Expand Down Expand Up @@ -43,7 +44,7 @@ public Item getItem()
* Returns the entity type corresponding with the block
* Needs to be overwritten
*/
public <T extends GrenadeEntity> EntityType<T> getEntity()
public EntityType<? extends GrenadeEntity> getEntity()
{
return null;
}
Expand Down Expand Up @@ -167,15 +168,15 @@ public int calculatePower(int grenadeCount)

public void explode(World world, BlockPos blockPos, float explosionPower)
{
var tde = new GrenadeEntity(getEntity(), world);
tde.setExplosionPower(explosionPower);
tde.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
tde.setPrimed(true);
tde.setLife(0);
var grenade = getEntity().create(world, SpawnReason.EVENT);
grenade.setExplosionPower(explosionPower);
grenade.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
grenade.setPrimed(true);
grenade.setLife(0);

world.setBlockState(blockPos, Blocks.AIR.getDefaultState());

world.spawnEntity(tde);
world.spawnEntity(grenade);
}

@Override
Expand Down

0 comments on commit 518b7b5

Please sign in to comment.