Merge branch 'master' into 1.17

# Conflicts:
#	src/main/java/carpet/CarpetSettings.java
This commit is contained in:
gnembon committed 2021-02-24 20:41:06 -04:00
commit 3505138351
3 files changed
+24 -3

No files matched your search

+10 -2
View File
@@ -52,6 +52,7 @@ public class CarpetSettings
public static boolean doChainStone = false;
public static boolean chainStoneStickToAll = false;
public static Block structureBlockIgnoredBlock = Blocks.STRUCTURE_VOID;
public static final int vanillaStructureBlockLimit = 48;
private static class LanguageValidator extends Validator<String> {
@Override public String validate(ServerCommandSource source, ParsedRule<String> currentRule, String newValue, String string) {
@@ -806,7 +807,7 @@ public class CarpetSettings
public static class StructureBlockLimitValidator extends Validator<Integer> {
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string) {
return (newValue >= 48) ? newValue : null;
return (newValue >= vanillaStructureBlockLimit) ? newValue : null;
}
@Override
@@ -827,7 +828,7 @@ public class CarpetSettings
validate = StructureBlockLimitValidator.class,
strict = false
)
public static int structureBlockLimit = 48;
public static int structureBlockLimit = vanillaStructureBlockLimit;
public static class StructureBlockIgnoredValidator extends Validator<String> {
@@ -860,4 +861,11 @@ public class CarpetSettings
validate = Validator.NONNEGATIVE_NUMBER.class
)
public static int structureBlockOutlineDistance = 96;
@Rule(
desc = "Lightning kills the items that drop when lightning kills an entity",
extra = {"Setting to true 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.EntityType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LightningEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -29,6 +31,17 @@ public abstract class ItemEntityMixin extends Entity implements ItemEntityInterf
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
public int getAgeCM() {
return this.age;
@@ -38,7 +38,7 @@ public class UpdateStructureBlockC2SPacketMixin {
)
private void structureBlockLimitsWrite(PacketByteBuf buf, CallbackInfo ci) {
//client method, only applicable if with carpet is on the server, or running locally
if (CarpetSettings.structureBlockLimit >= 128)
if (CarpetSettings.structureBlockLimit != CarpetSettings.vanillaStructureBlockLimit)
{
buf.writeInt(this.offset.getX());
buf.writeInt(this.offset.getY());