mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Better nerf for TNT Cannons ...
Drops the item Applies to all Falling Block Entities
This commit is contained in:
parent
3e2fa68fe6
commit
418c27e9c1
5 changed files with 62 additions and 55 deletions
|
@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
|
||||
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
|
||||
@@ -0,0 +0,0 @@ public class NBTCompressedStreamTools {
|
||||
|
||||
|
||||
public static NBTTagCompound a(byte[] abyte, NBTReadLimiter nbtreadlimiter) {
|
||||
try {
|
||||
- DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(abyte))));
|
||||
+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new org.spigotmc.LimitStream(new GZIPInputStream(new ByteArrayInputStream(abyte)), nbtreadlimiter))); // Spigot
|
||||
|
||||
|
||||
NBTTagCompound nbttagcompound;
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/LimitStream.java b/src/main/java/org/spigotmc/LimitStream.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
|
|
@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/server/AttributeRanged.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
public class AttributeRanged extends AttributeBase {
|
||||
|
||||
|
||||
private final double a;
|
||||
- private final double b;
|
||||
+ public double b; // Spigot
|
||||
private String c;
|
||||
|
||||
|
||||
public AttributeRanged(String s, double d0, double d1, double d2) {
|
||||
diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/server/GenericAttributes.java
|
||||
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
||||
public class GenericAttributes {
|
||||
|
||||
|
||||
private static final Logger f = LogManager.getLogger();
|
||||
- public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true);
|
||||
+ // Spigot Start
|
||||
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true);
|
||||
+ public static final IAttribute e = new AttributeRanged("generic.attackDamage", 2.0D, 0.0D, org.spigotmc.SpigotConfig.attackDamage);
|
||||
+ // Spigot End
|
||||
|
||||
|
||||
public static NBTTagList a(AttributeMapBase attributemapbase) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
|
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/GenericAttributes.java
|
||||
+++ b/src/main/java/net/minecraft/server/GenericAttributes.java
|
||||
@@ -0,0 +0,0 @@ public class GenericAttributes {
|
||||
|
||||
|
||||
private static final Logger f = LogManager.getLogger();
|
||||
// Spigot Start
|
||||
- public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true);
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Wed, 9 Jul 2014 17:38:48 -0500
|
||||
Subject: [PATCH] Configurable nerf for TNT cannons
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
+import org.github.paperspigot.PaperSpigotWorldConfig;
|
||||
|
||||
public class EntityTNTPrimed extends Entity {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
|
||||
this.motY *= -0.5D;
|
||||
}
|
||||
|
||||
+ // PaperSpigot start - Configurable nerf for TNT cannons
|
||||
+ if (this.locY > PaperSpigotWorldConfig.tntHeightNerf && PaperSpigotWorldConfig.tntHeightNerf != 0) {
|
||||
+ this.die();
|
||||
+ }
|
||||
+ // PaperSpigot end
|
||||
+
|
||||
if (this.fuseTicks-- <= 0) {
|
||||
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
||||
if (!this.world.isStatic) {
|
||||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
|
||||
keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true );
|
||||
log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
|
||||
}
|
||||
+
|
||||
+ public static double tntHeightNerf;
|
||||
+ private void tntHeightNerf()
|
||||
+ {
|
||||
+ tntHeightNerf = getDouble( "tnt-entity-height-nerf", 0 );
|
||||
+ }
|
||||
}
|
||||
--
|
|
@ -0,0 +1,54 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Wed, 30 Jul 2014 03:31:43 -0500
|
||||
Subject: [PATCH] Drop falling block entities that are above the specified
|
||||
height
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
@@ -0,0 +0,0 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+import org.github.paperspigot.PaperSpigotWorldConfig;
|
||||
|
||||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
|
||||
++this.ticksLived;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
+
|
||||
+ // PaperSpigot start - Drop falling blocks above the specified height
|
||||
+ if (PaperSpigotWorldConfig.fallingBlockHeightNerf != 0 && this.locY > PaperSpigotWorldConfig.fallingBlockHeightNerf) {
|
||||
+ if (this.dropItem) {
|
||||
+ this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F);
|
||||
+ }
|
||||
+
|
||||
+ this.die();
|
||||
+ }
|
||||
+ // PaperSpigot end
|
||||
+
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
|
||||
keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true );
|
||||
log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
|
||||
}
|
||||
+
|
||||
+ public static double fallingBlockHeightNerf;
|
||||
+ private void fallingBlockHeightNerf()
|
||||
+ {
|
||||
+ // Technically a little disingenuous as it applies to all falling blocks but alas, backwards compat prevails!
|
||||
+ fallingBlockHeightNerf = getDouble( "tnt-entity-height-nerf", 0 );
|
||||
+ }
|
||||
}
|
||||
--
|
Loading…
Reference in a new issue