mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fixed zap blocks destroying item drops
This commit is contained in:
parent
adb07cc586
commit
6fd124ed81
1 changed files with 4 additions and 0 deletions
|
@ -5,6 +5,7 @@ import com.minelittlepony.unicopia.particle.LightningBoltParticleEffect;
|
||||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.entity.LightningEntity;
|
import net.minecraft.entity.LightningEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
@ -66,6 +67,9 @@ public class ZapBlock extends Block {
|
||||||
Vec3d center = Vec3d.ofCenter(pos);
|
Vec3d center = Vec3d.ofCenter(pos);
|
||||||
LightningEntity lightning = EntityType.LIGHTNING_BOLT.create(world);
|
LightningEntity lightning = EntityType.LIGHTNING_BOLT.create(world);
|
||||||
world.getOtherEntities(null, Box.from(center).expand(7)).forEach(other -> {
|
world.getOtherEntities(null, Box.from(center).expand(7)).forEach(other -> {
|
||||||
|
if (other instanceof ItemEntity) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
float dist = (float)other.getPos().distanceTo(center);
|
float dist = (float)other.getPos().distanceTo(center);
|
||||||
if (dist < 4) {
|
if (dist < 4) {
|
||||||
other.onStruckByLightning(serverWorld, lightning);
|
other.onStruckByLightning(serverWorld, lightning);
|
||||||
|
|
Loading…
Reference in a new issue