Added Rule lightningKillsDrops
Which fixes [MC-206922](https://bugs.mojang.com/browse/MC-206922)
This commit is contained in:
1 parent
edd203a1f8
commit
680916880e
2 files changed
+20
No files matched your search
@@ -856,4 +856,11 @@ public class CarpetSettings
|
|||||||
validate = Validator.NONNEGATIVE_NUMBER.class
|
validate = Validator.NONNEGATIVE_NUMBER.class
|
||||||
)
|
)
|
||||||
public static double structureBlockOutlineDistance = 96d;
|
public static double structureBlockOutlineDistance = 96d;
|
||||||
|
|
||||||
|
@Rule(
|
||||||
|
desc = "Lightning kills the items that drop when lightning kills an entity",
|
||||||
|
extra = {"Setting to false will prevent lightning from killing drops", "Fixes (https://bugs.mojang.com/browse/MC-195640)."},
|
||||||
|
category = {BUGFIX}
|
||||||
|
)
|
||||||
|
public static boolean lightningKillsDropsFix = false;
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,10 @@ import net.minecraft.block.ShulkerBoxBlock;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.ItemEntity;
|
import net.minecraft.entity.ItemEntity;
|
||||||
|
import net.minecraft.entity.LightningEntity;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -29,6 +31,17 @@ public abstract class ItemEntityMixin extends Entity implements ItemEntityInterf
|
|||||||
super(entityType_1, world_1);
|
super(entityType_1, world_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStruckByLightning(ServerWorld world, LightningEntity lightning) {
|
||||||
|
if (CarpetSettings.lightningKillsDropsFix) {
|
||||||
|
if (this.age > 8) { //Only kill item if its older then 8 ticks
|
||||||
|
super.onStruckByLightning(world, lightning);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.onStruckByLightning(world, lightning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAgeCM() {
|
public int getAgeCM() {
|
||||||
return this.age;
|
return this.age;
|
||||||
|
|||||||
Reference in new issue
Block a user