mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
more patches
This commit is contained in:
@@ -0,0 +1,210 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Wed, 30 Sep 2020 14:32:46 -0700
|
||||
Subject: [PATCH] Persistent TileEntity Lore and DisplayName
|
||||
|
||||
Makes it so that when a TileEntity is placed in the world and then broken,
|
||||
the dropped ItemStack retains any original custom display name/lore.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 44b28773fe8e79931e738d493bd9405e0ee3dca9..d9114ee2ef4f1dee7ae018f932a7804a61a90ef6 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -133,7 +133,24 @@ public class BlockItem extends Item {
|
||||
}
|
||||
|
||||
protected boolean updateCustomBlockEntityTag(BlockPos pos, Level world, @Nullable Player player, ItemStack stack, BlockState state) {
|
||||
- return BlockItem.updateCustomBlockEntityTag(world, player, pos, stack);
|
||||
+ // Purpur start
|
||||
+ boolean handled = updateCustomBlockEntityTag(world, player, pos, stack);
|
||||
+ if (world.purpurConfig.persistentTileEntityDisplayNames && stack.hasTag()) {
|
||||
+ CompoundTag display = stack.getTagElement("display");
|
||||
+ if (display != null) {
|
||||
+ BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
+ if (blockEntity != null) {
|
||||
+ if (display.contains("Name", 8)) {
|
||||
+ blockEntity.setPersistentDisplayName(display.getString("Name"));
|
||||
+ }
|
||||
+ if (display.contains("Lore", 9)) {
|
||||
+ blockEntity.setPersistentLore(display.getList("Lore", 8));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return handled;
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 878cdfc49253e7916d038495f79fec7cce75aa50..7e4db08e4cec4332c9cbcc5a7cdca3e78ac1495a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -20,6 +20,9 @@ import net.minecraft.core.IdMapper;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.Vec3i;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.nbt.ListTag;
|
||||
+import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
@@ -28,6 +31,7 @@ import net.minecraft.stats.Stats;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.Mth;
|
||||
+import net.minecraft.world.Nameable;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
@@ -325,7 +329,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
|
||||
if (world instanceof ServerLevel) {
|
||||
Block.getDrops(state, (ServerLevel) world, pos, blockEntity).forEach((itemstack) -> {
|
||||
- Block.popResource((Level) ((ServerLevel) world), pos, itemstack);
|
||||
+ Block.popResource((Level) ((ServerLevel) world), pos, applyDisplayNameAndLoreFromTile(itemstack, blockEntity)); // Purpur
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY);
|
||||
}
|
||||
@@ -335,13 +339,53 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) {
|
||||
if (world instanceof ServerLevel) {
|
||||
Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, stack).forEach((itemstack1) -> {
|
||||
- Block.popResource(world, pos, itemstack1);
|
||||
+ Block.popResource(world, pos, applyDisplayNameAndLoreFromTile(stack, blockEntity)); // Purpur
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ private static ItemStack applyDisplayNameAndLoreFromTile(ItemStack stack, BlockEntity blockEntity) {
|
||||
+ if (stack.getItem() instanceof BlockItem) {
|
||||
+ if (blockEntity != null && blockEntity.getLevel() instanceof ServerLevel && blockEntity.getLevel().purpurConfig.persistentTileEntityDisplayNames) {
|
||||
+ String name = blockEntity.getPersistentDisplayName();
|
||||
+ ListTag lore = blockEntity.getPersistentLore();
|
||||
+ if (blockEntity instanceof Nameable) {
|
||||
+ Nameable namedTile = (Nameable) blockEntity;
|
||||
+ if (namedTile.hasCustomName()) {
|
||||
+ name = Component.Serializer.toJson(namedTile.getCustomName());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (name != null || lore != null) {
|
||||
+ CompoundTag display = stack.getTagElement("display");
|
||||
+ if (display == null) {
|
||||
+ display = new CompoundTag();
|
||||
+ }
|
||||
+
|
||||
+ if (name != null) {
|
||||
+ display.put("Name", StringTag.valueOf(name));
|
||||
+ }
|
||||
+ if (lore != null) {
|
||||
+ display.put("Lore", lore);
|
||||
+ }
|
||||
+
|
||||
+ CompoundTag tag = stack.getTag();
|
||||
+ if (tag == null) {
|
||||
+ tag = new CompoundTag();
|
||||
+ }
|
||||
+ tag.put("display", display);
|
||||
+
|
||||
+ stack.setTag(tag);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return stack;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public static void popResource(Level world, BlockPos pos, ItemStack stack) {
|
||||
float f = EntityType.ITEM.getHeight() / 2.0F;
|
||||
double d0 = (double) ((float) pos.getX() + 0.5F) + Mth.nextDouble(world.random, -0.25D, 0.25D);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index c3a07ccccd5cc38552363c82398f432c8d624288..132c9e6a643995d9fde535a78d9edc9ee97e3a76 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -5,6 +5,8 @@ import net.minecraft.CrashReportCategory;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.nbt.ListTag;
|
||||
+import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -87,10 +89,26 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
if (persistentDataTag instanceof CompoundTag) {
|
||||
this.persistentDataContainer.putAll((CompoundTag) persistentDataTag);
|
||||
}
|
||||
+ // Purpur start
|
||||
+ if (nbt.contains("Purpur.persistentDisplayName")) {
|
||||
+ this.persistentDisplayName = nbt.getString("Purpur.persistentDisplayName");
|
||||
+ }
|
||||
+ if (nbt.contains("Purpur.persistentLore")) {
|
||||
+ this.persistentLore = nbt.getList("Purpur.persistentLore", 8);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public CompoundTag save(CompoundTag nbt) {
|
||||
+ // Purpur start
|
||||
+ if (this.persistentDisplayName != null) {
|
||||
+ nbt.put("Purpur.persistentDisplayName", StringTag.valueOf(this.persistentDisplayName));
|
||||
+ }
|
||||
+ if (this.persistentLore != null) {
|
||||
+ nbt.put("Purpur.persistentLore", this.persistentLore);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
return this.saveMetadata(nbt);
|
||||
}
|
||||
|
||||
@@ -243,4 +261,25 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
return null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Purpur start
|
||||
+ private String persistentDisplayName = null;
|
||||
+ private ListTag persistentLore = null;
|
||||
+
|
||||
+ public void setPersistentDisplayName(String json) {
|
||||
+ this.persistentDisplayName = json;
|
||||
+ }
|
||||
+
|
||||
+ public void setPersistentLore(ListTag lore) {
|
||||
+ this.persistentLore = lore;
|
||||
+ }
|
||||
+
|
||||
+ public String getPersistentDisplayName() {
|
||||
+ return this.persistentDisplayName;
|
||||
+ }
|
||||
+
|
||||
+ public ListTag getPersistentLore() {
|
||||
+ return this.persistentLore;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index a55906d57840a471078a411f706b0f353462b03f..1615b807510cf5150526362195cbadaba3289afa 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -124,6 +124,7 @@ public class PurpurWorldConfig {
|
||||
public boolean entitiesPickUpLootBypassMobGriefing = false;
|
||||
public boolean entitiesCanUsePortals = true;
|
||||
public boolean milkCuresBadOmen = true;
|
||||
+ public boolean persistentTileEntityDisplayNames = false;
|
||||
public double tridentLoyaltyVoidReturnHeight = 0.0D;
|
||||
public double voidDamageHeight = -64.0D;
|
||||
public double voidDamageDealt = 4.0D;
|
||||
@@ -135,6 +136,7 @@ public class PurpurWorldConfig {
|
||||
entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
|
||||
entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals);
|
||||
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
||||
+ persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
|
||||
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
|
||||
voidDamageHeight = getDouble("gameplay-mechanics.void-damage-height", voidDamageHeight);
|
||||
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
|
||||
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 3 Oct 2020 17:40:52 -0500
|
||||
Subject: [PATCH] Add predicate to recipe's ExactChoice ingredient
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
index e10a7268274488c50c0e4b5a10f8fa5de7d500e5..52063c1b14618cf132dcc45b0503e1aec838ec96 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java
|
||||
@@ -36,6 +36,7 @@ public final class Ingredient implements Predicate<ItemStack> {
|
||||
public ItemStack[] itemStacks;
|
||||
private IntList stackingIds;
|
||||
public boolean exact; // CraftBukkit
|
||||
+ public Predicate<org.bukkit.inventory.ItemStack> predicate;
|
||||
|
||||
public Ingredient(Stream<? extends Ingredient.Value> entries) {
|
||||
this.values = (Ingredient.Value[]) entries.toArray((i) -> {
|
||||
@@ -67,6 +68,12 @@ public final class Ingredient implements Predicate<ItemStack> {
|
||||
if (this.itemStacks.length == 0) {
|
||||
return itemstack.isEmpty();
|
||||
} else {
|
||||
+ // Purpur start
|
||||
+ if (predicate != null) {
|
||||
+ return predicate.test(itemstack.asBukkitCopy());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
ItemStack[] aitemstack = this.itemStacks;
|
||||
int i = aitemstack.length;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
||||
index 10ace7bb17c36bfefc584a6322841ab6ea4c866f..a225ec89946cb4c9634a797c8568171cffe4410d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java
|
||||
@@ -22,6 +22,7 @@ public interface CraftRecipe extends Recipe {
|
||||
} else if (bukkit instanceof RecipeChoice.ExactChoice) {
|
||||
stack = new Ingredient(((RecipeChoice.ExactChoice) bukkit).getChoices().stream().map((mat) -> new net.minecraft.world.item.crafting.Ingredient.ItemValue(CraftItemStack.asNMSCopy(mat))));
|
||||
stack.exact = true;
|
||||
+ stack.predicate = ((RecipeChoice.ExactChoice) bukkit).getPredicate(); // Purpur
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown recipe stack instance " + bukkit);
|
||||
}
|
||||
59
patches/server/0110-Flying-squids-Oh-my.patch
Normal file
59
patches/server/0110-Flying-squids-Oh-my.patch
Normal file
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 4 Oct 2020 12:00:42 -0500
|
||||
Subject: [PATCH] Flying squids! Oh my!
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
index 2affff346a7fe81480e86cb61996039df0569853..be9b800d81b4d5faed7a3fb95d605bfd9e9afde6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -85,6 +85,11 @@ public class Squid extends WaterAnimal {
|
||||
// Stops squids from floating just over the water
|
||||
return this.getBoundingBox().deflate(0.001D).offsetY(level.purpurConfig.squidOffsetWaterCheck);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isInWater() {
|
||||
+ return this.wasTouchingWater || level.purpurConfig.squidsCanFly;
|
||||
+ }
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -159,6 +164,7 @@ public class Squid extends WaterAnimal {
|
||||
}
|
||||
|
||||
if (this.isInWaterOrBubble()) {
|
||||
+ if (level.purpurConfig.squidsCanFly) setNoGravity(!wasTouchingWater); // Purpur
|
||||
if (this.tentacleMovement < 3.1415927F) {
|
||||
float f = this.tentacleMovement / 3.1415927F;
|
||||
|
||||
@@ -320,7 +326,7 @@ public class Squid extends WaterAnimal {
|
||||
|
||||
if (i > 100) {
|
||||
this.squid.setMovementVector(0.0F, 0.0F, 0.0F);
|
||||
- } else if (this.squid.getRandom().nextInt(50) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) {
|
||||
+ } else if (this.squid.getRandom().nextInt(50) == 0 || !this.squid.isInWater() || !this.squid.hasMovementVector()) { // Purpur
|
||||
float f = this.squid.getRandom().nextFloat() * 6.2831855F;
|
||||
float f1 = Mth.cos(f) * 0.2F;
|
||||
float f2 = -0.1F + this.squid.getRandom().nextFloat() * 0.2F;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 1615b807510cf5150526362195cbadaba3289afa..03347dbf377458220d8ccc24b0993919562d352a 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1361,6 +1361,7 @@ public class PurpurWorldConfig {
|
||||
public double squidMaxHealth = 10.0D;
|
||||
public boolean squidImmuneToEAR = true;
|
||||
public double squidOffsetWaterCheck = 0.0D;
|
||||
+ public boolean squidsCanFly = false;
|
||||
private void squidSettings() {
|
||||
squidRidable = getBoolean("mobs.squid.ridable", squidRidable);
|
||||
if (PurpurConfig.version < 10) {
|
||||
@@ -1371,6 +1372,7 @@ public class PurpurWorldConfig {
|
||||
squidMaxHealth = getDouble("mobs.squid.attributes.max_health", squidMaxHealth);
|
||||
squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR);
|
||||
squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck);
|
||||
+ squidsCanFly = getBoolean("mobs.squid.can-fly", squidsCanFly);
|
||||
}
|
||||
|
||||
public boolean spiderRidable = false;
|
||||
39
patches/server/0111-Infinity-bow-settings.patch
Normal file
39
patches/server/0111-Infinity-bow-settings.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 4 Oct 2020 19:08:53 -0500
|
||||
Subject: [PATCH] Infinity bow settings
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
index afe33f20578177cb517e1c116e6319481642e66c..93c58f7ef7f00c7f843444ad6d00bd855a3987a4 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
@@ -38,7 +38,7 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
float f = BowItem.getPowerForTime(j);
|
||||
|
||||
if ((double) f >= 0.1D) {
|
||||
- boolean flag1 = flag && itemstack1.is(Items.ARROW);
|
||||
+ boolean flag1 = flag && ((itemstack1.is(Items.ARROW) && world.purpurConfig.infinityWorksWithNormalArrows) || (itemstack1.is(Items.TIPPED_ARROW) && world.purpurConfig.infinityWorksWithTippedArrows) || (itemstack1.is(Items.SPECTRAL_ARROW) && world.purpurConfig.infinityWorksWithSpectralArrows)); // Purpur if (!world.isClientSide) {
|
||||
|
||||
if (!world.isClientSide) {
|
||||
ArrowItem itemarrow = (ArrowItem) (itemstack1.getItem() instanceof ArrowItem ? itemstack1.getItem() : Items.ARROW);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 03347dbf377458220d8ccc24b0993919562d352a..7c2a081585b37346fa9ace6290352e5b58f1261c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -299,6 +299,15 @@ public class PurpurWorldConfig {
|
||||
idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList);
|
||||
}
|
||||
|
||||
+ public boolean infinityWorksWithNormalArrows = true;
|
||||
+ public boolean infinityWorksWithSpectralArrows = false;
|
||||
+ public boolean infinityWorksWithTippedArrows = false;
|
||||
+ private void infinityArrowsSettings() {
|
||||
+ infinityWorksWithNormalArrows = getBoolean("gameplay-mechanics.infinity-bow.normal-arrows", infinityWorksWithNormalArrows);
|
||||
+ infinityWorksWithSpectralArrows = getBoolean("gameplay-mechanics.infinity-bow.spectral-arrows", infinityWorksWithSpectralArrows);
|
||||
+ infinityWorksWithTippedArrows = getBoolean("gameplay-mechanics.infinity-bow.tipped-arrows", infinityWorksWithTippedArrows);
|
||||
+ }
|
||||
+
|
||||
public int playerSpawnInvulnerableTicks = 60;
|
||||
public boolean playerInvulnerableWhileAcceptingResourcePack = false;
|
||||
private void playerInvulnerabilities() {
|
||||
78
patches/server/0112-Stonecutter-damage.patch
Normal file
78
patches/server/0112-Stonecutter-damage.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 5 Oct 2020 12:15:14 -0500
|
||||
Subject: [PATCH] Stonecutter damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 70d436a272d03d1f2eb754a83f1ea7e81d97ff3b..5ff219cefec41d87c98e0e33e94ad44b9ba52910 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -897,7 +897,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
- if (this.onGround && !this.isSteppingCarefully()) {
|
||||
+ if (this.onGround && (!this.isSteppingCarefully() || (block == Blocks.STONECUTTER && level.purpurConfig.stonecutterDamage > 0.0F))) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
|
||||
index e5c11ca529b524b444695f50e2648f0206ff34e1..65b1fd6ace11d4f82d54531869f00e92c19861a6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
|
||||
@@ -93,4 +93,16 @@ public class StonecutterBlock extends Block {
|
||||
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void stepOn(Level level, BlockPos pos, BlockState state, net.minecraft.world.entity.Entity entity) {
|
||||
+ if (level.purpurConfig.stonecutterDamage > 0.0F && entity instanceof net.minecraft.world.entity.EntityLiving) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
+ entity.hurt(net.minecraft.world.damagesource.DamageSource.CACTUS, level.purpurConfig.stonecutterDamage);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null;
|
||||
+ }
|
||||
+ super.stepOn(level, pos, state, entity);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
index 2ad5ff9a1d7de54e75436e99da8a73db9dc91bde..60605a8a021cc56f9c3ba22bc43c43c302fb1a70 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
@@ -463,7 +463,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
return BlockPathTypes.DANGER_CACTUS;
|
||||
}
|
||||
|
||||
- if (blockState.is(Blocks.SWEET_BERRY_BUSH)) {
|
||||
+ if (blockState.is(Blocks.SWEET_BERRY_BUSH) || blockState.is(Blocks.STONECUTTER)) {
|
||||
return BlockPathTypes.DANGER_OTHER;
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
||||
return BlockPathTypes.POWDER_SNOW;
|
||||
} else if (blockState.is(Blocks.CACTUS)) {
|
||||
return BlockPathTypes.DAMAGE_CACTUS;
|
||||
- } else if (blockState.is(Blocks.SWEET_BERRY_BUSH)) {
|
||||
+ } else if (blockState.is(Blocks.SWEET_BERRY_BUSH) || blockState.is(Blocks.STONECUTTER)) {
|
||||
return BlockPathTypes.DAMAGE_OTHER;
|
||||
} else if (blockState.is(Blocks.HONEY_BLOCK)) {
|
||||
return BlockPathTypes.STICKY_HONEY;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 7c2a081585b37346fa9ace6290352e5b58f1261c..192896f331967b057c56bd3deeca1c4f740f7dff 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1469,6 +1469,11 @@ public class PurpurWorldConfig {
|
||||
spawnerDeactivateByRedstone = getBoolean("blocks.spawner.deactivate-by-redstone", spawnerDeactivateByRedstone);
|
||||
}
|
||||
|
||||
+ public float stonecutterDamage = 0.0F;
|
||||
+ private void stonecutterSettings() {
|
||||
+ stonecutterDamage = (float) getDouble("blocks.stonecutter.damage", stonecutterDamage);
|
||||
+ }
|
||||
+
|
||||
public boolean turtleRidable = false;
|
||||
public boolean turtleRidableInWater = false;
|
||||
public double turtleMaxHealth = 30.0D;
|
||||
Reference in New Issue
Block a user