mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: bca97a8f7 replace spaces in world key (touches #5397) de94f6485 Refactor chat message composition (#5396) e27f334bb [CI-SKIP] Fix makemcdevsrc.sh for nms relocations (#5389) ae15e85da Updated Upstream (CraftBukkit) 26fe0ac5a Only set despawnTimer for Wandering Traders spawned by MobSpawnerTrader (#5391) b748eb7b8 Fix VanillaMobGoalTest#testBukkitMap (#5390) 18dbbb578 [Auto] Updated Upstream (CraftBukkit) fac9cc5d5 [CI-SKIP] Ignore .gitignore 087aa70e7 Deprecate ItemStack#setLore(List<String>) and ItemStack#getLore, add Component based alternatives 9889c651c apply fixup c310f0a61 Updated Upstream (Bukkit/CraftBukkit) f17560ab0 wtf is this t file -jmp 347f3a9b8 fix compile 700e9e6a5 rebase cf4dc464a Revert de5f4e469...c270abe96 6870db613 script & POM fix 743c6533c Replace ** with * (BSD/macOS) 376d7b097 Don't remove the .java fcb3fd42a Fix macOS/BSD support 8cfc05249 Link correctly ba1031ca7 Rename work dir c8d844ab7 Actually fix preloading this time e62aa5e3e Fix class preloading 1c03cf898 It's mojang math, not minecraft math 1034873df Apply fixups 39b125771 Use revision file 956150da7 Welcome to 1.16.5-R0.2 ccb217c01 Change cache keys 0d217001c more work f6d820f07 It compiles 0f78e9525 More work 1718f61bf Updated Upstream (CraftBukkit/Spigot) b28d46114 Update scripts for NMS repackaging Tuinity Changes: 9bdcb9b8e Delete work dir when running jar 6351d7ca7 Update Upstream (Paper) 932c199a6 Generate md-dev correctly bf3e73778 Make packet limiter work from IDE 1686f3861 Fix packet limiter config f40f7b425 Update README.md styling (#264) da1c3ace5 GH Actions Changes (#213) 5f325ecf1 Update Upstream (Paper) 0f83fe48d Update Upstream (Paper) Airplane Changes: f94d39947 Merge pull request #18 from notOM3GA/upstream/nms-repackage 0fc622631 Force build for Flare update 08439d6a9 Update Upstream (Tuinity)
127 lines
7.9 KiB
Diff
127 lines
7.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Thu, 25 Jul 2019 18:07:37 -0500
|
|
Subject: [PATCH] Implement elytra settings
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
index c540886511261303d2266ac97353e1b98c1f9601..5a060b98fe9f3edc199cd520a636505c653556e9 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
@@ -2955,7 +2955,16 @@ public abstract class EntityLiving extends Entity {
|
|
if (itemstack.getItem() == Items.ELYTRA && ItemElytra.d(itemstack)) {
|
|
flag = true;
|
|
if (!this.world.isClientSide && (this.be + 1) % 20 == 0) {
|
|
- itemstack.damage(1, this, (entityliving) -> {
|
|
+ // Purpur start
|
|
+ int damage = world.purpurConfig.elytraDamagePerSecond;
|
|
+ if (world.purpurConfig.elytraDamageMultiplyBySpeed > 0) {
|
|
+ double speed = getMot().magnitudeSquared();
|
|
+ if (speed > world.purpurConfig.elytraDamageMultiplyBySpeed) {
|
|
+ damage *= (int) speed;
|
|
+ }
|
|
+ }
|
|
+ itemstack.damage(damage, this, (entityliving) -> {
|
|
+ // Purpur end
|
|
entityliving.broadcastItemBreak(EnumItemSlot.CHEST);
|
|
});
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
|
index e7f958d137257da912ce9b83db017b4423959943..210b95f1d67ec12566d6fc93b8234e11ad132d1a 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
|
@@ -7,6 +7,7 @@ import net.minecraft.server.level.EntityPlayer;
|
|
import net.minecraft.world.EnumHand;
|
|
import net.minecraft.world.EnumInteractionResult;
|
|
import net.minecraft.world.InteractionResultWrapper;
|
|
+import net.minecraft.world.entity.EnumItemSlot;
|
|
import net.minecraft.world.entity.player.EntityHuman;
|
|
import net.minecraft.world.entity.projectile.EntityFireworks;
|
|
import net.minecraft.world.item.context.ItemActionContext;
|
|
@@ -53,6 +54,14 @@ public class ItemFireworks extends Item {
|
|
// Paper start
|
|
com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Firework) entityfireworks.getBukkitEntity());
|
|
if (event.callEvent() && world.addEntity(entityfireworks)) {
|
|
+ // Purpur start
|
|
+ if (world.purpurConfig.elytraDamagePerFireworkBoost > 0) {
|
|
+ ItemStack chestItem = entityhuman.getEquipment(EnumItemSlot.CHEST);
|
|
+ if (chestItem.getItem() == Items.ELYTRA) {
|
|
+ chestItem.damage(world.purpurConfig.elytraDamagePerFireworkBoost, entityhuman, (entityliving) -> entityliving.broadcastItemBreak(EnumItemSlot.CHEST));
|
|
+ }
|
|
+ }
|
|
+ // Purpur end
|
|
if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) {
|
|
itemstack.subtract(1);
|
|
} else ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index fcc6ee9481d577d39339cd0ac24dab06bd76e5c6..81e2ccfa4f6cf6a4ad9236cf0ce94df8dc3ec5b6 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -500,7 +500,7 @@ public final class ItemStack {
|
|
int j;
|
|
|
|
if (i > 0) {
|
|
- j = EnchantmentManager.getEnchantmentLevel(Enchantments.DURABILITY, this);
|
|
+ j = (getItem() == Items.ELYTRA && entityplayer != null && entityplayer.world.purpurConfig.elytraIgnoreUnbreaking) ? 0 : EnchantmentManager.getEnchantmentLevel(Enchantments.DURABILITY, this); // Purpur
|
|
int k = 0;
|
|
|
|
for (int l = 0; j > 0 && l < i; ++l) {
|
|
@@ -546,6 +546,12 @@ public final class ItemStack {
|
|
if (this.isDamaged(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
|
|
consumer.accept(t0);
|
|
Item item = this.getItem();
|
|
+ // Purpur start
|
|
+ if (item == Items.ELYTRA) {
|
|
+ setDamage(item.getMaxDurability() - 1);
|
|
+ return;
|
|
+ }
|
|
+ // Purpur end
|
|
// CraftBukkit start - Check for item breaking
|
|
if (this.count == 1 && t0 instanceof EntityHuman) {
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((EntityHuman) t0, this);
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemTrident.java b/src/main/java/net/minecraft/world/item/ItemTrident.java
|
|
index 9896477b54cf91a88bdfc3d85018a59193b32859..0711d195c654edef5875f587e391bacfdea096da 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemTrident.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemTrident.java
|
|
@@ -123,6 +123,16 @@ public class ItemTrident extends Item implements ItemVanishable {
|
|
f2 *= f6 / f5;
|
|
f3 *= f6 / f5;
|
|
f4 *= f6 / f5;
|
|
+
|
|
+ // Purpur start
|
|
+ ItemStack chestItem = entityhuman.getEquipment(EnumItemSlot.CHEST);
|
|
+ if (chestItem.getItem() == Items.ELYTRA && world.purpurConfig.elytraDamagePerTridentBoost > 0) {
|
|
+ chestItem.damage(world.purpurConfig.elytraDamagePerTridentBoost, entityhuman, (entity) -> {
|
|
+ entity.broadcastItemBreak(EnumItemSlot.CHEST);
|
|
+ });
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
entityhuman.i((double) f2, (double) f3, (double) f4);
|
|
entityhuman.r(20);
|
|
if (entityhuman.isOnGround()) {
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index e66b79218e960d11da4759187e4473685ccb9a9e..7f6b028f32af113e5898a0f2f39e0ec6c4e4dd11 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -129,6 +129,19 @@ public class PurpurWorldConfig {
|
|
voidDamageHeight = getDouble("gameplay-mechanics.void-damage-height", voidDamageHeight);
|
|
}
|
|
|
|
+ public int elytraDamagePerSecond = 1;
|
|
+ public double elytraDamageMultiplyBySpeed = 0;
|
|
+ public boolean elytraIgnoreUnbreaking = false;
|
|
+ public int elytraDamagePerFireworkBoost = 0;
|
|
+ public int elytraDamagePerTridentBoost = 0;
|
|
+ private void elytraSettings() {
|
|
+ elytraDamagePerSecond = getInt("gameplay-mechanics.elytra.damage-per-second", elytraDamagePerSecond);
|
|
+ elytraDamageMultiplyBySpeed = getDouble("gameplay-mechanics.elytra.damage-multiplied-by-speed", elytraDamageMultiplyBySpeed);
|
|
+ elytraIgnoreUnbreaking = getBoolean("gameplay-mechanics.elytra.ignore-unbreaking", elytraIgnoreUnbreaking);
|
|
+ elytraDamagePerFireworkBoost = getInt("gameplay-mechanics.elytra.damage-per-boost.firework", elytraDamagePerFireworkBoost);
|
|
+ elytraDamagePerTridentBoost = getInt("gameplay-mechanics.elytra.damage-per-boost.trident", elytraDamagePerTridentBoost);
|
|
+ }
|
|
+
|
|
public String playerDeathExpDropEquation = "expLevel * 7";
|
|
public int playerDeathExpDropMax = 100;
|
|
private void playerDeathExpSettings() {
|