Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MoriyaShiine committed Oct 18, 2024
1 parent 4e8a161 commit 1dd348e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/ladysnake/blast/common/entity/BombEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ protected Item getDefaultItem() {
return BlastItems.BOMB;
}

@Override
public void setItem(ItemStack item) {
super.setItem(item.getItem().getDefaultStack());
setFuse(item.getOrDefault(BlastComponentTypes.FUSE, getFuse()));
setExplosionRadius(item.getOrDefault(BlastComponentTypes.EXPLOSION_RADIUS, getExplosionRadius()));
}

@Override
protected void onCollision(HitResult hitResult) {
if (age > 1) {
Expand Down Expand Up @@ -120,8 +127,8 @@ public void explode() {
CustomExplosion explosion = getExplosion();
explosion.collectBlocksAndDamageEntities();
explosion.affectWorld(true);
if (!getWorld().isClient()) {
for (ServerPlayerEntity player : PlayerLookup.world((ServerWorld) getWorld())) {
if (getWorld() instanceof ServerWorld serverWorld) {
for (ServerPlayerEntity player : PlayerLookup.world(serverWorld)) {
if (player.squaredDistanceTo(getX(), getY(), getZ()) < 4096) {
player.networkHandler.sendPacket(new ExplosionS2CPacket(getX(), getY(), getZ(), explosion.getPower(), explosion.getAffectedBlocks(), explosion.getAffectedPlayers().get(player), explosion.getDestructionType(), explosion.getParticle(), explosion.getEmitterParticle(), explosion.getSoundEvent()));
}
Expand Down Expand Up @@ -163,13 +170,6 @@ public void setExplosionRadius(float explosionRadius) {
this.explosionRadius = explosionRadius;
}

@Override
public void setItem(ItemStack item) {
super.setItem(item.getItem().getDefaultStack());
setFuse(item.getOrDefault(BlastComponentTypes.FUSE, getFuse()));
setExplosionRadius(item.getOrDefault(BlastComponentTypes.EXPLOSION_RADIUS, getExplosionRadius()));
}

public enum BombTriggerType {
FUSE,
IMPACT
Expand Down

0 comments on commit 1dd348e

Please sign in to comment.