mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-22 18:46:27 +01:00
Remove old patches, get add enough patches so the server starts to build again
This commit is contained in:
parent
5f48009340
commit
f0a93e845b
@ -1,83 +0,0 @@
|
||||
From 12c6f0850f54b35a108041a4be02a26df06d5a82 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Wed, 26 Feb 2020 17:08:07 +0100
|
||||
Subject: [PATCH] Modify POM
|
||||
|
||||
---
|
||||
pom.xml | 25 +++++++++++++++----------
|
||||
1 file changed, 15 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index ba3d10a1b7..f2cc703fe6 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,11 +1,12 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
- <artifactId>tuinity</artifactId>
|
||||
+ <artifactId>yapfa</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
- <name>Tuinity-Server</name>
|
||||
- <url>https://github.com/Spottedleaf/Tuinity</url>
|
||||
+ <name>YAPFA</name>
|
||||
+ <url>https://github.com/tr7zw/YAPFA</url>
|
||||
+
|
||||
<properties>
|
||||
<!-- <skipTests>true</skipTests> Paper - This [was] not going to end well -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -17,16 +18,16 @@
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
- <groupId>com.tuinity</groupId>
|
||||
- <artifactId>tuinity-parent</artifactId>
|
||||
+ <groupId>de.tr7zw.yapfa</groupId>
|
||||
+ <artifactId>yapfa-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
- <groupId>com.tuinity</groupId>
|
||||
- <artifactId>tuinity-api</artifactId>
|
||||
+ <groupId>de.tr7zw.yapfa</groupId>
|
||||
+ <artifactId>yapfa-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@@ -148,6 +149,10 @@
|
||||
|
||||
Please see https://www.spigotmc.org/go/maven for more information.
|
||||
-->
|
||||
+ <repository>
|
||||
+ <id>destroystokyo-repo</id>
|
||||
+ <url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
+ </repository>
|
||||
<repository>
|
||||
<id>spigotmc-public</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
@@ -163,15 +168,15 @@
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
<build>
|
||||
- <finalName>tuinity-${minecraft.version}</finalName>
|
||||
- <defaultGoal>install</defaultGoal> <!-- Paper -->
|
||||
+ <finalName>yapfa-${minecraft.version}</finalName>
|
||||
+ <defaultGoal>clean install</defaultGoal> <!-- Paper -->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.lukegb.mojo</groupId>
|
||||
<artifactId>gitdescribe-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<configuration>
|
||||
- <outputPrefix>git-Tuinity-</outputPrefix> <!-- Tuinity -->
|
||||
+ <outputPrefix>git-YAPFA-</outputPrefix>
|
||||
<scmDirectory>..</scmDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,96 +0,0 @@
|
||||
From 02a0c772887e055ffacd10374480110a073c285b Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 10 Dec 2016 14:00:25 -0500
|
||||
Subject: [PATCH] EMC MC Log utils
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/MCLog.java | 77 +++++++++++++++++++
|
||||
1 file changed, 77 insertions(+)
|
||||
create mode 100644 src/main/java/net/minecraft/server/MCLog.java
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MCLog.java b/src/main/java/net/minecraft/server/MCLog.java
|
||||
new file mode 100644
|
||||
index 00000000..bf28f00d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/MCLog.java
|
||||
@@ -0,0 +1,77 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2016 Starlis LLC / Daniel Ennis (Aikar) - MIT License
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining
|
||||
+ * a copy of this software and associated documentation files (the
|
||||
+ * "Software"), to deal in the Software without restriction, including
|
||||
+ * without limitation the rights to use, copy, modify, merge, publish,
|
||||
+ * distribute, sublicense, and/or sell copies of the Software, and to
|
||||
+ * permit persons to whom the Software is furnished to do so, subject to
|
||||
+ * the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be
|
||||
+ * included in all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
+
|
||||
+import java.util.logging.Logger;
|
||||
+import java.util.regex.Pattern;
|
||||
+
|
||||
+public class MCLog {
|
||||
+ private static final Logger LOGGER = Logger.getLogger("NMS");
|
||||
+ private static final Pattern NEWLINE = Pattern.compile("\n");
|
||||
+
|
||||
+ private MCLog() {}
|
||||
+
|
||||
+
|
||||
+ public static void log(String message) {
|
||||
+ info(message);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ public static void info(String message) {
|
||||
+ for (String s : NEWLINE.split(message)) {
|
||||
+ LOGGER.info(s);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void warn(String message) {
|
||||
+ for (String s : NEWLINE.split(message)) {
|
||||
+ LOGGER.warning(s);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void severe(String message) {
|
||||
+ for (String s : NEWLINE.split(message)) {
|
||||
+ LOGGER.severe(s);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void exception(String msg) {
|
||||
+ exception(new Throwable(msg));
|
||||
+ }
|
||||
+
|
||||
+ public static void exception(Throwable e) {
|
||||
+ exception(e.getMessage(), e);
|
||||
+ }
|
||||
+
|
||||
+ public static void exception(String msg, Throwable e) {
|
||||
+ if (msg != null) {
|
||||
+ severe(msg);
|
||||
+ }
|
||||
+ severe(ExceptionUtils.getFullStackTrace(e));
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,168 +0,0 @@
|
||||
From 8455f7508c6c62acf1a2d42494a9a8eccfb1cf9e Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 22 Dec 2012 00:35:15 -0500
|
||||
Subject: [PATCH] EMC PlayerUseItem Event
|
||||
|
||||
This lets us control when an item is consumed and change the item.
|
||||
---
|
||||
.../net/minecraft/server/EntityLiving.java | 2 +-
|
||||
.../server/PlayerInteractManager.java | 90 ++++++++++++++++---
|
||||
2 files changed, 78 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 3fc2360a10..5ad0aacf01 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -1912,7 +1912,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
- public void a(EnumHand enumhand, ItemStack itemstack) {
|
||||
+ public void setHand(EnumHand hand, ItemStack item) { a(hand, item); } public void a(EnumHand enumhand, ItemStack itemstack) { // Paper - OBFHELPER
|
||||
if (enumhand == EnumHand.MAIN_HAND) {
|
||||
this.setSlot(EnumItemSlot.MAINHAND, itemstack);
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
index 272c1f0eaf..76a8d94229 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
@@ -432,6 +432,15 @@ public class PlayerInteractManager {
|
||||
}
|
||||
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, World world, ItemStack itemstack, EnumHand enumhand) {
|
||||
+ // Paper start - Allow control over if item should be consumed or not.
|
||||
+ org.bukkit.inventory.EquipmentSlot bukkitHand = enumhand == EnumHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack craftitem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack);
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack origItemClone = craftitem.clone();
|
||||
+ com.empireminecraft.customevents.PlayerUseItemEvent event = new com.empireminecraft.customevents.PlayerUseItemEvent(player.getBukkitEntity(), craftitem, bukkitHand);
|
||||
+ if (!event.callEvent()) {
|
||||
+ return EnumInteractionResult.FAIL;
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (this.gamemode == EnumGamemode.SPECTATOR) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (entityhuman.getCooldownTracker().hasCooldown(itemstack.getItem())) {
|
||||
@@ -439,27 +448,53 @@ public class PlayerInteractManager {
|
||||
} else {
|
||||
int i = itemstack.getCount();
|
||||
int j = itemstack.getDamage();
|
||||
+ // Paper start
|
||||
+ ItemStack orig = itemstack;
|
||||
+ if (event.getTempItem() != null) {
|
||||
+ itemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getTempItem());
|
||||
+ entityhuman.setHand(enumhand, itemstack);
|
||||
+ }
|
||||
+ // Paper end
|
||||
InteractionResultWrapper<ItemStack> interactionresultwrapper = itemstack.a(world, entityhuman, enumhand);
|
||||
+
|
||||
ItemStack itemstack1 = (ItemStack) interactionresultwrapper.b();
|
||||
+ // Paper start - change order and redo lots of things here.
|
||||
+ if (event.getTempItem() != null) {
|
||||
+ // restore original item
|
||||
+ entityhuman.setHand(enumhand, itemstack1 = orig);
|
||||
+ }
|
||||
|
||||
- if (itemstack1 == itemstack && itemstack1.getCount() == i && itemstack1.k() <= 0 && itemstack1.getDamage() == j) {
|
||||
- return interactionresultwrapper.a();
|
||||
- } else if (interactionresultwrapper.a() == EnumInteractionResult.FAIL && itemstack1.k() > 0 && !entityhuman.isHandRaised()) {
|
||||
+ boolean isSame = itemstack1 == itemstack && itemstack1.getCount() == i && itemstack1.k() <= 0 && itemstack1.getDamage() == j;
|
||||
+ // This was just a short circuit, always run post use on success
|
||||
+ if (interactionresultwrapper.a() == EnumInteractionResult.FAIL && itemstack1.k() > 0 && !entityhuman.isHandRaised()) {
|
||||
+ // if fail, abort - this is vanilla
|
||||
return interactionresultwrapper.a();
|
||||
} else {
|
||||
- entityhuman.a(enumhand, itemstack1);
|
||||
- if (this.isCreative()) {
|
||||
+ if (!event.shouldConsumeItem() || this.isCreative()) { // Paper - add getConsumeItem - moved up
|
||||
itemstack1.setCount(i);
|
||||
if (itemstack1.e() && itemstack1.getDamage() != j) {
|
||||
itemstack1.setDamage(j);
|
||||
}
|
||||
}
|
||||
+ org.bukkit.inventory.ItemStack craftNew = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack1);
|
||||
+ com.destroystokyo.paper.event.player.PlayerPostUseItemEvent postUseItemEvent = new com.destroystokyo.paper.event.player.PlayerPostUseItemEvent(player.getBukkitEntity(), origItemClone, craftNew, bukkitHand);
|
||||
+ postUseItemEvent.callEvent();
|
||||
+
|
||||
+ //noinspection ObjectEquality
|
||||
+ if (craftNew != postUseItemEvent.getNewItem()) {
|
||||
+ // Use a different new item instead. Not good to do if its a "Hold to use item" FYI!
|
||||
+ itemstack1 = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(postUseItemEvent.getNewItem());
|
||||
+ isSame = false;
|
||||
+ }
|
||||
+ entityhuman.a(enumhand, itemstack1);
|
||||
+ // Paper end
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
entityhuman.a(enumhand, ItemStack.a);
|
||||
+ isSame = false; // Paper
|
||||
}
|
||||
|
||||
- if (!entityhuman.isHandRaised()) {
|
||||
+ if (itemstack1.isEmpty() || (!isSame && !entityhuman.isHandRaised())) { // Paper - add !isSame
|
||||
((EntityPlayer) entityhuman).updateInventory(entityhuman.defaultContainer);
|
||||
}
|
||||
|
||||
@@ -473,6 +508,7 @@ public class PlayerInteractManager {
|
||||
public boolean firedInteract = false;
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, World world, ItemStack itemstack, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
+ org.bukkit.util.Vector hitVector = new org.bukkit.util.Vector(movingobjectpositionblock.getPos().x, movingobjectpositionblock.getPos().y, movingobjectpositionblock.getPos().z); // Paper - Ensure last 3 floats line up as vector params
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
EnumInteractionResult enuminteractionresult = EnumInteractionResult.PASS;
|
||||
boolean cancelledBlock = false;
|
||||
@@ -540,17 +576,45 @@ public class PlayerInteractManager {
|
||||
}
|
||||
|
||||
if (!itemstack.isEmpty() && enuminteractionresult != EnumInteractionResult.SUCCESS && !interactResult) { // add !interactResult SPIGOT-764
|
||||
- ItemActionContext itemactioncontext = new ItemActionContext(entityhuman, enumhand, movingobjectpositionblock);
|
||||
+ // Paper start - Allow control over if item should be consumed or not.
|
||||
+ org.bukkit.inventory.EquipmentSlot bukkitHand = enumhand == EnumHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack craftitem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack);
|
||||
+ com.empireminecraft.customevents.PlayerPlaceItemAtEvent eventPlace = new com.empireminecraft.customevents.PlayerPlaceItemAtEvent(
|
||||
+ (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), craftitem,
|
||||
+ MCUtil.toLocation(world, blockposition),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(movingobjectpositionblock.getDirection()),
|
||||
+ hitVector, bukkitHand);
|
||||
+
|
||||
+ if (!eventPlace.callEvent()) {
|
||||
+ return EnumInteractionResult.FAIL;
|
||||
+ }
|
||||
|
||||
- if (this.isCreative()) {
|
||||
- int i = itemstack.getCount();
|
||||
- enuminteractionresult = itemstack.placeItem(itemactioncontext, enumhand);
|
||||
+ ItemStack orig = itemstack;
|
||||
+ if (eventPlace.getTempItem() != null) {
|
||||
+ itemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(eventPlace.getTempItem());
|
||||
+ entityhuman.setHand(enumhand, itemstack);
|
||||
+ }
|
||||
+ //replace entityhuman.b(enumhand) with itemstack
|
||||
+ ItemActionContext itemactioncontext = new ItemActionContext(entityhuman, enumhand, movingobjectpositionblock);
|
||||
|
||||
+ int i = itemstack.getCount();
|
||||
+ enuminteractionresult = itemstack.placeItem(itemactioncontext, enumhand);
|
||||
+ if (eventPlace.getTempItem() != null) {
|
||||
+ entityhuman.setHand(enumhand, itemstack = orig);
|
||||
+ }
|
||||
+ if (!eventPlace.getConsumeItem() || this.isCreative()) {
|
||||
itemstack.setCount(i);
|
||||
- return enuminteractionresult;
|
||||
- } else {
|
||||
- return itemstack.placeItem(itemactioncontext, enumhand);
|
||||
}
|
||||
+ if (enuminteractionresult != EnumInteractionResult.FAIL) {
|
||||
+ com.destroystokyo.paper.event.player.PlayerPostPlaceItemAtEvent postUseItemEvent =
|
||||
+ new com.destroystokyo.paper.event.player.PlayerPostPlaceItemAtEvent(player.getBukkitEntity(), craftitem,
|
||||
+ MCUtil.toLocation(world, blockposition),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(movingobjectpositionblock.getDirection()),
|
||||
+ hitVector, bukkitHand);
|
||||
+ postUseItemEvent.callEvent();
|
||||
+ }
|
||||
+ return enuminteractionresult;
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
return enuminteractionresult;
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,45 +0,0 @@
|
||||
From 12d1be74c6892d67c0c4e134b3bceb7de7806e34 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 31 Dec 2012 01:25:46 -0500
|
||||
Subject: [PATCH] EMC Anvil Event
|
||||
|
||||
Fire an event for anvil usage, remove cap from server, send level to client
|
||||
---
|
||||
.../java/net/minecraft/server/ContainerAnvil.java | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
||||
index 286b930d..49c264b3 100644
|
||||
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
||||
@@ -7,6 +7,10 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
+import com.empireminecraft.customevents.AnvilEvent; // EMC
|
||||
+import org.bukkit.Bukkit; // EMC
|
||||
+import org.bukkit.entity.Player; // EMC
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // EMC
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -298,6 +302,16 @@ public class ContainerAnvil extends Container {
|
||||
if (this.levelCost.get() >= maximumRepairCost && !this.player.abilities.canInstantlyBuild) { // CraftBukkit
|
||||
itemstack1 = ItemStack.a;
|
||||
}
|
||||
+ // EMC start
|
||||
+ AnvilEvent event = new AnvilEvent((Player) player.getBukkitEntity(), CraftItemStack.asBukkitCopy(itemstack), CraftItemStack.asBukkitCopy(itemstack2), CraftItemStack.asBukkitCopy(itemstack1), this.levelCost.get());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack1 = ItemStack.NULL_ITEM;
|
||||
+ } else {
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(event.getResult());
|
||||
+ this.levelCost.set(event.getCost());
|
||||
+ }
|
||||
+ // EMC end
|
||||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
int k2 = itemstack1.getRepairCost();
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,24 +0,0 @@
|
||||
From 46809af9ebcd3c662537d6660809a849537f8173 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 19 May 2013 21:09:31 -0400
|
||||
Subject: [PATCH] EMC ArrowHitBlock Event
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityArrow.java | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
index 9c97edf9..4dc53d3f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
@@ -308,6 +308,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
this.a(SoundEffects.ENTITY_ARROW_HIT);
|
||||
this.o(false);
|
||||
this.w();
|
||||
+ if (new com.destroystokyo.paper.event.entity.ArrowHitBlockEvent((org.bukkit.entity.AbstractArrow) this.getBukkitEntity(), world.getWorld().getBlockAt(movingobjectpositionblock.getBlockPosition().getX(), movingobjectpositionblock.getBlockPosition().getY(), movingobjectpositionblock.getBlockPosition().getZ())).callEvent()) // Paper
|
||||
iblockdata.a(this.world, iblockdata, movingobjectpositionblock, this);
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,69 +0,0 @@
|
||||
From 43bc55b8a3402aa3555da5d1c52f1d8ba86c70b8 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 20 Jul 2013 22:40:56 -0400
|
||||
Subject: [PATCH] EMC MonsterEggSpawn Event
|
||||
|
||||
Get the itemstack used to spawn an entity
|
||||
---
|
||||
.../net/minecraft/server/EntityTypes.java | 29 +++++++++++++++++--
|
||||
1 file changed, 26 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
|
||||
index 4100e367..29adb85a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTypes.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
|
||||
@@ -11,6 +11,7 @@ import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
|
||||
public class EntityTypes<T extends Entity> {
|
||||
|
||||
@@ -156,18 +157,40 @@ public class EntityTypes<T extends Entity> {
|
||||
|
||||
@Nullable
|
||||
public Entity spawnCreature(World world, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
- return this.spawnCreature(world, itemstack == null ? null : itemstack.getTag(), itemstack != null && itemstack.hasName() ? itemstack.getName() : null, entityhuman, blockposition, enummobspawn, flag, flag1);
|
||||
+ // EMC start - pas itemtack for monster eggs
|
||||
+ return this.spawnCreature(world, itemstack, itemstack == null ? null : itemstack.getTag(), itemstack != null && itemstack.hasName() ? itemstack.getName() : null, entityhuman, blockposition, enummobspawn, flag, flag1);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
+ public T spawnCreature(World world, ItemStack itemstack, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
// CraftBukkit start
|
||||
- return this.spawnCreature(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ return this.spawnCreature(world, itemstack, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
}
|
||||
|
||||
+ @Nullable
|
||||
+ public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
+ return spawnCreature(world, null, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, CreatureSpawnEvent.SpawnReason.NATURAL);
|
||||
+ }
|
||||
@Nullable
|
||||
public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ return spawnCreature(world, null, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, spawnReason);
|
||||
+ }
|
||||
+ public T spawnCreature(World world, ItemStack itemstack, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // EMC end - add itemstack to methods
|
||||
T t0 = this.createCreature(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1);
|
||||
+ // EMC start - if false the spawn was cancelled, add new event
|
||||
+ if (spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG && itemstack != null && t0 != null) {
|
||||
+ final com.empireminecraft.customevents.MonsterEggSpawnEvent event = new com.empireminecraft.customevents.MonsterEggSpawnEvent(entityhuman != null ? entityhuman.getBukkitEntity() : null, (org.bukkit.entity.LivingEntity) t0.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
|
||||
+
|
||||
+ if (!event.callEvent()) {
|
||||
+ ((WorldServer)world).removeEntity(t0);
|
||||
+ return null;
|
||||
+ }
|
||||
+ if (event.getEntity().getEntityId() != t0.getId()) {
|
||||
+ return (T) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getEntity()).getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ // EMC end
|
||||
|
||||
return world.addEntity(t0, spawnReason) ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled
|
||||
// CraftBukkit end
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 590cd93be05350962a3c1423796a1521c5d4450a Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 28 Sep 2013 22:01:47 -0400
|
||||
Subject: [PATCH] EMC MovedTooQuickly event
|
||||
|
||||
also make creative immune to this event
|
||||
---
|
||||
src/main/java/net/minecraft/server/PlayerConnection.java | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index ecf7a8c6d9..64d5136346 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -1045,9 +1045,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
|
||||
if (d11 - d10 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) {
|
||||
// CraftBukkit end
|
||||
+ if (new com.empireminecraft.customevents.MovedTooQuicklyEvent(d10, getPlayer()).callEvent()) { // EMC
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9);
|
||||
this.a(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch);
|
||||
return;
|
||||
+ } // EMC
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
||||
From c4694a7bbb7b7b1d6ba7d10b8d4a9946f325f6b1 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 10 Jan 2014 22:05:59 -0500
|
||||
Subject: [PATCH] EMC Disable Snooper
|
||||
|
||||
What purpose does it provide...
|
||||
---
|
||||
src/main/java/net/minecraft/server/MinecraftServer.java | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f0959d301..d18387971 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1275,11 +1275,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
//} // Paper
|
||||
|
||||
this.methodProfiler.enter("snooper");
|
||||
- if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot
|
||||
+ if (false && ((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot // EMC - disable snooper
|
||||
this.snooper.a();
|
||||
}
|
||||
|
||||
- if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && this.ticks % 6000 == 0) { // Spigot
|
||||
+ if (false && ((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && this.ticks % 6000 == 0) { // Spigot // EMC - disable snooper
|
||||
this.snooper.b();
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,33 +0,0 @@
|
||||
From 8bfe01395811790bab91f9418a6edeb84c67bf82 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 21 Feb 2014 00:50:46 -0500
|
||||
Subject: [PATCH] EMC Add EntityEffectAddedEvent
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityLiving.java | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 3cbd13e5d..f35daa374 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -803,6 +803,16 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // EMC start
|
||||
+ com.empireminecraft.customevents.EntityEffectAddedEvent addedEvent = new com.empireminecraft.customevents.EntityEffectAddedEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), new org.bukkit.potion.PotionEffect(
|
||||
+ org.bukkit.potion.PotionEffectType.getById(MobEffectList.getId(mobeffect.getMobEffect())),
|
||||
+ mobeffect.getDuration(), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles(), mobeffect.isShowIcon()));
|
||||
+ if (!addedEvent.callEvent()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ final org.bukkit.potion.PotionEffect effect = addedEvent.getEffect();
|
||||
+ mobeffect = new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon());
|
||||
+ // EMC end
|
||||
if (!this.d(mobeffect)) {
|
||||
return false;
|
||||
} else {
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 4be963b73f959de6fa6d5aa2c7c52e1a8bb90e0d Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 14 Apr 2014 20:44:38 -0400
|
||||
Subject: [PATCH] EMC Disable UUID conversion - Already done
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/DedicatedServer.java | 2 +-
|
||||
.../java/net/minecraft/server/NameReferencingFileConverter.java | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index 1f1243ae8..77651d228 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -250,7 +250,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
}
|
||||
|
||||
- if (this.convertNames()) {
|
||||
+ if (false) { // EMC - disable UUID Conversion
|
||||
this.getUserCache().c();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
index d3c2e1bed..286564108 100644
|
||||
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
||||
@@ -425,6 +425,7 @@ public class NameReferencingFileConverter {
|
||||
}
|
||||
|
||||
public static boolean e(MinecraftServer minecraftserver) {
|
||||
+ if (true) return true; // EMC - Disable UUID conversion
|
||||
boolean flag = b();
|
||||
|
||||
flag = flag && f(minecraftserver);
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,39 +0,0 @@
|
||||
From fc2073e34d536014f05201cbba184d55ea8ff2f5 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 12 Mar 2014 23:10:04 -0400
|
||||
Subject: [PATCH] EMC LivingEntityArmorProtectEvent
|
||||
|
||||
To control if armor should protect entity, how much if so, and how much item damage to give.
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityLiving.java | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index f35daa374..11be0931c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -39,6 +39,7 @@ import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
import co.aikar.timings.MinecraftTimings; // Paper
|
||||
+import com.empireminecraft.customevents.LivingEntityArmorProtectEvent; // EMC
|
||||
|
||||
public abstract class EntityLiving extends Entity {
|
||||
|
||||
@@ -1576,7 +1577,12 @@ public abstract class EntityLiving extends Entity {
|
||||
public int getArmorStrength() {
|
||||
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.ARMOR);
|
||||
|
||||
- return MathHelper.floor(attributeinstance.getValue());
|
||||
+ // EMC start
|
||||
+ final double value = attributeinstance.getValue();
|
||||
+ LivingEntityArmorProtectEvent event = new LivingEntityArmorProtectEvent(this.getBukkitLivingEntity(), value);
|
||||
+ event.callEvent();
|
||||
+ return MathHelper.floor(event.getArmorValue());
|
||||
+ // EMC end
|
||||
}
|
||||
|
||||
protected void damageArmor(float f) {}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,61 +0,0 @@
|
||||
From 8a17ab20323f2a0c9bb28767f61c8f44cd21eb9b Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 16 Mar 2014 20:44:46 -0400
|
||||
Subject: [PATCH] EMC EntityKnockbackEvent
|
||||
|
||||
Control knockback power of entity attacks
|
||||
---
|
||||
.../java/net/minecraft/server/EnchantmentManager.java | 9 +++++++--
|
||||
src/main/java/net/minecraft/server/EntityHuman.java | 2 +-
|
||||
src/main/java/net/minecraft/server/EntityInsentient.java | 2 +-
|
||||
3 files changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java
|
||||
index d96c03a1a..9fc637f96 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnchantmentManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java
|
||||
@@ -186,8 +186,13 @@ public class EnchantmentManager {
|
||||
}
|
||||
}
|
||||
|
||||
- public static int b(EntityLiving entityliving) {
|
||||
- return a(Enchantments.KNOCKBACK, entityliving);
|
||||
+ // EMC start - rename and add target
|
||||
+ public static int getKnockbackEnchantmentLevel(EntityLiving entityliving, EntityLiving target) { // EMC - OBF HELPER
|
||||
+ int level = a(Enchantments.KNOCKBACK, entityliving);
|
||||
+ com.empireminecraft.customevents.EntityKnockbackEvent event = new com.empireminecraft.customevents.EntityKnockbackEvent((org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(), target != null ? (org.bukkit.entity.LivingEntity) target.getBukkitEntity() : null, level);
|
||||
+ event.callEvent();
|
||||
+ return event.getLevel();
|
||||
+ // EMC end
|
||||
}
|
||||
|
||||
public static int getFireAspectEnchantmentLevel(EntityLiving entityliving) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 7df24be46..8f4bb71b1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -1062,7 +1062,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
boolean flag = f2 > 0.9F;
|
||||
boolean flag1 = false;
|
||||
byte b0 = 0;
|
||||
- int i = b0 + EnchantmentManager.b((EntityLiving) this);
|
||||
+ int i = b0 + EnchantmentManager.getKnockbackEnchantmentLevel(this, entity instanceof EntityLiving ? (EntityLiving) entity : null); // EMC
|
||||
|
||||
if (this.isSprinting() && flag) {
|
||||
sendSoundEffect(this, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index 5aca7a913..eec434374 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -1308,7 +1308,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
f += EnchantmentManager.a(this.getItemInMainHand(), ((EntityLiving) entity).getMonsterType());
|
||||
- f1 += (float) EnchantmentManager.b((EntityLiving) this);
|
||||
+ f1 += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity); // EMC
|
||||
}
|
||||
|
||||
int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,37 +0,0 @@
|
||||
From e7486752efce7b488d80f8dd7bcec48d24813140 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 22 Mar 2014 23:52:54 -0400
|
||||
Subject: [PATCH] EMC ZombieReinforcementEvent
|
||||
|
||||
Control when a zombie reinforcement event should occur (modify chance)
|
||||
also makes it run on all difficulty levels
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityZombie.java | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
index 07ebc1d81..7524fd75c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@@ -322,7 +322,17 @@ public class EntityZombie extends EntityMonster {
|
||||
entityliving = (EntityLiving) damagesource.getEntity();
|
||||
}
|
||||
|
||||
- if (entityliving != null && this.world.getDifficulty() == EnumDifficulty.HARD && (double) this.random.nextFloat() < this.getAttributeInstance(EntityZombie.d).getValue() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
|
||||
+ // EMC start
|
||||
+ boolean spawnReinforcements = false;
|
||||
+ if (entityliving != null && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
|
||||
+ final double chance = this.getAttributeInstance(EntityZombie.d).getValue();
|
||||
+ com.empireminecraft.customevents.ZombieReinforcementEvent event = new com.empireminecraft.customevents.ZombieReinforcementEvent( this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(), chance);
|
||||
+ if (event.callEvent()) {
|
||||
+ spawnReinforcements = this.random.nextFloat() < event.getChance();
|
||||
+ }
|
||||
+ }
|
||||
+ if (spawnReinforcements) {
|
||||
+ // EMC end
|
||||
int i = MathHelper.floor(this.locX());
|
||||
int j = MathHelper.floor(this.locY());
|
||||
int k = MathHelper.floor(this.locZ());
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 14c689580aaabdfd138bd91311381b404145d429 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 5 Sep 2014 23:04:54 -0400
|
||||
Subject: [PATCH] EMC Accept the EULA
|
||||
|
||||
Starlis LLC, the owner of Empire Minecraft, accepts the Minecraft EULA with this commit.
|
||||
---
|
||||
src/main/java/net/minecraft/server/MinecraftServer.java | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index d18387971..16535da3e 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1487,6 +1487,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." );
|
||||
}
|
||||
// Spigot End
|
||||
+ eulaAgreed = true; // EMC - Starlis LLC agrees to Mojangs EULA since we don't really have a choice now do we?
|
||||
if (!eula.a() && !eulaAgreed) { // Spigot
|
||||
MinecraftServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
|
||||
return;
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 86ac42a9b9e67be33add893995f516e32d5e9802 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 30 Apr 2015 22:12:01 -0400
|
||||
Subject: [PATCH] EMC Ignore statistics warnings
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/ServerStatisticManager.java | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
index 449e4ec8c..b3c9a5a84 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
@@ -113,15 +113,15 @@ public class ServerStatisticManager extends StatisticManager {
|
||||
SystemUtils.a(this.a(statisticwrapper, s2), (statistic) -> {
|
||||
this.a.put(statistic, nbttagcompound2.getInt(s2));
|
||||
}, () -> {
|
||||
- ServerStatisticManager.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.d, s2);
|
||||
+ //ServerStatisticManager.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.d, s2); // EMC
|
||||
});
|
||||
} else {
|
||||
- ServerStatisticManager.LOGGER.warn("Invalid statistic value in {}: Don't know what {} is for key {}", this.d, nbttagcompound2.get(s2), s2);
|
||||
+ //ServerStatisticManager.LOGGER.warn("Invalid statistic value in {}: Don't know what {} is for key {}", this.d, nbttagcompound2.get(s2), s2); // EMC
|
||||
}
|
||||
}
|
||||
|
||||
}, () -> {
|
||||
- ServerStatisticManager.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.d, s1);
|
||||
+ //ServerStatisticManager.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.d, s1); // EMC
|
||||
});
|
||||
}
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,24 +0,0 @@
|
||||
From 8838825c46b92baf9a3959360cc013e0e98512f6 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 25 Jun 2015 21:00:09 -0400
|
||||
Subject: [PATCH] EMC ServerReloadEvent
|
||||
|
||||
---
|
||||
src/main/java/org/bukkit/craftbukkit/CraftServer.java | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 6181f5886..206165c13 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -780,6 +780,7 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
public void reload() {
|
||||
org.spigotmc.WatchdogThread.hasStarted = false; // Paper - Disable watchdog early timeout on reload
|
||||
+ new com.empireminecraft.customevents.ServerReloadEvent().callEvent(); // EMC
|
||||
reloadCount++;
|
||||
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
|
||||
commandsConfiguration = YamlConfiguration.loadConfiguration(getCommandsConfigFile());
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,50 +0,0 @@
|
||||
From d783496b060c74d30ec174f08b4d28db6a32240c Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 21 Dec 2015 13:33:00 -0500
|
||||
Subject: [PATCH] EMC SnowmanThrowSnowballEvent
|
||||
|
||||
---
|
||||
.../net/minecraft/server/EntitySnowman.java | 20 +++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
index dee55c5de..9d1cfae9e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
@@ -9,6 +9,25 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.a);
|
||||
|
||||
+ // EMC start
|
||||
+ public static boolean fireEvent(EntitySnowman snowman, EntitySnowball snowball, EntityLiving target) {
|
||||
+ org.bukkit.entity.Snowman bukkitSnowman = (org.bukkit.entity.Snowman) snowman.getBukkitEntity();
|
||||
+ org.bukkit.entity.Snowball bukkitSnowball = (org.bukkit.entity.Snowball) snowball.getBukkitEntity();
|
||||
+ snowball.projectileSource = bukkitSnowman;
|
||||
+
|
||||
+ if (!(new org.bukkit.event.entity.ProjectileLaunchEvent(bukkitSnowball).callEvent())) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ com.empireminecraft.customevents.SnowmanThrowSnowballEvent event = new com.empireminecraft.customevents.SnowmanThrowSnowballEvent(
|
||||
+ bukkitSnowman,
|
||||
+ bukkitSnowball,
|
||||
+ target.getBukkitLivingEntity()
|
||||
+ );
|
||||
+ return event.callEvent();
|
||||
+ }
|
||||
+ // EMC end
|
||||
+
|
||||
public EntitySnowman(EntityTypes<? extends EntitySnowman> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
}
|
||||
@@ -98,6 +117,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
||||
float f1 = MathHelper.sqrt(d1 * d1 + d3 * d3) * 0.2F;
|
||||
|
||||
entitysnowball.shoot(d1, d2 + (double) f1, d3, 1.6F, 12.0F);
|
||||
+ if (!fireEvent(this, entitysnowball, entityliving)) return; // EMC
|
||||
this.a(SoundEffects.ENTITY_SNOW_GOLEM_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
this.world.addEntity(entitysnowball);
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 2f7775f215dfaa838a8f0291df085f0170d52616 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 1 Jun 2016 23:29:17 -0400
|
||||
Subject: [PATCH] EMC Reset Ender Crystals on Dragon Spawn
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EnderDragonBattle.java | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
index 687efa022..2617a6c0d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
@@ -403,6 +403,7 @@ public class EnderDragonBattle {
|
||||
entityenderdragon.setPositionRotation(0.0D, 128.0D, 0.0D, this.d.random.nextFloat() * 360.0F, 0.0F);
|
||||
this.d.addEntity(entityenderdragon);
|
||||
this.m = entityenderdragon.getUniqueID();
|
||||
+ this.resetCrystals(); // EMC
|
||||
return entityenderdragon;
|
||||
}
|
||||
|
||||
@@ -506,6 +507,7 @@ public class EnderDragonBattle {
|
||||
|
||||
}
|
||||
|
||||
+ private void resetCrystals() { this.f(); } // EMC // OBF HELPER
|
||||
public void f() {
|
||||
Iterator iterator = WorldGenEnder.a((GeneratorAccess) this.d).iterator();
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,33 +0,0 @@
|
||||
From ada07cd97f6156000435baa7ea856c47734567df Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 20 Dec 2017 21:42:45 -0500
|
||||
Subject: [PATCH] EMC EntityAttackedEntityEvent
|
||||
|
||||
For when you need to know one Entity has attacked another entity
|
||||
and that the damage event was not cancelled.
|
||||
---
|
||||
.../org/bukkit/craftbukkit/event/CraftEventFactory.java | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index ce8d7877a..b661951ef 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1008,7 +1008,14 @@ public class CraftEventFactory {
|
||||
callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
+ // Paper start
|
||||
+ if (damager != null && !com.destroystokyo.paper.event.entity.EntityAttackedEntityEvent.callEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, event.getFinalDamage())) {
|
||||
+ event.setCancelled(true);
|
||||
+ return event;
|
||||
+ }
|
||||
+ // Paper end
|
||||
event.getEntity().setLastDamageCause(event);
|
||||
+
|
||||
}
|
||||
|
||||
return event;
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,46 +0,0 @@
|
||||
From 979225fb1762c9b4aee62feba99afb9bc35f096b Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 17 Jun 2018 02:09:37 -0400
|
||||
Subject: [PATCH] EMC Human#getAttackPct
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityHuman.java | 2 ++
|
||||
.../java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 8f4bb71b1..c1e8ff6ab 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -79,6 +79,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
public boolean fauxSleeping;
|
||||
public String spawnWorld = "";
|
||||
public int oldLevel = -1;
|
||||
+ public float lastAttackPct = 0; // EMC
|
||||
|
||||
@Override
|
||||
public CraftHumanEntity getBukkitEntity() {
|
||||
@@ -1054,6 +1055,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
}
|
||||
|
||||
float f2 = this.s(0.5F);
|
||||
+ this.lastAttackPct = f2; // EMC
|
||||
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
index a2815073b..faa65ef20 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -72,6 +72,8 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
private boolean op;
|
||||
private GameMode mode;
|
||||
|
||||
+ @Override public float getAttackPct() { return getHandle().lastAttackPct; } // EMC
|
||||
+
|
||||
public CraftHumanEntity(final CraftServer server, final EntityHuman entity) {
|
||||
super(server, entity);
|
||||
mode = server.getDefaultGameMode();
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,50 +0,0 @@
|
||||
From f749ae5ccf988b6c09be53cf99b7e462063feb53 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 20 Jun 2018 22:35:39 -0400
|
||||
Subject: [PATCH] EMC Tweak Explosions
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/Explosion.java | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||
index 2552f860f..cfe37b7ff 100644
|
||||
--- a/src/main/java/net/minecraft/server/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
||||
@@ -97,6 +97,7 @@ public class Explosion {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
+ if (this.a || this.b != Effect.NONE) { // EMC - don't run block processing if neither flag is set
|
||||
for (int k = 0; k < 16; ++k) {
|
||||
for (i = 0; i < 16; ++i) {
|
||||
for (j = 0; j < 16; ++j) {
|
||||
@@ -142,6 +143,7 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ } // EMC - don't run block processing if neither flag is set
|
||||
|
||||
this.blocks.addAll(set);
|
||||
float f3 = this.size * 2.0F;
|
||||
@@ -156,7 +158,7 @@ public class Explosion {
|
||||
List<Entity> list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), new com.google.common.base.Predicate<Entity>() {
|
||||
@Override
|
||||
public boolean apply(Entity entity) {
|
||||
- return IEntitySelector.canAITarget().test(entity) && !entity.dead;
|
||||
+ return IEntitySelector.canAITarget().test(entity) && !entity.dead && !(entity instanceof EntityItem); // EMC
|
||||
}
|
||||
});
|
||||
// Paper end
|
||||
@@ -220,7 +222,7 @@ public class Explosion {
|
||||
boolean flag1 = this.b != Explosion.Effect.NONE;
|
||||
|
||||
if (flag) {
|
||||
- if (this.size >= 2.0F && flag1) {
|
||||
+ if (this.size >= 2.0F/* && flag1*/) { // EMC - don't care about block breaks flag for animation
|
||||
this.world.addParticle(Particles.EXPLOSION_EMITTER, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
this.world.addParticle(Particles.EXPLOSION, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 60e46f496c569bccb4bbba4846976ac50b1e8731 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 18 Aug 2018 22:03:33 -0400
|
||||
Subject: [PATCH] EMC SpawnEggMeta#setSpawnedEntity API
|
||||
|
||||
lets you copy an entities data into a spawn egg.
|
||||
Partial data is supported through a predicate, letting MC
|
||||
follow normal spawn behavior in the summon phase.
|
||||
---
|
||||
.../inventory/CraftMetaSpawnEgg.java | 25 +++++++++++++++++--
|
||||
1 file changed, 23 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
index 0634fb36d..24ac98e4d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
@@ -2,6 +2,9 @@ package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
import java.util.Map;
|
||||
+
|
||||
+import net.minecraft.server.DataConverterTypes; // EMC
|
||||
+import net.minecraft.server.DataConverters; // EMC
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.NBTBase;
|
||||
import net.minecraft.server.NBTTagCompound;
|
||||
@@ -75,9 +78,9 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||
}
|
||||
|
||||
// Tag still has some other data, lets try our luck with a conversion
|
||||
- if (!entityTag.isEmpty()) {
|
||||
+ if (!entityTag.isEmpty() && getVersion() > 0) { // EMC
|
||||
// SPIGOT-4128: This is hopeless until we start versioning stacks. RIP data.
|
||||
- // entityTag = (NBTTagCompound) MinecraftServer.getServer().dataConverterManager.update(DataConverterTypes.ENTITY, new Dynamic(DynamicOpsNBT.a, entityTag), -1, CraftMagicNumbers.DATA_VERSION).getValue();
|
||||
+ entityTag = DataConverters.convert(DataConverterTypes.ENTITY, entityTag, getVersion()); // EMC
|
||||
}
|
||||
|
||||
// See if we can read a converted ID tag
|
||||
@@ -188,6 +191,24 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||
return spawnedType != null;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private static final String[] removeKeys = {
|
||||
+ "UUIDLeast", "UUIDMost", "Pos", "PortalCooldown", "Paper.Origin", "Paper.FromMobSpawner", "Passengers", "Dimension"
|
||||
+ };
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSpawnedEntity(org.bukkit.entity.Entity entity, java.util.function.Predicate<String> keyFilter) {
|
||||
+ entityTag = ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().save(new NBTTagCompound());
|
||||
+ for (String removeKey : removeKeys) {
|
||||
+ entityTag.remove(removeKey);
|
||||
+ }
|
||||
+ if (keyFilter != null) {
|
||||
+ entityTag.map.keySet().removeIf(keyFilter);
|
||||
+ }
|
||||
+ entityTag.setBoolean("Paper.CustomSpawnEgg", true);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public EntityType getSpawnedType() {
|
||||
throw new UnsupportedOperationException("Must check item type to get spawned type");
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 01c6938c93255619c89e749911cc41df63f2655a Mon Sep 17 00:00:00 2001
|
||||
From: chickeneer <emcchickeneer@gmail.com>
|
||||
Date: Sun, 14 Jul 2019 13:50:53 -0500
|
||||
Subject: [PATCH] EMC ConduitNewTargetEvent and remove target for cancelled
|
||||
damage events
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/TileEntityConduit.java | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityConduit.java b/src/main/java/net/minecraft/server/TileEntityConduit.java
|
||||
index 34c191d76..3f487a9d9 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityConduit.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityConduit.java
|
||||
@@ -199,7 +199,14 @@ public class TileEntityConduit extends TileEntity implements ITickable {
|
||||
List<EntityLiving> list = this.world.a(EntityLiving.class, this.m(), (java.util.function.Predicate<EntityLiving>) (entityliving1) -> { // CraftBukkit - decompile error
|
||||
return entityliving1 instanceof IMonster && entityliving1.isInWaterOrRain();
|
||||
});
|
||||
-
|
||||
+ // EMC start
|
||||
+ List<org.bukkit.entity.LivingEntity> bukkitEntities = Lists.newArrayListWithCapacity(list.size());
|
||||
+ for (EntityLiving entity : list) {
|
||||
+ bukkitEntities.add(entity.getBukkitLivingEntity());
|
||||
+ }
|
||||
+ new com.empireminecraft.customevents.ConduitNewTargetEvent(bukkitEntities, CraftBlock.at(this.world, this.position)).callEvent();
|
||||
+ list.removeIf(entityLiving -> !bukkitEntities.contains(entityLiving.getBukkitLivingEntity()));
|
||||
+ // EMC end
|
||||
if (!list.isEmpty()) {
|
||||
this.target = (EntityLiving) list.get(this.world.random.nextInt(list.size()));
|
||||
}
|
||||
@@ -212,7 +219,7 @@ public class TileEntityConduit extends TileEntity implements ITickable {
|
||||
CraftEventFactory.blockDamage = CraftBlock.at(this.world, this.position);
|
||||
if (this.target.damageEntity(DamageSource.MAGIC, 4.0F)) {
|
||||
this.world.playSound((EntityHuman) null, this.target.locX(), this.target.locY(), this.target.locZ(), SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
- }
|
||||
+ } else { this.target = null; } // EMC
|
||||
CraftEventFactory.blockDamage = null;
|
||||
// CraftBukkit end
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,148 +0,0 @@
|
||||
From db51502b040569dcacc24b38213690c21bd8b4ca Mon Sep 17 00:00:00 2001
|
||||
From: willies952002 <admin@domnian.com>
|
||||
Date: Fri, 16 Aug 2019 22:18:35 -0400
|
||||
Subject: [PATCH] EMC Fix Bukkit.createInventory() with type LECTERN
|
||||
|
||||
This fixes an issue with Bukkit which makes it possible to open a Lectern interface, but not be able to interact with it (e.g.: change pages). The following changes had to be made:
|
||||
|
||||
nms.TileEntityLectern:
|
||||
- Add `virtual` flag, this is used to stop calls that would attempt to update a block which we do not have, as well as used in the following change.
|
||||
|
||||
nms.TileEntityLectern$LecternInventory
|
||||
- in `a(EntityHuman)`, add `(TileEntityLectern.this.virtual && TileEntityLectern.this.hasBook()) ||` to short-circuit the "can use" logic
|
||||
- Add `getLectern()` method for use in the following change.
|
||||
|
||||
obc.e.CraftHumanEntity#openInventory(Inventory):
|
||||
- Check if the wrapped inventory is a TileEntityLectern.LecternInventory, and get the Lectern from that
|
||||
|
||||
obc.i.u.CraftTileInventoryConverter$Lectern:
|
||||
- Mark the created lectern as "virtual"
|
||||
- Override `getInventory(IInventory)` to return a CraftInventoryLectern.
|
||||
|
||||
This patch is licensed under the MIT License.
|
||||
License: https://opensource.org/licenses/MIT
|
||||
---
|
||||
.../net/minecraft/server/TileEntityLectern.java | 14 +++++++++++---
|
||||
.../craftbukkit/entity/CraftHumanEntity.java | 6 ++++++
|
||||
.../util/CraftTileInventoryConverter.java | 13 ++++++++++++-
|
||||
3 files changed, 29 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityLectern.java b/src/main/java/net/minecraft/server/TileEntityLectern.java
|
||||
index c3b854b6a..2fa24a386 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityLectern.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityLectern.java
|
||||
@@ -18,6 +18,11 @@ public class TileEntityLectern extends TileEntity implements Clearable, ITileInv
|
||||
// CraftBukkit start - add fields and methods
|
||||
public IInventory inventory = new LecternInventory(); // Tuinity - need non-final for `createCopyForPush`
|
||||
public class LecternInventory implements IInventory {
|
||||
+ // EMC start
|
||||
+ public TileEntityLectern getLectern() {
|
||||
+ return TileEntityLectern.this;
|
||||
+ }
|
||||
+ // EMC end
|
||||
|
||||
public List<HumanEntity> transaction = new ArrayList<>();
|
||||
private int maxStack = 1;
|
||||
@@ -75,7 +80,7 @@ public class TileEntityLectern extends TileEntity implements Clearable, ITileInv
|
||||
|
||||
@Override
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
- if (i == 0) {
|
||||
+ if (i == 0 && !TileEntityLectern.this.virtual) { // EMC
|
||||
ItemStack itemstack = TileEntityLectern.this.book.cloneAndSubtract(j);
|
||||
|
||||
if (TileEntityLectern.this.book.isEmpty()) {
|
||||
@@ -90,7 +95,7 @@ public class TileEntityLectern extends TileEntity implements Clearable, ITileInv
|
||||
|
||||
@Override
|
||||
public ItemStack splitWithoutUpdate(int i) {
|
||||
- if (i == 0) {
|
||||
+ if (i == 0 && !TileEntityLectern.this.virtual) { // EMC
|
||||
ItemStack itemstack = TileEntityLectern.this.book;
|
||||
|
||||
TileEntityLectern.this.book = ItemStack.a;
|
||||
@@ -125,7 +130,7 @@ public class TileEntityLectern extends TileEntity implements Clearable, ITileInv
|
||||
|
||||
@Override
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
- return TileEntityLectern.this.world.getTileEntity(TileEntityLectern.this.position) != TileEntityLectern.this ? false : (entityhuman.g((double) TileEntityLectern.this.position.getX() + 0.5D, (double) TileEntityLectern.this.position.getY() + 0.5D, (double) TileEntityLectern.this.position.getZ() + 0.5D) > 64.0D ? false : TileEntityLectern.this.hasBook());
|
||||
+ return (TileEntityLectern.this.virtual && TileEntityLectern.this.hasBook()) || TileEntityLectern.this.world.getTileEntity(TileEntityLectern.this.position) != TileEntityLectern.this ? false : (entityhuman.g((double) TileEntityLectern.this.position.getX() + 0.5D, (double) TileEntityLectern.this.position.getY() + 0.5D, (double) TileEntityLectern.this.position.getZ() + 0.5D) > 64.0D ? false : TileEntityLectern.this.hasBook());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,6 +170,7 @@ public class TileEntityLectern extends TileEntity implements Clearable, ITileInv
|
||||
private ItemStack book;
|
||||
private int page;
|
||||
private int maxPage;
|
||||
+ public boolean virtual = false; // EMC
|
||||
|
||||
// Tuinity start - pushable TE's
|
||||
@Override
|
||||
@@ -198,6 +204,7 @@ public class TileEntityLectern extends TileEntity implements Clearable, ITileInv
|
||||
}
|
||||
|
||||
private void k() {
|
||||
+ if (this.virtual) return; // EMC
|
||||
this.page = 0;
|
||||
this.maxPage = 0;
|
||||
BlockLectern.setHasBook(this.getWorld(), this.getPosition(), this.getBlock(), false);
|
||||
@@ -215,6 +222,7 @@ public class TileEntityLectern extends TileEntity implements Clearable, ITileInv
|
||||
|
||||
if (j != this.page) {
|
||||
this.page = j;
|
||||
+ if (this.virtual) return; // EMC
|
||||
this.update();
|
||||
if (this.world != null) BlockLectern.a(this.getWorld(), this.getPosition(), this.getBlock()); // CraftBukkit
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
index faa65ef20..74b9c4516 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -31,6 +31,7 @@ import net.minecraft.server.PacketPlayInCloseWindow;
|
||||
import net.minecraft.server.PacketPlayOutOpenWindow;
|
||||
import net.minecraft.server.TileEntity;
|
||||
import net.minecraft.server.TileEntityContainer;
|
||||
+import net.minecraft.server.TileEntityLectern.LecternInventory;
|
||||
import net.minecraft.server.Vec3D;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@@ -328,6 +329,11 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
if (craft.getInventory() instanceof ITileInventory) {
|
||||
iinventory = (ITileInventory) craft.getInventory();
|
||||
}
|
||||
+ // EMC start
|
||||
+ if (craft.getInventory() instanceof LecternInventory) {
|
||||
+ iinventory = ((LecternInventory)craft.getInventory()).getLectern();
|
||||
+ }
|
||||
+ // EMC end
|
||||
}
|
||||
|
||||
if (iinventory instanceof ITileInventory) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
|
||||
index 32b36c70a..f0c1d6110 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java
|
||||
@@ -126,8 +126,19 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
||||
|
||||
@Override
|
||||
public IInventory getTileEntity() {
|
||||
- return new TileEntityLectern().inventory;
|
||||
+ // EMC start
|
||||
+ TileEntityLectern lectern = new TileEntityLectern();
|
||||
+ lectern.virtual = true;
|
||||
+ return lectern.inventory;
|
||||
+ // EMC end
|
||||
}
|
||||
+
|
||||
+ // EMC start
|
||||
+ @Override
|
||||
+ public Inventory getInventory(IInventory tileEntity) {
|
||||
+ return new org.bukkit.craftbukkit.inventory.CraftInventoryLectern(tileEntity);
|
||||
+ }
|
||||
+ // EMC end
|
||||
}
|
||||
|
||||
public static class Smoker extends CraftTileInventoryConverter {
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,33 +0,0 @@
|
||||
From ab02a56558a446bdd59ee0d545181dc1cc5c8654 Mon Sep 17 00:00:00 2001
|
||||
From: chickeneer <emcchickeneer@gmail.com>
|
||||
Date: Fri, 29 Nov 2019 02:48:17 -0600
|
||||
Subject: [PATCH] EMC Add the PlayerThrowTridentEvent
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/ItemTrident.java | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemTrident.java b/src/main/java/net/minecraft/server/ItemTrident.java
|
||||
index f571a1586..2997c0e98 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemTrident.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemTrident.java
|
||||
@@ -1,6 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.entity.Player;
|
||||
|
||||
public class ItemTrident extends Item {
|
||||
|
||||
@@ -62,6 +64,7 @@ public class ItemTrident extends Item {
|
||||
}
|
||||
return;
|
||||
}
|
||||
+ (new com.destroystokyo.paper.event.player.PlayerThrowTridentEvent((Player) entityhuman.getBukkitEntity(), CraftItemStack.asCraftMirror(itemstack), entitythrowntrident.getBukkitEntity())).callEvent(); // Paper
|
||||
|
||||
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
||||
entityhuman1.broadcastItemBreak(entityliving.getRaisedHand());
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,36 +0,0 @@
|
||||
From 92ca427597f1f01e52e82ba71c81b8148ceab7ef Mon Sep 17 00:00:00 2001
|
||||
From: chickeneer <emcchickeneer@gmail.com>
|
||||
Date: Fri, 17 Jan 2020 21:32:10 -0600
|
||||
Subject: [PATCH] EMC Add the BlockHarvestBeehiveEvent
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/IDispenseBehavior.java | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java
|
||||
index 3af686c7f..df0501b65 100644
|
||||
--- a/src/main/java/net/minecraft/server/IDispenseBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java
|
||||
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
// CraftBukkit start
|
||||
+import com.empireminecraft.customevents.BlockHarvestBeehiveEvent;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.TreeType;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@@ -861,6 +862,11 @@ public interface IDispenseBehavior {
|
||||
int k = (Integer) iblockdata.get(BlockBeehive.c);
|
||||
|
||||
if (k >= 5) {
|
||||
+ // EMC start
|
||||
+ if (!(new BlockHarvestBeehiveEvent(bukkitBlock, MCUtil.toBukkitBlock(world, blockposition), craftItem).callEvent())) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ // EMC end
|
||||
if (itemstack.isDamaged(1, world.random, (EntityPlayer) null)) {
|
||||
itemstack.setCount(0);
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From ba093bacd8385828644662b4da96ec7b57bed9ab Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 4 Jun 2019 15:50:08 -0500
|
||||
Subject: [PATCH] Purpur Fix 'outdated server' showing in ping before server
|
||||
fully boots
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/PacketStatusListener.java | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java
|
||||
index 4bb21c48b..30f16db02 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
|
||||
@@ -135,6 +135,7 @@ public class PacketStatusListener implements PacketStatusInListener {
|
||||
|
||||
this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
|
||||
*/
|
||||
+ if (this.minecraftServer.getServerPing().getServerData() == null) return; // Purpur - do not respond to pings before we know the protocol version
|
||||
com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(this.minecraftServer, this.networkManager);
|
||||
// Paper end
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,461 +0,0 @@
|
||||
From 6f518067553e9a77f33a2b71594219d86403f4ea Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Thu, 5 Mar 2020 22:31:50 +0100
|
||||
Subject: [PATCH] Add config, yapfa command and basic settings
|
||||
|
||||
---
|
||||
.../java/de/tr7zw/yapfa/YapfaCommand.java | 129 +++++++++++
|
||||
src/main/java/de/tr7zw/yapfa/YapfaConfig.java | 219 ++++++++++++++++++
|
||||
.../net/minecraft/server/DedicatedServer.java | 9 +
|
||||
.../java/net/minecraft/server/Entity.java | 7 +-
|
||||
.../net/minecraft/server/EntityLiving.java | 4 +
|
||||
5 files changed, 365 insertions(+), 3 deletions(-)
|
||||
create mode 100644 src/main/java/de/tr7zw/yapfa/YapfaCommand.java
|
||||
create mode 100644 src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
|
||||
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaCommand.java b/src/main/java/de/tr7zw/yapfa/YapfaCommand.java
|
||||
new file mode 100644
|
||||
index 000000000..76d83f3db
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/de/tr7zw/yapfa/YapfaCommand.java
|
||||
@@ -0,0 +1,129 @@
|
||||
+package de.tr7zw.yapfa;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collection;
|
||||
+import java.util.Collections;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+import java.util.Locale;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import com.google.common.base.Functions;
|
||||
+import com.google.common.collect.Iterables;
|
||||
+import com.google.common.collect.Lists;
|
||||
+
|
||||
+import net.minecraft.server.MinecraftKey;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+
|
||||
+public class YapfaCommand extends Command {
|
||||
+
|
||||
+ public YapfaCommand(String name) {
|
||||
+ super(name);
|
||||
+ this.description = "YAPFA related commands";
|
||||
+ this.usageMessage = "/yapfa [help | reload | info | version]";
|
||||
+ this.setPermission("bukkit.command.yapfa");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
|
||||
+ if (args.length <= 1)
|
||||
+ return getListMatchingLast(args, "help", "info", "reload", "version");
|
||||
+ return Collections.emptyList();
|
||||
+ }
|
||||
+
|
||||
+ // Code from Mojang - copyright them
|
||||
+ public static List<String> getListMatchingLast(String[] args, String... matches) {
|
||||
+ return getListMatchingLast(args, (Collection) Arrays.asList(matches));
|
||||
+ }
|
||||
+
|
||||
+ public static boolean matches(String s, String s1) {
|
||||
+ return s1.regionMatches(true, 0, s, 0, s.length());
|
||||
+ }
|
||||
+
|
||||
+ public static List<String> getListMatchingLast(String[] strings, Collection<?> collection) {
|
||||
+ String last = strings[strings.length - 1];
|
||||
+ ArrayList<String> results = Lists.newArrayList();
|
||||
+
|
||||
+ if (!collection.isEmpty()) {
|
||||
+ Iterator iterator = Iterables.transform(collection, Functions.toStringFunction()).iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ String s1 = (String) iterator.next();
|
||||
+
|
||||
+ if (matches(last, s1)) {
|
||||
+ results.add(s1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (results.isEmpty()) {
|
||||
+ iterator = collection.iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ Object object = iterator.next();
|
||||
+
|
||||
+ if (object instanceof MinecraftKey && matches(last, ((MinecraftKey) object).getKey())) {
|
||||
+ results.add(String.valueOf(object));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return results;
|
||||
+ }
|
||||
+ // end copy stuff
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
+ if (!testPermission(sender)) return true;
|
||||
+
|
||||
+ if (args.length == 0) {
|
||||
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ switch (args[0].toLowerCase(Locale.ENGLISH)) {
|
||||
+ case "info":
|
||||
+ doInfo(sender);
|
||||
+ break;
|
||||
+ case "reload":
|
||||
+ doReload(sender);
|
||||
+ break;
|
||||
+ case "ver":
|
||||
+ case "version":
|
||||
+ Command ver = org.bukkit.Bukkit.getServer().getCommandMap().getCommand("version");
|
||||
+ if (ver != null) {
|
||||
+ ver.execute(sender, commandLabel, new String[0]);
|
||||
+ break;
|
||||
+ }
|
||||
+ // else - fall through to default
|
||||
+ default:
|
||||
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ private void doInfo(CommandSender sender) {
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Last tick took " + Bukkit.getLastTickMs() + "ms");
|
||||
+ //TODO
|
||||
+ }
|
||||
+
|
||||
+ private void doReload(CommandSender sender) {
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues.");
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||
+
|
||||
+ MinecraftServer console = MinecraftServer.getServer();
|
||||
+ de.tr7zw.yapfa.YapfaConfig.init(new File("yapfa.yml"));
|
||||
+ console.server.reloadCount++;
|
||||
+
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "YAPFA config reload complete.");
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
new file mode 100644
|
||||
index 000000000..9711cbc52
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
@@ -0,0 +1,219 @@
|
||||
+package de.tr7zw.yapfa;
|
||||
+
|
||||
+import com.destroystokyo.paper.io.chunk.ChunkTaskManager;
|
||||
+import com.google.common.base.Strings;
|
||||
+import com.google.common.base.Throwables;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.nio.charset.StandardCharsets;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+import java.util.logging.Level;
|
||||
+import java.util.regex.Pattern;
|
||||
+
|
||||
+import com.google.common.collect.Lists;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+import co.aikar.timings.Timings;
|
||||
+import co.aikar.timings.TimingsManager;
|
||||
+import org.spigotmc.SpigotConfig;
|
||||
+import org.spigotmc.WatchdogThread;
|
||||
+
|
||||
+public class YapfaConfig {
|
||||
+
|
||||
+ private static File CONFIG_FILE;
|
||||
+ private static final String HEADER = "This is the main configuration file for YAPFA.\n"
|
||||
+ + "YAPFA contains many breaking changes and settings, so know what you are doing!\n"
|
||||
+ + "You have been warned!\n";
|
||||
+ /*========================================================================*/
|
||||
+ public static YamlConfiguration config;
|
||||
+ static int version;
|
||||
+ static Map<String, Command> commands;
|
||||
+ private static boolean verbose;
|
||||
+ private static boolean fatalError;
|
||||
+ /*========================================================================*/
|
||||
+ private static boolean metricsStarted;
|
||||
+
|
||||
+ public static void init(File configFile) {
|
||||
+ CONFIG_FILE = configFile;
|
||||
+ config = new YamlConfiguration();
|
||||
+ try {
|
||||
+ config.load(CONFIG_FILE);
|
||||
+ } catch (IOException ex) {
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load yapfa.yml, please correct your syntax errors", ex);
|
||||
+ throw Throwables.propagate(ex);
|
||||
+ }
|
||||
+ config.options().header(HEADER);
|
||||
+ config.options().copyDefaults(true);
|
||||
+ verbose = getBoolean("verbose", false);
|
||||
+
|
||||
+ commands = new HashMap<String, Command>();
|
||||
+ commands.put("yapfa", new YapfaCommand("yapfa"));
|
||||
+
|
||||
+ version = getInt("config-version", 1);
|
||||
+ set("config-version", 1);
|
||||
+ readConfig(YapfaConfig.class, null);
|
||||
+ }
|
||||
+
|
||||
+ protected static void logError(String s) {
|
||||
+ Bukkit.getLogger().severe(s);
|
||||
+ }
|
||||
+
|
||||
+ protected static void fatal(String s) {
|
||||
+ fatalError = true;
|
||||
+ throw new RuntimeException("Fatal yapfa.yml config error: " + s);
|
||||
+ }
|
||||
+
|
||||
+ protected static void log(String s) {
|
||||
+ if (verbose) {
|
||||
+ Bukkit.getLogger().info(s);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void registerCommands() {
|
||||
+ for (Map.Entry<String, Command> entry : commands.entrySet()) {
|
||||
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Yapfa", entry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static void readConfig(Class<?> clazz, Object instance) {
|
||||
+ for (Method method : clazz.getDeclaredMethods()) {
|
||||
+ if (Modifier.isPrivate(method.getModifiers())) {
|
||||
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
||||
+ try {
|
||||
+ method.setAccessible(true);
|
||||
+ method.invoke(instance);
|
||||
+ } catch (InvocationTargetException ex) {
|
||||
+ throw Throwables.propagate(ex.getCause());
|
||||
+ } catch (Exception ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ config.save(CONFIG_FILE);
|
||||
+ } catch (IOException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static final Pattern SPACE = Pattern.compile(" ");
|
||||
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||
+ public static int getSeconds(String str) {
|
||||
+ str = SPACE.matcher(str).replaceAll("");
|
||||
+ final char unit = str.charAt(str.length() - 1);
|
||||
+ str = NOT_NUMERIC.matcher(str).replaceAll("");
|
||||
+ double num;
|
||||
+ try {
|
||||
+ num = Double.parseDouble(str);
|
||||
+ } catch (Exception e) {
|
||||
+ num = 0D;
|
||||
+ }
|
||||
+ switch (unit) {
|
||||
+ case 'd': num *= (double) 60*60*24; break;
|
||||
+ case 'h': num *= (double) 60*60; break;
|
||||
+ case 'm': num *= (double) 60; break;
|
||||
+ default: case 's': break;
|
||||
+ }
|
||||
+ return (int) num;
|
||||
+ }
|
||||
+
|
||||
+ protected static String timeSummary(int seconds) {
|
||||
+ String time = "";
|
||||
+
|
||||
+ if (seconds > 60 * 60 * 24) {
|
||||
+ time += TimeUnit.SECONDS.toDays(seconds) + "d";
|
||||
+ seconds %= 60 * 60 * 24;
|
||||
+ }
|
||||
+
|
||||
+ if (seconds > 60 * 60) {
|
||||
+ time += TimeUnit.SECONDS.toHours(seconds) + "h";
|
||||
+ seconds %= 60 * 60;
|
||||
+ }
|
||||
+
|
||||
+ if (seconds > 0) {
|
||||
+ time += TimeUnit.SECONDS.toMinutes(seconds) + "m";
|
||||
+ }
|
||||
+ return time;
|
||||
+ }
|
||||
+
|
||||
+ private static void set(String path, Object val) {
|
||||
+ config.set(path, val);
|
||||
+ }
|
||||
+
|
||||
+ private static boolean getBoolean(String path, boolean def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getBoolean(path, config.getBoolean(path));
|
||||
+ }
|
||||
+
|
||||
+ private static double getDouble(String path, double def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getDouble(path, config.getDouble(path));
|
||||
+ }
|
||||
+
|
||||
+ private static float getFloat(String path, float def) {
|
||||
+ // TODO: Figure out why getFloat() always returns the default value.
|
||||
+ return (float) getDouble(path, (double) def);
|
||||
+ }
|
||||
+
|
||||
+ private static int getInt(String path, int def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getInt(path, config.getInt(path));
|
||||
+ }
|
||||
+
|
||||
+ private static <T> List getList(String path, T def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return (List<T>) config.getList(path, config.getList(path));
|
||||
+ }
|
||||
+
|
||||
+ private static String getString(String path, String def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getString(path, config.getString(path));
|
||||
+ }
|
||||
+
|
||||
+ public static boolean disableEntityWaterChecks = false;
|
||||
+ private static void disableEntityWaterChecks() {
|
||||
+ disableEntityWaterChecks = getBoolean("settings.disableEntityWaterChecks", false);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean disableEntityStuckChecks = false;
|
||||
+ private static void disableEntityStuckChecks() {
|
||||
+ disableEntityStuckChecks = getBoolean("settings.disableEntityStuckChecks", false);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean disablePlayerOutOfWorldBorderCheck = false;
|
||||
+ private static void disablePlayerOutOfWorldBorderCheck() {
|
||||
+ disablePlayerOutOfWorldBorderCheck = getBoolean("settings.disablePlayerOutOfWorldBorderCheck", false);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean disableEntityCollisions = false;
|
||||
+ private static void disableEntityCollisions() {
|
||||
+ disableEntityCollisions = getBoolean("settings.disableEntityCollisions", false);
|
||||
+ }
|
||||
+
|
||||
+ public static int checkEntityBlockCollisionTicks = 1;
|
||||
+ private static void checkEntityBlockCollisionTicks() {
|
||||
+ checkEntityBlockCollisionTicks = getInt("settings.checkEntityBlockCollisionTicks", 1);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean disableEntityCollisionboxes = false;
|
||||
+ private static void disableEntityCollisionboxes() {
|
||||
+ disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index 77651d228..bbf4f1ef6 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -194,6 +194,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
com.destroystokyo.paper.PaperConfig.registerCommands();
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
// Paper end
|
||||
+ // YAPFA start
|
||||
+ try {
|
||||
+ de.tr7zw.yapfa.YapfaConfig.init(new File("yapfa.yml"));
|
||||
+ } catch (Exception e) {
|
||||
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||||
+ return false;
|
||||
+ }
|
||||
+ de.tr7zw.yapfa.YapfaConfig.registerCommands();
|
||||
+ // YAPFA end
|
||||
com.tuinity.tuinity.config.TuinityConfig.init((File) options.valueOf("tuinity-settings")); // Tuinity - Server Config
|
||||
|
||||
this.setSpawnAnimals(dedicatedserverproperties.spawnAnimals);
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 6d62a1af5..2e3329bd2 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -768,6 +768,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
||||
try {
|
||||
this.inLava = false;
|
||||
+ if(MinecraftServer.currentTick % de.tr7zw.yapfa.YapfaConfig.checkEntityBlockCollisionTicks == 0) // YAPFA
|
||||
this.checkBlockCollisions();
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision");
|
||||
@@ -1029,9 +1030,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
private Vec3D e(Vec3D vec3d) {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this);
|
||||
- VoxelShape voxelshape = this.world.getWorldBorder().a();
|
||||
- Stream<VoxelShape> stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(this.world.getWorldBorder().a()); // Paper
|
||||
- Stream<VoxelShape> stream1 = this.world.b(this, axisalignedbb.a(vec3d), (Set) ImmutableSet.of());
|
||||
+
|
||||
+ Stream<VoxelShape> stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(this.world.getWorldBorder().a()); // Tuinity - optimise voxelshapes
|
||||
+ Stream<VoxelShape> stream1 = de.tr7zw.yapfa.YapfaConfig.disableEntityCollisionboxes ? Stream.empty() : this.world.b(this, axisalignedbb.a(vec3d), (Set) ImmutableSet.of()); // YAPFA
|
||||
StreamAccumulator<VoxelShape> streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream));
|
||||
Vec3D vec3d1 = vec3d.g() == 0.0D ? vec3d : a(this, vec3d, axisalignedbb, this.world, voxelshapecollision, streamaccumulator);
|
||||
boolean flag = vec3d.x != vec3d1.x;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 11be0931c..b77960710 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -246,6 +246,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.world.getMethodProfiler().enter("livingEntityBaseTick");
|
||||
boolean flag = this instanceof EntityHuman;
|
||||
|
||||
+ if(!de.tr7zw.yapfa.YapfaConfig.disableEntityStuckChecks) { // YAPFA start
|
||||
if (this.isAlive()) {
|
||||
if (this.inBlock()) {
|
||||
this.damageEntity(DamageSource.STUCK, 1.0F);
|
||||
@@ -261,6 +262,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ } // YAPFA end
|
||||
|
||||
if (this.isFireProof() || this.world.isClientSide) {
|
||||
this.extinguish();
|
||||
@@ -269,6 +271,7 @@ public abstract class EntityLiving extends Entity {
|
||||
boolean flag1 = flag && ((EntityHuman) this).abilities.isInvulnerable;
|
||||
|
||||
if (this.isAlive()) {
|
||||
+ if(this instanceof EntityPlayer || !de.tr7zw.yapfa.YapfaConfig.disableEntityWaterChecks) { // YAPFA start
|
||||
if (this.a(TagsFluid.WATER) && this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).getBlock() != Blocks.BUBBLE_COLUMN) {
|
||||
if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden
|
||||
this.setAirTicks(this.l(this.getAirTicks()));
|
||||
@@ -294,6 +297,7 @@ public abstract class EntityLiving extends Entity {
|
||||
} else if (this.getAirTicks() < this.bw()) {
|
||||
this.setAirTicks(this.m(this.getAirTicks()));
|
||||
}
|
||||
+ } // YAPFA end
|
||||
|
||||
if (!this.world.isClientSide) {
|
||||
BlockPosition blockposition = new BlockPosition(this);
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,93 +0,0 @@
|
||||
From 1f3dd8087b0e674afbaa194b51590251711a6991 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Thu, 5 Mar 2020 23:08:01 +0100
|
||||
Subject: [PATCH] Kill the vanilla "GameProfiler"
|
||||
|
||||
---
|
||||
.../de/tr7zw/yapfa/GameProfilerDisabled.java | 51 +++++++++++++++++++
|
||||
.../net/minecraft/server/MinecraftServer.java | 4 +-
|
||||
2 files changed, 53 insertions(+), 2 deletions(-)
|
||||
create mode 100644 src/main/java/de/tr7zw/yapfa/GameProfilerDisabled.java
|
||||
|
||||
diff --git a/src/main/java/de/tr7zw/yapfa/GameProfilerDisabled.java b/src/main/java/de/tr7zw/yapfa/GameProfilerDisabled.java
|
||||
new file mode 100644
|
||||
index 000000000..96a2270a8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/de/tr7zw/yapfa/GameProfilerDisabled.java
|
||||
@@ -0,0 +1,51 @@
|
||||
+package de.tr7zw.yapfa;
|
||||
+
|
||||
+import java.util.function.IntSupplier;
|
||||
+import java.util.function.Supplier;
|
||||
+
|
||||
+import net.minecraft.server.GameProfiler;
|
||||
+
|
||||
+public class GameProfilerDisabled extends GameProfiler{
|
||||
+
|
||||
+ public GameProfilerDisabled(IntSupplier var0) {
|
||||
+ super(var0);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraft.server.GameProfiler.a d() {
|
||||
+ return super.d();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void a() {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void b() {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void enter(String var0) {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void a(Supplier<String> var0) {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void exit() {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void exitEnter(String var0) {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void c(String var0) {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void c(Supplier<String> var0) {
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f41584b85..53acfcd5b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -80,7 +80,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
private final MojangStatisticsGenerator snooper = new MojangStatisticsGenerator("server", this, SystemUtils.getMonotonicMillis());
|
||||
public File universe;
|
||||
private final List<Runnable> tickables = Lists.newArrayList();
|
||||
- private final GameProfiler methodProfiler = new GameProfiler(this::ak);
|
||||
+ private final GameProfiler methodProfiler = new de.tr7zw.yapfa.GameProfilerDisabled(this::ak); // YAPFA
|
||||
private ServerConnection serverConnection;
|
||||
public final WorldLoadListenerFactory worldLoadListenerFactory;
|
||||
private final ServerPing serverPing = new ServerPing();
|
||||
@@ -964,7 +964,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.nextTick += 50L;
|
||||
if (this.T) {
|
||||
this.T = false;
|
||||
- this.methodProfiler.d().d();
|
||||
+ //this.methodProfiler.d().d(); // YAPFA
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,589 +0,0 @@
|
||||
From 54a9bdd5035163c71af0cb425d3a9945be4d19d2 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 23 Mar 2020 18:20:58 +0100
|
||||
Subject: [PATCH] Remove Stream usage
|
||||
|
||||
This removes streams from the entity collision code, Crafting Manager and some other useless places.
|
||||
---
|
||||
.../yapfa/collision/CollisionHelper.java | 123 +++++++++++++++
|
||||
src/main/java/net/minecraft/server/Block.java | 2 +-
|
||||
.../net/minecraft/server/BlockPosition.java | 2 +-
|
||||
.../net/minecraft/server/CraftingManager.java | 58 +++++--
|
||||
.../java/net/minecraft/server/Entity.java | 145 ++++++++++++++++--
|
||||
.../net/minecraft/server/EntityLiving.java | 1 +
|
||||
.../net/minecraft/server/VoxelShapes.java | 103 +++++++++++++
|
||||
7 files changed, 400 insertions(+), 34 deletions(-)
|
||||
create mode 100644 src/main/java/de/tr7zw/yapfa/collision/CollisionHelper.java
|
||||
|
||||
diff --git a/src/main/java/de/tr7zw/yapfa/collision/CollisionHelper.java b/src/main/java/de/tr7zw/yapfa/collision/CollisionHelper.java
|
||||
new file mode 100644
|
||||
index 000000000..d67753937
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/de/tr7zw/yapfa/collision/CollisionHelper.java
|
||||
@@ -0,0 +1,123 @@
|
||||
+package de.tr7zw.yapfa.collision;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import java.util.Spliterator;
|
||||
+import java.util.Spliterators;
|
||||
+import java.util.Spliterators.AbstractSpliterator;
|
||||
+import java.util.function.Consumer;
|
||||
+
|
||||
+import javax.annotation.Nullable;
|
||||
+
|
||||
+import com.google.common.collect.Lists;
|
||||
+
|
||||
+import net.minecraft.server.AxisAlignedBB;
|
||||
+import net.minecraft.server.BlockPosition;
|
||||
+import net.minecraft.server.BlockPosition.MutableBlockPosition;
|
||||
+import net.minecraft.server.Blocks;
|
||||
+import net.minecraft.server.CursorPosition;
|
||||
+import net.minecraft.server.Entity;
|
||||
+import net.minecraft.server.IBlockAccess;
|
||||
+import net.minecraft.server.IBlockData;
|
||||
+import net.minecraft.server.ICollisionAccess;
|
||||
+import net.minecraft.server.MathHelper;
|
||||
+import net.minecraft.server.OperatorBoolean;
|
||||
+import net.minecraft.server.StreamAccumulator;
|
||||
+import net.minecraft.server.VoxelShape;
|
||||
+import net.minecraft.server.VoxelShapeCollision;
|
||||
+import net.minecraft.server.VoxelShapes;
|
||||
+
|
||||
+public class CollisionHelper {
|
||||
+
|
||||
+ public static AbstractSpliterator<VoxelShape> b(ICollisionAccess collisionAccess, VoxelShape worldBorder, @Nullable Entity var0, AxisAlignedBB var1) {
|
||||
+ int var2 = MathHelper.floor((double) (var1.minX - 1.0E-7)) - 1;
|
||||
+ int var3 = MathHelper.floor((double) (var1.maxX + 1.0E-7)) + 1;
|
||||
+ int var4 = MathHelper.floor((double) (var1.minY - 1.0E-7)) - 1;
|
||||
+ int var5 = MathHelper.floor((double) (var1.maxY + 1.0E-7)) + 1;
|
||||
+ int var6 = MathHelper.floor((double) (var1.minZ - 1.0E-7)) - 1;
|
||||
+ int var7 = MathHelper.floor((double) (var1.maxZ + 1.0E-7)) + 1;
|
||||
+ final VoxelShapeCollision var8 = var0 == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) var0);
|
||||
+ final CursorPosition var9 = new CursorPosition(var2, var4, var6, var3, var5, var7);
|
||||
+ final BlockPosition.MutableBlockPosition var10 = new BlockPosition.MutableBlockPosition();
|
||||
+ final VoxelShape var11 = VoxelShapes.a((AxisAlignedBB) var1);
|
||||
+ return new Spliterators.AbstractSpliterator<VoxelShape>(Long.MAX_VALUE, 1280) {
|
||||
+ boolean a;
|
||||
+ {
|
||||
+
|
||||
+ this.a = var0 == null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean tryAdvance(Consumer<? super VoxelShape> var02) {
|
||||
+ int var2;
|
||||
+ int var3;
|
||||
+ if (!this.a) {
|
||||
+ this.a = true;
|
||||
+ VoxelShape var1 = collisionAccess.getWorldBorder().a();
|
||||
+ var2 = VoxelShapes.c((VoxelShape) var1,
|
||||
+ (VoxelShape) VoxelShapes.a((AxisAlignedBB) var0.getBoundingBox().shrink(1.0E-7)),
|
||||
+ (OperatorBoolean) OperatorBoolean.AND) ? 1 : 0;
|
||||
+ var3 = VoxelShapes.c((VoxelShape) var1,
|
||||
+ (VoxelShape) VoxelShapes.a((AxisAlignedBB) var0.getBoundingBox().g(1.0E-7)),
|
||||
+ (OperatorBoolean) OperatorBoolean.AND) ? 1 : 0;
|
||||
+ if (var2 == 0 && var3 != 0) {
|
||||
+ var02.accept((VoxelShape) var1);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ while (var9.a()) {
|
||||
+ IBlockAccess var7;
|
||||
+ int var6;
|
||||
+ int var5;
|
||||
+ VoxelShape var92;
|
||||
+ VoxelShape var102;
|
||||
+ int var1 = var9.b();
|
||||
+ var2 = var9.c();
|
||||
+ var3 = var9.d();
|
||||
+ int var4 = var9.e();
|
||||
+ if (var4 == 3 || (var7 = collisionAccess.c(var5 = var1 >> 4, var6 = var3 >> 4)) == null)
|
||||
+ continue;
|
||||
+ var10.d(var1, var2, var3);
|
||||
+ IBlockData var82 = var7.getType((BlockPosition) var10);
|
||||
+ if (var4 == 1 && !var82.f() || var4 == 2 && var82.getBlock() != Blocks.MOVING_PISTON
|
||||
+ || !VoxelShapes.c((VoxelShape) var11,
|
||||
+ (VoxelShape) (var102 = (var92 = var82.b((IBlockAccess) collisionAccess,
|
||||
+ (BlockPosition) var10, var8)).a((double) var1, (double) var2,
|
||||
+ (double) var3)),
|
||||
+ (OperatorBoolean) OperatorBoolean.AND))
|
||||
+ continue;
|
||||
+ var02.accept((VoxelShape) var102);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ public static class SpliteratorAccumulator<T> {
|
||||
+ private final List<T> a = Lists.newArrayList();
|
||||
+ private final Spliterator<T> b;
|
||||
+
|
||||
+ public SpliteratorAccumulator(Spliterator<T> var0) {
|
||||
+ this.b = var0;
|
||||
+ }
|
||||
+
|
||||
+ public Spliterators.AbstractSpliterator<T> a() {
|
||||
+ return new Spliterators.AbstractSpliterator<T>(Long.MAX_VALUE, 0) {
|
||||
+ private int b;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean tryAdvance(Consumer<? super T> var0) {
|
||||
+ while (this.b >= SpliteratorAccumulator.this.a.size()) {
|
||||
+ if (SpliteratorAccumulator.this.b.tryAdvance(SpliteratorAccumulator.this.a::add))
|
||||
+ continue;
|
||||
+ return false;
|
||||
+ }
|
||||
+ var0.accept(SpliteratorAccumulator.this.a.get(this.b++));
|
||||
+ return true;
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
|
||||
index 66244a9d0..7b3a71e33 100644
|
||||
--- a/src/main/java/net/minecraft/server/Block.java
|
||||
+++ b/src/main/java/net/minecraft/server/Block.java
|
||||
@@ -100,7 +100,7 @@ public class Block implements IMaterial {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
- double d0 = VoxelShapes.a(EnumDirection.EnumAxis.Y, entity.getBoundingBox().d(0.0D, 1.0D, 0.0D), Stream.of(voxelshape), -1.0D);
|
||||
+ double d0 = VoxelShapes.a(EnumDirection.EnumAxis.Y, entity.getBoundingBox().d(0.0D, 1.0D, 0.0D), voxelshape, -1.0D); // YAPFA
|
||||
|
||||
entity.enderTeleportTo(entity.locX(), entity.locY() + 1.0D + d0, entity.locZ());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 4c64798fb..c429470cd 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -72,7 +72,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
|
||||
@Override
|
||||
public <T> T a(DynamicOps<T> dynamicops) {
|
||||
- return dynamicops.createIntList(IntStream.of(new int[]{this.getX(), this.getY(), this.getZ()}));
|
||||
+ return (T) new NBTTagIntArray(new int[]{this.getX(), this.getY(), this.getZ()}); // YAPFA
|
||||
}
|
||||
|
||||
public static long getAdjacent(int baseX, int baseY, int baseZ, EnumDirection enumdirection) { return asLong(baseX + enumdirection.getAdjacentX(), baseY + enumdirection.getAdjacentY(), baseZ + enumdirection.getAdjacentZ()); } // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
index f0d7a91fa..15e2439d6 100644
|
||||
--- a/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
@@ -8,14 +8,18 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
+import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
+import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -82,21 +86,31 @@ public class CraftingManager extends ResourceDataJson {
|
||||
// CraftBukkit end
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<T> craft(Recipes<T> recipes, C c0, World world) {
|
||||
- // CraftBukkit start
|
||||
- Optional<T> recipe = this.a(recipes).values().stream().flatMap((irecipe) -> {
|
||||
- return SystemUtils.a(recipes.a(irecipe, world, c0));
|
||||
- }).findFirst();
|
||||
- c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
|
||||
- // CraftBukkit end
|
||||
- return recipe;
|
||||
+ // YAPFA start
|
||||
+ for(IRecipe<C> rep : this.a(recipes).values()) {
|
||||
+ Optional<T> optional = recipes.a(rep, world, c0);
|
||||
+ if(optional.isPresent()) {
|
||||
+ c0.setCurrentRecipe(optional.get());
|
||||
+ return optional;
|
||||
+ }
|
||||
+ }
|
||||
+ c0.setCurrentRecipe(null); // CraftBukkit - Clear recipe when no recipe is found
|
||||
+ return Optional.empty();
|
||||
+ // YAPFA end
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> List<T> b(Recipes<T> recipes, C c0, World world) {
|
||||
- return (List) this.a(recipes).values().stream().flatMap((irecipe) -> {
|
||||
- return SystemUtils.a(recipes.a(irecipe, world, c0));
|
||||
- }).sorted(Comparator.comparing((irecipe) -> {
|
||||
+ // YAPFA start
|
||||
+ List<T> list = new ArrayList<T>();
|
||||
+ for(IRecipe<C> rec : this.a(recipes).values()) {
|
||||
+ Optional<T> optional = recipes.a(rec, world, c0);
|
||||
+ optional.ifPresent(list::add);
|
||||
+ }
|
||||
+ list.sort(Comparator.comparing((irecipe) -> {
|
||||
return irecipe.getResult().j();
|
||||
- })).collect(Collectors.toList());
|
||||
+ }));
|
||||
+ return list;
|
||||
+ // YAPFA end
|
||||
}
|
||||
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> a(Recipes<T> recipes) {
|
||||
@@ -120,15 +134,25 @@ public class CraftingManager extends ResourceDataJson {
|
||||
}
|
||||
|
||||
public Optional<? extends IRecipe<?>> a(MinecraftKey minecraftkey) {
|
||||
- return this.recipes.values().stream().map((map) -> {
|
||||
- return map.get(minecraftkey); // CraftBukkit - decompile error
|
||||
- }).filter(Objects::nonNull).findFirst();
|
||||
+ // YAPFA start
|
||||
+ for(Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map : this.recipes.values()) {
|
||||
+ IRecipe<?> rec = map.get(minecraftkey);
|
||||
+ if(rec != null) {
|
||||
+ return Optional.of(rec);
|
||||
+ }
|
||||
+ }
|
||||
+ return Optional.empty();
|
||||
+ // YAPFA end
|
||||
}
|
||||
|
||||
public Collection<IRecipe<?>> b() {
|
||||
- return (Collection) this.recipes.values().stream().flatMap((map) -> {
|
||||
- return map.values().stream();
|
||||
- }).collect(Collectors.toSet());
|
||||
+ // YAPFA start
|
||||
+ Set<IRecipe<?>> recipes = new HashSet<IRecipe<?>>();
|
||||
+ for(Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map : this.recipes.values()) {
|
||||
+ recipes.addAll(map.values());
|
||||
+ }
|
||||
+ return recipes;
|
||||
+ // YAPFA end
|
||||
}
|
||||
|
||||
public Stream<MinecraftKey> c() {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 2e3329bd2..902c98cf8 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -13,6 +13,7 @@ import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
+import java.util.Spliterators.AbstractSpliterator;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Stream;
|
||||
@@ -1030,31 +1031,60 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
private Vec3D e(Vec3D vec3d) {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this);
|
||||
-
|
||||
- Stream<VoxelShape> stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(this.world.getWorldBorder().a()); // Tuinity - optimise voxelshapes
|
||||
- Stream<VoxelShape> stream1 = de.tr7zw.yapfa.YapfaConfig.disableEntityCollisionboxes ? Stream.empty() : this.world.b(this, axisalignedbb.a(vec3d), (Set) ImmutableSet.of()); // YAPFA
|
||||
- StreamAccumulator<VoxelShape> streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream));
|
||||
- Vec3D vec3d1 = vec3d.g() == 0.0D ? vec3d : a(this, vec3d, axisalignedbb, this.world, voxelshapecollision, streamaccumulator);
|
||||
+ VoxelShape worldBorder = this.world.getWorldBorder().a();
|
||||
+ // YAPFA start
|
||||
+ Vec3D vec3d1;
|
||||
+ StreamAccumulator<VoxelShape> streamaccumulator = new StreamAccumulator<>(Stream.concat(Stream.empty(), Stream.empty()));
|
||||
+ //boolean useVoxelShape = false;
|
||||
+ if(de.tr7zw.yapfa.YapfaConfig.disableEntityCollisionboxes) {
|
||||
+ //useVoxelShape = VoxelShapes.c(worldBorder, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND);
|
||||
+ vec3d1 = vec3d.g() == 0.0D ? vec3d : aNonStream(this, vec3d, axisalignedbb, this.world, voxelshapecollision, worldBorder);
|
||||
+ } else {
|
||||
+ Stream<VoxelShape> stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(this.world.getWorldBorder().a()); // Tuinity - optimise voxelshapes
|
||||
+ Stream<VoxelShape> stream1 = de.tr7zw.yapfa.YapfaConfig.disableEntityCollisionboxes ? Stream.empty() : this.world.b(this, axisalignedbb.a(vec3d), (Set) ImmutableSet.of()); // YAPFA
|
||||
+ streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream));
|
||||
+ vec3d1 = vec3d.g() == 0.0D ? vec3d : a(this, vec3d, axisalignedbb, this.world, voxelshapecollision, streamaccumulator);
|
||||
+ }
|
||||
boolean flag = vec3d.x != vec3d1.x;
|
||||
boolean flag1 = vec3d.y != vec3d1.y;
|
||||
boolean flag2 = vec3d.z != vec3d1.z;
|
||||
boolean flag3 = this.onGround || flag1 && vec3d.y < 0.0D;
|
||||
|
||||
if (this.H > 0.0F && flag3 && (flag || flag2)) {
|
||||
- Vec3D vec3d2 = a(this, new Vec3D(vec3d.x, (double) this.H, vec3d.z), axisalignedbb, this.world, voxelshapecollision, streamaccumulator);
|
||||
- Vec3D vec3d3 = a(this, new Vec3D(0.0D, (double) this.H, 0.0D), axisalignedbb.b(vec3d.x, 0.0D, vec3d.z), this.world, voxelshapecollision, streamaccumulator);
|
||||
+ if(de.tr7zw.yapfa.YapfaConfig.disableEntityCollisionboxes) {
|
||||
|
||||
- if (vec3d3.y < (double) this.H) {
|
||||
- Vec3D vec3d4 = a(this, new Vec3D(vec3d.x, 0.0D, vec3d.z), axisalignedbb.b(vec3d3), this.world, voxelshapecollision, streamaccumulator).e(vec3d3);
|
||||
+ Vec3D vec3d2 = aNonStream(this, new Vec3D(vec3d.x, (double) this.H, vec3d.z), axisalignedbb, this.world, voxelshapecollision, worldBorder);
|
||||
+ Vec3D vec3d3 = aNonStream(this, new Vec3D(0.0D, (double) this.H, 0.0D), axisalignedbb.b(vec3d.x, 0.0D, vec3d.z), this.world, voxelshapecollision, worldBorder);
|
||||
+
|
||||
+ if (vec3d3.y < (double) this.H) {
|
||||
+ Vec3D vec3d4 = aNonStream(this, new Vec3D(vec3d.x, 0.0D, vec3d.z), axisalignedbb.b(vec3d3), this.world, voxelshapecollision, worldBorder).e(vec3d3);
|
||||
+
|
||||
+ if (b(vec3d4) > b(vec3d2)) {
|
||||
+ vec3d2 = vec3d4;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (b(vec3d4) > b(vec3d2)) {
|
||||
- vec3d2 = vec3d4;
|
||||
+ if (b(vec3d2) > b(vec3d1)) {
|
||||
+ return vec3d2.e(aNonStream(this, new Vec3D(0.0D, -vec3d2.y + vec3d.y, 0.0D), axisalignedbb.b(vec3d2), this.world, voxelshapecollision, worldBorder));
|
||||
}
|
||||
- }
|
||||
+ } else {
|
||||
+ Vec3D vec3d2 = a(this, new Vec3D(vec3d.x, (double) this.H, vec3d.z), axisalignedbb, this.world, voxelshapecollision, streamaccumulator);
|
||||
+ Vec3D vec3d3 = a(this, new Vec3D(0.0D, (double) this.H, 0.0D), axisalignedbb.b(vec3d.x, 0.0D, vec3d.z), this.world, voxelshapecollision, streamaccumulator);
|
||||
|
||||
- if (b(vec3d2) > b(vec3d1)) {
|
||||
- return vec3d2.e(a(this, new Vec3D(0.0D, -vec3d2.y + vec3d.y, 0.0D), axisalignedbb.b(vec3d2), this.world, voxelshapecollision, streamaccumulator));
|
||||
- }
|
||||
+ if (vec3d3.y < (double) this.H) {
|
||||
+ Vec3D vec3d4 = a(this, new Vec3D(vec3d.x, 0.0D, vec3d.z), axisalignedbb.b(vec3d3), this.world, voxelshapecollision, streamaccumulator).e(vec3d3);
|
||||
+
|
||||
+ if (b(vec3d4) > b(vec3d2)) {
|
||||
+ vec3d2 = vec3d4;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (b(vec3d2) > b(vec3d1)) {
|
||||
+ return vec3d2.e(a(this, new Vec3D(0.0D, -vec3d2.y + vec3d.y, 0.0D), axisalignedbb.b(vec3d2), this.world, voxelshapecollision, streamaccumulator));
|
||||
+ }
|
||||
+ }
|
||||
+ // YAPFA end
|
||||
+
|
||||
}
|
||||
|
||||
return vec3d1;
|
||||
@@ -1078,6 +1108,91 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
return a(vec3d, axisalignedbb, world, voxelshapecollision, streamaccumulator);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // YAPFA start
|
||||
+ public static Vec3D aNonStream(@Nullable Entity entity, Vec3D vec3d, AxisAlignedBB axisalignedbb, World world, VoxelShapeCollision voxelshapecollision, VoxelShape worldBorder) {
|
||||
+ boolean flag = vec3d.x == 0.0D;
|
||||
+ boolean flag1 = vec3d.y == 0.0D;
|
||||
+ boolean flag2 = vec3d.z == 0.0D;
|
||||
+
|
||||
+ if ((!flag || !flag1) && (!flag || !flag2) && (!flag1 || !flag2)) {
|
||||
+ return a(vec3d, axisalignedbb, de.tr7zw.yapfa.collision.CollisionHelper.b(world, worldBorder, entity, axisalignedbb.a(vec3d)));
|
||||
+ } else {
|
||||
+ return a(vec3d, axisalignedbb, world, voxelshapecollision, worldBorder);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static Vec3D a(Vec3D vec3d, AxisAlignedBB axisalignedbb, AbstractSpliterator<VoxelShape> split) {
|
||||
+ double d0 = vec3d.x;
|
||||
+ double d1 = vec3d.y;
|
||||
+ double d2 = vec3d.z;
|
||||
+ de.tr7zw.yapfa.collision.CollisionHelper.SpliteratorAccumulator<VoxelShape> acc = new de.tr7zw.yapfa.collision.CollisionHelper.SpliteratorAccumulator<VoxelShape>(split);
|
||||
+ if (d1 != 0.0D) {
|
||||
+ d1 = VoxelShapes.a(EnumDirection.EnumAxis.Y, axisalignedbb, acc.a(), d1);
|
||||
+ if (d1 != 0.0D) {
|
||||
+ axisalignedbb = axisalignedbb.d(0.0D, d1, 0.0D);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ boolean flag = Math.abs(d0) < Math.abs(d2);
|
||||
+
|
||||
+ if (flag && d2 != 0.0D) {
|
||||
+ d2 = VoxelShapes.a(EnumDirection.EnumAxis.Z, axisalignedbb, acc.a(), d2);
|
||||
+ if (d2 != 0.0D) {
|
||||
+ axisalignedbb = axisalignedbb.d(0.0D, 0.0D, d2);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (d0 != 0.0D) {
|
||||
+ d0 = VoxelShapes.a(EnumDirection.EnumAxis.X, axisalignedbb, acc.a(), d0);
|
||||
+ if (!flag && d0 != 0.0D) {
|
||||
+ axisalignedbb = axisalignedbb.d(d0, 0.0D, 0.0D);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!flag && d2 != 0.0D) {
|
||||
+ d2 = VoxelShapes.a(EnumDirection.EnumAxis.Z, axisalignedbb, acc.a(), d2);
|
||||
+ }
|
||||
+
|
||||
+ return new Vec3D(d0, d1, d2);
|
||||
+ }
|
||||
+
|
||||
+ public static Vec3D a(Vec3D vec3d, AxisAlignedBB axisalignedbb, IWorldReader iworldreader, VoxelShapeCollision voxelshapecollision, VoxelShape voxelShape) {
|
||||
+ double d0 = vec3d.x;
|
||||
+ double d1 = vec3d.y;
|
||||
+ double d2 = vec3d.z;
|
||||
+
|
||||
+ if (d1 != 0.0D) {
|
||||
+ d1 = VoxelShapes.a(EnumDirection.EnumAxis.Y, axisalignedbb, iworldreader, d1, voxelshapecollision, voxelShape);
|
||||
+ if (d1 != 0.0D) {
|
||||
+ axisalignedbb = axisalignedbb.d(0.0D, d1, 0.0D);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ boolean flag = Math.abs(d0) < Math.abs(d2);
|
||||
+
|
||||
+ if (flag && d2 != 0.0D) {
|
||||
+ d2 = VoxelShapes.a(EnumDirection.EnumAxis.Z, axisalignedbb, iworldreader, d2, voxelshapecollision, voxelShape);
|
||||
+ if (d2 != 0.0D) {
|
||||
+ axisalignedbb = axisalignedbb.d(0.0D, 0.0D, d2);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (d0 != 0.0D) {
|
||||
+ d0 = VoxelShapes.a(EnumDirection.EnumAxis.X, axisalignedbb, iworldreader, d0, voxelshapecollision, voxelShape);
|
||||
+ if (!flag && d0 != 0.0D) {
|
||||
+ axisalignedbb = axisalignedbb.d(d0, 0.0D, 0.0D);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!flag && d2 != 0.0D) {
|
||||
+ d2 = VoxelShapes.a(EnumDirection.EnumAxis.Z, axisalignedbb, iworldreader, d2, voxelshapecollision, voxelShape);
|
||||
+ }
|
||||
+
|
||||
+ return new Vec3D(d0, d1, d2);
|
||||
+ }
|
||||
+
|
||||
+ // YAPFA end
|
||||
|
||||
public static Vec3D a(Vec3D vec3d, AxisAlignedBB axisalignedbb, StreamAccumulator<VoxelShape> streamaccumulator) {
|
||||
double d0 = vec3d.x;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index b77960710..65685734d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2662,6 +2662,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.a(axisalignedbb, this.getBoundingBox());
|
||||
}
|
||||
|
||||
+ if(!de.tr7zw.yapfa.YapfaConfig.disableEntityCollisions) // YAPFA
|
||||
this.collideNearby();
|
||||
this.world.getMethodProfiler().exit();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
|
||||
index 5e24ce485..d651ed5fb 100644
|
||||
--- a/src/main/java/net/minecraft/server/VoxelShapes.java
|
||||
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java
|
||||
@@ -5,9 +5,12 @@ import com.google.common.math.DoubleMath;
|
||||
import com.google.common.math.IntMath;
|
||||
import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
|
||||
import it.unimi.dsi.fastutil.doubles.DoubleList;
|
||||
+
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
+import java.util.Spliterators;
|
||||
+import java.util.Spliterators.AbstractSpliterator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public final class VoxelShapes {
|
||||
@@ -256,6 +259,106 @@ public final class VoxelShapes {
|
||||
|
||||
return d0;
|
||||
}
|
||||
+
|
||||
+ // YAPFA start
|
||||
+
|
||||
+ public static double a(EnumDirection.EnumAxis enumdirection_enumaxis, AxisAlignedBB axisalignedbb, VoxelShape voxel, double d0) {
|
||||
+ d0 = voxel.a(enumdirection_enumaxis, axisalignedbb, d0);
|
||||
+ if (Math.abs(d0) < 1.0E-7D) {
|
||||
+ return 0.0D;
|
||||
+ }
|
||||
+
|
||||
+ return d0;
|
||||
+ }
|
||||
+
|
||||
+ public static double a(EnumDirection.EnumAxis enumdirection_enumaxis, AxisAlignedBB axisalignedbb, AbstractSpliterator<VoxelShape> stream, double d0) {
|
||||
+ for (Iterator iterator = Spliterators.iterator(stream); iterator.hasNext(); d0 = ((VoxelShape) iterator.next()).a(enumdirection_enumaxis, axisalignedbb, d0)) {
|
||||
+ if (Math.abs(d0) < 1.0E-7D) {
|
||||
+ return 0.0D;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return d0;
|
||||
+ }
|
||||
+
|
||||
+ public static double a(EnumDirection.EnumAxis enumdirection_enumaxis, AxisAlignedBB axisalignedbb, IWorldReader iworldreader, double d0, VoxelShapeCollision voxelshapecollision, VoxelShape voxel) {
|
||||
+ return a(axisalignedbb, iworldreader, d0, voxelshapecollision, EnumAxisCycle.a(enumdirection_enumaxis, EnumDirection.EnumAxis.Z), voxel);
|
||||
+ }
|
||||
+
|
||||
+ private static double a(AxisAlignedBB axisalignedbb, IWorldReader iworldreader, double d0, VoxelShapeCollision voxelshapecollision, EnumAxisCycle enumaxiscycle, VoxelShape voxelshape) {
|
||||
+ if (axisalignedbb.b() >= 1.0E-6D && axisalignedbb.c() >= 1.0E-6D && axisalignedbb.d() >= 1.0E-6D) {
|
||||
+ if (Math.abs(d0) < 1.0E-7D) {
|
||||
+ return 0.0D;
|
||||
+ } else {
|
||||
+ EnumAxisCycle enumaxiscycle1 = enumaxiscycle.a();
|
||||
+ EnumDirection.EnumAxis enumdirection_enumaxis = enumaxiscycle1.a(EnumDirection.EnumAxis.X);
|
||||
+ EnumDirection.EnumAxis enumdirection_enumaxis1 = enumaxiscycle1.a(EnumDirection.EnumAxis.Y);
|
||||
+ EnumDirection.EnumAxis enumdirection_enumaxis2 = enumaxiscycle1.a(EnumDirection.EnumAxis.Z);
|
||||
+ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
+ int i = MathHelper.floor(axisalignedbb.a(enumdirection_enumaxis) - 1.0E-7D) - 1;
|
||||
+ int j = MathHelper.floor(axisalignedbb.b(enumdirection_enumaxis) + 1.0E-7D) + 1;
|
||||
+ int k = MathHelper.floor(axisalignedbb.a(enumdirection_enumaxis1) - 1.0E-7D) - 1;
|
||||
+ int l = MathHelper.floor(axisalignedbb.b(enumdirection_enumaxis1) + 1.0E-7D) + 1;
|
||||
+ double d1 = axisalignedbb.a(enumdirection_enumaxis2) - 1.0E-7D;
|
||||
+ double d2 = axisalignedbb.b(enumdirection_enumaxis2) + 1.0E-7D;
|
||||
+ boolean flag = d0 > 0.0D;
|
||||
+ int i1 = flag ? MathHelper.floor(axisalignedbb.b(enumdirection_enumaxis2) - 1.0E-7D) - 1 : MathHelper.floor(axisalignedbb.a(enumdirection_enumaxis2) + 1.0E-7D) + 1;
|
||||
+ int j1 = a(d0, d1, d2);
|
||||
+ int k1 = flag ? 1 : -1;
|
||||
+ int l1 = i1;
|
||||
+
|
||||
+ while (true) {
|
||||
+ if (flag) {
|
||||
+ if (l1 > j1) {
|
||||
+ break;
|
||||
+ }
|
||||
+ } else if (l1 < j1) {
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ for (int i2 = i; i2 <= j; ++i2) {
|
||||
+ for (int j2 = k; j2 <= l; ++j2) {
|
||||
+ int k2 = 0;
|
||||
+
|
||||
+ if (i2 == i || i2 == j) {
|
||||
+ ++k2;
|
||||
+ }
|
||||
+
|
||||
+ if (j2 == k || j2 == l) {
|
||||
+ ++k2;
|
||||
+ }
|
||||
+
|
||||
+ if (l1 == i1 || l1 == j1) {
|
||||
+ ++k2;
|
||||
+ }
|
||||
+
|
||||
+ if (k2 < 3) {
|
||||
+ blockposition_mutableblockposition.a(enumaxiscycle1, i2, j2, l1);
|
||||
+ IBlockData iblockdata = iworldreader.getType(blockposition_mutableblockposition);
|
||||
+
|
||||
+ if ((k2 != 1 || iblockdata.f()) && (k2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) {
|
||||
+ d0 = iblockdata.b((IBlockAccess) iworldreader, blockposition_mutableblockposition, voxelshapecollision).a(enumdirection_enumaxis2, axisalignedbb.d((double) (-blockposition_mutableblockposition.getX()), (double) (-blockposition_mutableblockposition.getY()), (double) (-blockposition_mutableblockposition.getZ())), d0);
|
||||
+ if (Math.abs(d0) < 1.0E-7D) {
|
||||
+ return 0.0D;
|
||||
+ }
|
||||
+
|
||||
+ j1 = a(d0, d1, d2);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ l1 += k1;
|
||||
+ }
|
||||
+
|
||||
+ return voxelshape.a(enumdirection_enumaxis2, axisalignedbb, d0);
|
||||
+ }
|
||||
+ } else {
|
||||
+ return d0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // YAPFA end
|
||||
|
||||
public static double a(EnumDirection.EnumAxis enumdirection_enumaxis, AxisAlignedBB axisalignedbb, IWorldReader iworldreader, double d0, VoxelShapeCollision voxelshapecollision, Stream<VoxelShape> stream) {
|
||||
return a(axisalignedbb, iworldreader, d0, voxelshapecollision, EnumAxisCycle.a(enumdirection_enumaxis, EnumDirection.EnumAxis.Z), stream);
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,111 +0,0 @@
|
||||
From cbc381e8a8b5dab8c94757bfd8ff84c83d47223e Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 23 Mar 2020 23:11:10 +0100
|
||||
Subject: [PATCH] Add option for only players to have collisions with Entities
|
||||
|
||||
---
|
||||
src/main/java/de/tr7zw/yapfa/YapfaConfig.java | 6 ++
|
||||
.../net/minecraft/server/EntityLiving.java | 68 ++++++++++---------
|
||||
2 files changed, 43 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
index 9711cbc52..655c4e68f 100644
|
||||
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
@@ -216,4 +216,10 @@ public class YapfaConfig {
|
||||
disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false);
|
||||
}
|
||||
|
||||
+ public static boolean onlyPlayerCollisions = false;
|
||||
+ private static void onlyPlayerCollisions() {
|
||||
+ onlyPlayerCollisions = getBoolean("settings.onlyPlayerCollisions", false);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 65685734d..7a01daa57 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2702,40 +2702,46 @@ public abstract class EntityLiving extends Entity {
|
||||
if (i <= 0 && world.paperConfig.maxCollisionsPerEntity <= 0) {
|
||||
return;
|
||||
}
|
||||
- // Paper - end don't run getEntities if we're not going to use its result
|
||||
+ // Tuinity - end don't run getEntities if we're not going to use its result
|
||||
+ // YAPFA start
|
||||
// Tuinity start - reduce memory allocation from collideNearby
|
||||
List<Entity> list = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList();
|
||||
- this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this), list);
|
||||
try {
|
||||
- // Tuinity end - reduce memory allocation from collideNearby
|
||||
-
|
||||
- if (!list.isEmpty()) {
|
||||
- // Paper - move up
|
||||
- int j;
|
||||
-
|
||||
- if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) {
|
||||
- j = 0;
|
||||
-
|
||||
- for (int k = 0; k < list.size(); ++k) {
|
||||
- if (!((Entity) list.get(k)).isPassenger()) {
|
||||
- ++j;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (j > i - 1) {
|
||||
- this.damageEntity(DamageSource.CRAMMING, 6.0F);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- numCollisions = Math.max(0, numCollisions - world.paperConfig.maxCollisionsPerEntity); // Paper
|
||||
- for (j = 0; j < list.size() && numCollisions < world.paperConfig.maxCollisionsPerEntity; ++j) { // Paper
|
||||
- Entity entity = (Entity) list.get(j);
|
||||
- entity.numCollisions++; // Paper
|
||||
- numCollisions++; // Paper
|
||||
-
|
||||
- this.C(entity);
|
||||
- }
|
||||
- }
|
||||
+ if(de.tr7zw.yapfa.YapfaConfig.onlyPlayerCollisions) {
|
||||
+ this.world.getEntities(this, this.getBoundingBox(), entity -> entity.getEntityType() == EntityTypes.PLAYER, list);
|
||||
+ } else {
|
||||
+ this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this), list);
|
||||
+ }
|
||||
+ // Tuinity end - reduce memory allocation from collideNearby
|
||||
+ // YAPFA end
|
||||
+
|
||||
+ if (!list.isEmpty()) {
|
||||
+ // Paper - move up
|
||||
+ int j;
|
||||
+
|
||||
+ if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) {
|
||||
+ j = 0;
|
||||
+
|
||||
+ for (int k = 0; k < list.size(); ++k) {
|
||||
+ if (!((Entity) list.get(k)).isPassenger()) {
|
||||
+ ++j;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (j > i - 1) {
|
||||
+ this.damageEntity(DamageSource.CRAMMING, 6.0F);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ numCollisions = Math.max(0, numCollisions - world.paperConfig.maxCollisionsPerEntity); // Paper
|
||||
+ for (j = 0; j < list.size() && numCollisions < world.paperConfig.maxCollisionsPerEntity; ++j) { // Paper
|
||||
+ Entity entity = (Entity) list.get(j);
|
||||
+ entity.numCollisions++; // Paper
|
||||
+ numCollisions++; // Paper
|
||||
+
|
||||
+ this.C(entity);
|
||||
+ }
|
||||
+ }
|
||||
} finally { // Tuinity start - reduce memory allocation from collideNearby
|
||||
com.tuinity.tuinity.util.CachedLists.returnTempGetEntitiesList(list);
|
||||
} // Tuinity end - reduce memory allocation from collideNearby
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,59 +0,0 @@
|
||||
From 63da5c960563a9e464659ce236f5f157e663fc49 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Sun, 29 Mar 2020 00:35:03 +0100
|
||||
Subject: [PATCH] Allow to change the piston push limit
|
||||
|
||||
---
|
||||
src/main/java/de/tr7zw/yapfa/YapfaConfig.java | 4 ++++
|
||||
.../java/net/minecraft/server/PistonExtendsChecker.java | 6 +++---
|
||||
2 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
index 655c4e68f..29587589c 100644
|
||||
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
@@ -221,5 +221,9 @@ public class YapfaConfig {
|
||||
onlyPlayerCollisions = getBoolean("settings.onlyPlayerCollisions", false);
|
||||
}
|
||||
|
||||
+ public static int pistonPushLimit = 12;
|
||||
+ private static void pistonPushLimit() {
|
||||
+ pistonPushLimit = getInt("settings.pistonPushLimit", 12);
|
||||
+ }
|
||||
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
||||
index 8ac7d30be..de1c98cca 100644
|
||||
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
||||
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
||||
@@ -79,7 +79,7 @@ public class PistonExtendsChecker {
|
||||
} else {
|
||||
int i = 1;
|
||||
|
||||
- if (i + this.f.size() > 12) {
|
||||
+ if (i + this.f.size() > de.tr7zw.yapfa.YapfaConfig.pistonPushLimit) { // YAPFA
|
||||
return false;
|
||||
} else {
|
||||
while (a(block)) {
|
||||
@@ -93,7 +93,7 @@ public class PistonExtendsChecker {
|
||||
}
|
||||
|
||||
++i;
|
||||
- if (i + this.f.size() > 12) {
|
||||
+ if (i + this.f.size() > de.tr7zw.yapfa.YapfaConfig.pistonPushLimit) { // YAPFA
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class PistonExtendsChecker {
|
||||
return true;
|
||||
}
|
||||
|
||||
- if (this.f.size() >= 12) {
|
||||
+ if (this.f.size() >= de.tr7zw.yapfa.YapfaConfig.pistonPushLimit) { // YAPFA
|
||||
return false;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From c0898b6a58fe806a40f9f49fdb2bc618514297c8 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Thu, 2 Apr 2020 18:49:38 +0200
|
||||
Subject: [PATCH] Add NBT-API as first-class lib
|
||||
|
||||
---
|
||||
pom.xml | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index e58fddead..5a4c6fe4f 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -306,6 +306,10 @@
|
||||
<pattern>net.minecraft.server</pattern>
|
||||
<shadedPattern>net.minecraft.server.v${minecraft_version}</shadedPattern>
|
||||
</relocation>
|
||||
+ <relocation>
|
||||
+ <pattern>de.tr7zw.changeme.nbtapi</pattern>
|
||||
+ <shadedPattern>de.tr7zw.nbtapi</shadedPattern>
|
||||
+ </relocation>
|
||||
</relocations>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,370 +0,0 @@
|
||||
From 5c1c7417e29d6e8542938e04f83483c0a5c483ae Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Sat, 4 Apr 2020 23:23:04 +0200
|
||||
Subject: [PATCH] Player saving async FileIO
|
||||
|
||||
---
|
||||
.../server/AdvancementDataPlayer.java | 106 ++++++++++--------
|
||||
.../net/minecraft/server/EntityHuman.java | 16 ++-
|
||||
.../java/net/minecraft/server/PlayerList.java | 28 ++++-
|
||||
.../server/ServerStatisticManager.java | 20 +++-
|
||||
.../net/minecraft/server/WorldNBTStorage.java | 33 ++++--
|
||||
5 files changed, 139 insertions(+), 64 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
|
||||
index c41e13847..cd1c8eb71 100644
|
||||
--- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
|
||||
@@ -26,6 +26,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
+import java.util.concurrent.ExecutorService;
|
||||
+import java.util.concurrent.Executors;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -48,6 +50,7 @@ public class AdvancementDataPlayer {
|
||||
@Nullable
|
||||
private Advancement k;
|
||||
private boolean l = true;
|
||||
+ public static ExecutorService saveThread = Executors.newSingleThreadExecutor(); // YAPFA
|
||||
|
||||
public AdvancementDataPlayer(MinecraftServer minecraftserver, File file, EntityPlayer entityplayer) {
|
||||
this.d = minecraftserver;
|
||||
@@ -220,53 +223,66 @@ public class AdvancementDataPlayer {
|
||||
|
||||
jsonelement.getAsJsonObject().addProperty("DataVersion", SharedConstants.getGameVersion().getWorldVersion());
|
||||
|
||||
+ // YAPFA start
|
||||
+ String gson = null;
|
||||
try {
|
||||
- FileOutputStream fileoutputstream = new FileOutputStream(this.e);
|
||||
- Throwable throwable = null;
|
||||
-
|
||||
- try {
|
||||
- OutputStreamWriter outputstreamwriter = new OutputStreamWriter(fileoutputstream, Charsets.UTF_8.newEncoder());
|
||||
- Throwable throwable1 = null;
|
||||
-
|
||||
- try {
|
||||
- AdvancementDataPlayer.b.toJson(jsonelement, outputstreamwriter);
|
||||
- } catch (Throwable throwable2) {
|
||||
- throwable1 = throwable2;
|
||||
- throw throwable2;
|
||||
- } finally {
|
||||
- if (outputstreamwriter != null) {
|
||||
- if (throwable1 != null) {
|
||||
- try {
|
||||
- outputstreamwriter.close();
|
||||
- } catch (Throwable throwable3) {
|
||||
- throwable1.addSuppressed(throwable3);
|
||||
- }
|
||||
- } else {
|
||||
- outputstreamwriter.close();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- }
|
||||
- } catch (Throwable throwable4) {
|
||||
- throwable = throwable4;
|
||||
- throw throwable4;
|
||||
- } finally {
|
||||
- if (fileoutputstream != null) {
|
||||
- if (throwable != null) {
|
||||
- try {
|
||||
- fileoutputstream.close();
|
||||
- } catch (Throwable throwable5) {
|
||||
- throwable.addSuppressed(throwable5);
|
||||
- }
|
||||
- } else {
|
||||
- fileoutputstream.close();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- }
|
||||
- } catch (IOException ioexception) {
|
||||
- AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.e, ioexception);
|
||||
+ gson = AdvancementDataPlayer.b.toJson(jsonelement);
|
||||
+ } catch (Throwable throwable) {
|
||||
+ throw throwable;
|
||||
+ }
|
||||
+ if(gson != null) {
|
||||
+ final String fGson = gson;
|
||||
+ saveThread.submit(() -> {
|
||||
+ try {
|
||||
+ FileOutputStream fileoutputstream = new FileOutputStream(this.e);
|
||||
+ Throwable throwable = null;
|
||||
+
|
||||
+ try {
|
||||
+ OutputStreamWriter outputstreamwriter = new OutputStreamWriter(fileoutputstream, Charsets.UTF_8.newEncoder());
|
||||
+ Throwable throwable1 = null;
|
||||
+
|
||||
+ try {
|
||||
+ outputstreamwriter.write(fGson);
|
||||
+ } catch (Throwable throwable2) {
|
||||
+ throwable1 = throwable2;
|
||||
+ throw throwable2;
|
||||
+ } finally {
|
||||
+ if (outputstreamwriter != null) {
|
||||
+ if (throwable1 != null) {
|
||||
+ try {
|
||||
+ outputstreamwriter.close();
|
||||
+ } catch (Throwable throwable3) {
|
||||
+ throwable1.addSuppressed(throwable3);
|
||||
+ }
|
||||
+ } else {
|
||||
+ outputstreamwriter.close();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ } catch (Throwable throwable4) {
|
||||
+ throwable = throwable4;
|
||||
+ throw throwable4;
|
||||
+ } finally {
|
||||
+ if (fileoutputstream != null) {
|
||||
+ if (throwable != null) {
|
||||
+ try {
|
||||
+ fileoutputstream.close();
|
||||
+ } catch (Throwable throwable5) {
|
||||
+ throwable.addSuppressed(throwable5);
|
||||
+ }
|
||||
+ } else {
|
||||
+ fileoutputstream.close();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ } catch (IOException ioexception) {
|
||||
+ AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.e, ioexception);
|
||||
+ }
|
||||
+ });
|
||||
}
|
||||
+ // YAPFA end
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index c1e8ff6ab..db4f62883 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -733,11 +733,23 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
}
|
||||
|
||||
+ // YAPFA start
|
||||
+ private NBTTagList inventorySnapshot = null;
|
||||
+ private NBTTagList enderchestSnapshot = null;
|
||||
+
|
||||
+
|
||||
+ public void takeInventorySnapshot() {
|
||||
+ inventorySnapshot = this.inventory.a(new NBTTagList());
|
||||
+ enderchestSnapshot = this.enderChest.f();
|
||||
+ }
|
||||
+
|
||||
+ // YAPFA end
|
||||
+
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setInt("DataVersion", SharedConstants.getGameVersion().getWorldVersion());
|
||||
- nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList()));
|
||||
+ nbttagcompound.set("Inventory", inventorySnapshot != null ? inventorySnapshot : this.inventory.a(new NBTTagList())); inventorySnapshot = null;// YAPFA
|
||||
nbttagcompound.setInt("SelectedItemSlot", this.inventory.itemInHandIndex);
|
||||
nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks);
|
||||
nbttagcompound.setFloat("XpP", this.exp);
|
||||
@@ -754,7 +766,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
this.foodData.b(nbttagcompound);
|
||||
this.abilities.a(nbttagcompound);
|
||||
- nbttagcompound.set("EnderItems", this.enderChest.f());
|
||||
+ nbttagcompound.set("EnderItems", enderchestSnapshot != null ? enderchestSnapshot : this.enderChest.f()); enderchestSnapshot = null;// YAPFA
|
||||
if (!this.getShoulderEntityLeft().isEmpty()) {
|
||||
nbttagcompound.set("ShoulderEntityLeft", this.getShoulderEntityLeft());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 5b634f238..1ae0c15c4 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -17,6 +17,8 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -1210,6 +1212,28 @@ public abstract class PlayerList {
|
||||
if (team != null) scoreboard.removeTeam(team);
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // YAPFA start - make sure all saves are done
|
||||
+ try {
|
||||
+ ((WorldNBTStorage)playerFileData).saveThread.shutdown();
|
||||
+ boolean done = ((WorldNBTStorage)playerFileData).saveThread.awaitTermination(60, TimeUnit.SECONDS);
|
||||
+ if(!done) {
|
||||
+ LOGGER.error("Players did not save completly!");
|
||||
+ }
|
||||
+ ServerStatisticManager.saveThread.shutdown();
|
||||
+ done = ServerStatisticManager.saveThread.awaitTermination(60, TimeUnit.SECONDS);
|
||||
+ if(!done) {
|
||||
+ LOGGER.error("Stats did not save completly!");
|
||||
+ }
|
||||
+ AdvancementDataPlayer.saveThread.shutdown();
|
||||
+ done = AdvancementDataPlayer.saveThread.awaitTermination(60, TimeUnit.SECONDS);
|
||||
+ if(!done) {
|
||||
+ LOGGER.error("Advancements did not save completly!");
|
||||
+ }
|
||||
+ } catch (InterruptedException e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ // YAPFA end
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -1249,13 +1273,13 @@ public abstract class PlayerList {
|
||||
File file = new File(this.server.getWorldServer(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats");
|
||||
File file1 = new File(file, uuid + ".json");
|
||||
|
||||
- if (!file1.exists()) {
|
||||
+ /*if (!file1.exists()) { // YAPFA dont check for old stats files with sync File IO
|
||||
File file2 = new File(file, displayName + ".json"); // CraftBukkit
|
||||
|
||||
if (file2.exists() && file2.isFile()) {
|
||||
file2.renameTo(file1);
|
||||
}
|
||||
- }
|
||||
+ }*/
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
// this.o.put(uuid, serverstatisticmanager); // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
index b3c9a5a84..edeb8b4fb 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
|
||||
@@ -20,6 +20,9 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
+import java.util.concurrent.ExecutorService;
|
||||
+import java.util.concurrent.Executors;
|
||||
+
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -30,6 +33,7 @@ public class ServerStatisticManager extends StatisticManager {
|
||||
private final File d;
|
||||
private final Set<Statistic<?>> e = Sets.newHashSet();
|
||||
private int f = -300;
|
||||
+ public static ExecutorService saveThread = Executors.newSingleThreadExecutor(); // YAPFA
|
||||
|
||||
public ServerStatisticManager(MinecraftServer minecraftserver, File file) {
|
||||
this.c = minecraftserver;
|
||||
@@ -40,7 +44,9 @@ public class ServerStatisticManager extends StatisticManager {
|
||||
Statistic<MinecraftKey> wrapper = StatisticList.CUSTOM.b( entry.getKey() );
|
||||
this.a.put( wrapper, entry.getValue().intValue() );
|
||||
}
|
||||
- // Spigot end
|
||||
+ // Spigot ends
|
||||
+ // YAPFA start
|
||||
+ saveThread.submit(() -> {
|
||||
if (file.isFile()) {
|
||||
try {
|
||||
this.a(minecraftserver.aC(), org.apache.commons.io.FileUtils.readFileToString(file));
|
||||
@@ -50,17 +56,21 @@ public class ServerStatisticManager extends StatisticManager {
|
||||
ServerStatisticManager.LOGGER.error("Couldn't parse statistics file {}", file, jsonparseexception);
|
||||
}
|
||||
}
|
||||
-
|
||||
+ });
|
||||
}
|
||||
|
||||
public void a() {
|
||||
if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot
|
||||
+ // YAPFA start
|
||||
+ String str = this.b();
|
||||
+ saveThread.submit(() -> {
|
||||
try {
|
||||
- org.apache.commons.io.FileUtils.writeStringToFile(this.d, this.b());
|
||||
+ org.apache.commons.io.FileUtils.writeStringToFile(this.d, str);
|
||||
} catch (IOException ioexception) {
|
||||
ServerStatisticManager.LOGGER.error("Couldn't save stats", ioexception);
|
||||
}
|
||||
-
|
||||
+ });
|
||||
+ // YAPFA end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,7 +121,7 @@ public class ServerStatisticManager extends StatisticManager {
|
||||
|
||||
if (nbttagcompound2.hasKeyOfType(s2, 99)) {
|
||||
SystemUtils.a(this.a(statisticwrapper, s2), (statistic) -> {
|
||||
- this.a.put(statistic, nbttagcompound2.getInt(s2));
|
||||
+ this.a.put(statistic, nbttagcompound2.getInt(s2) + this.a.getOrDefault(statistic, 0)); // YAPFA fix async load
|
||||
}, () -> {
|
||||
//ServerStatisticManager.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.d, s2); // EMC
|
||||
});
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
index 350ac42d6..c80673770 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
@@ -15,6 +15,9 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.UUID;
|
||||
+import java.util.concurrent.ExecutorService;
|
||||
+import java.util.concurrent.Executors;
|
||||
+
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -28,6 +31,7 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
private final DefinedStructureManager g;
|
||||
protected final DataFixer a;
|
||||
private UUID uuid = null; // CraftBukkit
|
||||
+ public ExecutorService saveThread = Executors.newSingleThreadExecutor(); // YAPFA
|
||||
|
||||
public WorldNBTStorage(File file, String s, @Nullable MinecraftServer minecraftserver, DataFixer datafixer) {
|
||||
this.a = datafixer;
|
||||
@@ -140,16 +144,25 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
public void save(EntityHuman entityhuman) {
|
||||
if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable
|
||||
try {
|
||||
- NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
|
||||
- File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat.tmp");
|
||||
- File file1 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
|
||||
-
|
||||
- NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file)));
|
||||
- if (file1.exists()) {
|
||||
- file1.delete();
|
||||
- }
|
||||
-
|
||||
- file.renameTo(file1);
|
||||
+ // YAPFA start
|
||||
+ entityhuman.takeInventorySnapshot(); // Take a sync inventory/enderchest snapshot to prevent duping
|
||||
+ saveThread.submit(() -> { // Save the tag async
|
||||
+ try {
|
||||
+ NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
|
||||
+ File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat.tmp");
|
||||
+ File file1 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
|
||||
+
|
||||
+ NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file)));
|
||||
+ if (file1.exists()) {
|
||||
+ file1.delete();
|
||||
+ }
|
||||
+
|
||||
+ file.renameTo(file1);
|
||||
+ } catch (Exception exception) {
|
||||
+ WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
|
||||
+ }
|
||||
+ });
|
||||
+ // YAPFA end
|
||||
} catch (Exception exception) {
|
||||
WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,97 +0,0 @@
|
||||
From d2f92d223a1713c1d8fe0c45ffb28e30481209b8 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 6 Apr 2020 01:05:08 +0200
|
||||
Subject: [PATCH] Stop a pathfinder method to call itself more than once
|
||||
|
||||
This miiiight help to fix the pathfinder from going nuts. Only time will tell.
|
||||
---
|
||||
.../minecraft/server/PathfinderNormal.java | 24 +++++++++++--------
|
||||
1 file changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
index 61e4dbcd4..f406abd84 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
@@ -96,49 +96,49 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
}
|
||||
|
||||
double d0 = a((IBlockAccess) this.a, new BlockPosition(pathpoint.a, pathpoint.b, pathpoint.c));
|
||||
- PathPoint pathpoint1 = this.a(pathpoint.a, pathpoint.b, pathpoint.c + 1, j, d0, EnumDirection.SOUTH);
|
||||
+ PathPoint pathpoint1 = this.a(pathpoint.a, pathpoint.b, pathpoint.c + 1, j, d0, EnumDirection.SOUTH, 0); // YAPFA
|
||||
|
||||
if (pathpoint1 != null && !pathpoint1.i && pathpoint1.k >= 0.0F) {
|
||||
apathpoint[i++] = pathpoint1;
|
||||
}
|
||||
|
||||
- PathPoint pathpoint2 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c, j, d0, EnumDirection.WEST);
|
||||
+ PathPoint pathpoint2 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c, j, d0, EnumDirection.WEST, 0); // YAPFA
|
||||
|
||||
if (pathpoint2 != null && !pathpoint2.i && pathpoint2.k >= 0.0F) {
|
||||
apathpoint[i++] = pathpoint2;
|
||||
}
|
||||
|
||||
- PathPoint pathpoint3 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c, j, d0, EnumDirection.EAST);
|
||||
+ PathPoint pathpoint3 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c, j, d0, EnumDirection.EAST, 0); // YAPFA
|
||||
|
||||
if (pathpoint3 != null && !pathpoint3.i && pathpoint3.k >= 0.0F) {
|
||||
apathpoint[i++] = pathpoint3;
|
||||
}
|
||||
|
||||
- PathPoint pathpoint4 = this.a(pathpoint.a, pathpoint.b, pathpoint.c - 1, j, d0, EnumDirection.NORTH);
|
||||
+ PathPoint pathpoint4 = this.a(pathpoint.a, pathpoint.b, pathpoint.c - 1, j, d0, EnumDirection.NORTH, 0); // YAPFA
|
||||
|
||||
if (pathpoint4 != null && !pathpoint4.i && pathpoint4.k >= 0.0F) {
|
||||
apathpoint[i++] = pathpoint4;
|
||||
}
|
||||
|
||||
- PathPoint pathpoint5 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c - 1, j, d0, EnumDirection.NORTH);
|
||||
+ PathPoint pathpoint5 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c - 1, j, d0, EnumDirection.NORTH, 0); // YAPFA
|
||||
|
||||
if (this.a(pathpoint, pathpoint2, pathpoint4, pathpoint5)) {
|
||||
apathpoint[i++] = pathpoint5;
|
||||
}
|
||||
|
||||
- PathPoint pathpoint6 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c - 1, j, d0, EnumDirection.NORTH);
|
||||
+ PathPoint pathpoint6 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c - 1, j, d0, EnumDirection.NORTH, 0); // YAPFA
|
||||
|
||||
if (this.a(pathpoint, pathpoint3, pathpoint4, pathpoint6)) {
|
||||
apathpoint[i++] = pathpoint6;
|
||||
}
|
||||
|
||||
- PathPoint pathpoint7 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c + 1, j, d0, EnumDirection.SOUTH);
|
||||
+ PathPoint pathpoint7 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c + 1, j, d0, EnumDirection.SOUTH, 0); // YAPFA
|
||||
|
||||
if (this.a(pathpoint, pathpoint2, pathpoint1, pathpoint7)) {
|
||||
apathpoint[i++] = pathpoint7;
|
||||
}
|
||||
|
||||
- PathPoint pathpoint8 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c + 1, j, d0, EnumDirection.SOUTH);
|
||||
+ PathPoint pathpoint8 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c + 1, j, d0, EnumDirection.SOUTH, 0); // YAPFA
|
||||
|
||||
if (this.a(pathpoint, pathpoint3, pathpoint1, pathpoint8)) {
|
||||
apathpoint[i++] = pathpoint8;
|
||||
@@ -159,7 +159,11 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- private PathPoint a(int i, int j, int k, int l, double d0, EnumDirection enumdirection) {
|
||||
+ private PathPoint a(int i, int j, int k, int l, double d0, EnumDirection enumdirection, int tries) { // YAPFA
|
||||
+ if(tries > 1) {
|
||||
+ System.out.println("Stopped an entity falling into a Pathfinder loop. This might or might not be right! " + super.b.toString());
|
||||
+ return null; // YAPFA - This might stop the Pathfinder from going nuts
|
||||
+ }
|
||||
PathPoint pathpoint = null;
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
double d1 = a((IBlockAccess) this.a, blockposition);
|
||||
@@ -181,7 +185,7 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
return pathpoint;
|
||||
} else {
|
||||
if ((pathpoint == null || pathpoint.k < 0.0F) && l > 0 && pathtype != PathType.FENCE && pathtype != PathType.TRAPDOOR) {
|
||||
- pathpoint = this.a(i, j + 1, k, l - 1, d0, enumdirection);
|
||||
+ pathpoint = this.a(i, j + 1, k, l - 1, d0, enumdirection, ++tries);
|
||||
if (pathpoint != null && (pathpoint.l == PathType.OPEN || pathpoint.l == PathType.WALKABLE) && this.b.getWidth() < 1.0F) {
|
||||
double d3 = (double) (i - enumdirection.getAdjacentX()) + 0.5D;
|
||||
double d4 = (double) (k - enumdirection.getAdjacentZ()) + 0.5D;
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,36 +0,0 @@
|
||||
From cc1010c26310272c4ba064408870bc5ca13c76f4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
||||
<tsao-chi@the-lingo.org>
|
||||
Date: Thu, 2 Apr 2020 11:29:08 +0800
|
||||
Subject: [PATCH] Akarin Avoid double I/O operation on load player file
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/WorldNBTStorage.java | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
index c80673770..65813c84e 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
@@ -178,7 +178,8 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
|
||||
// Spigot Start
|
||||
boolean usingWrongFile = false;
|
||||
- if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
|
||||
+ boolean normalFile = file.exists() && file.isFile(); // Akarin - ensures normal file
|
||||
+ if ( org.bukkit.Bukkit.getOnlineMode() && !normalFile ) // Paper - Check online mode first // Akarin - ensures normal file
|
||||
{
|
||||
file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
|
||||
if ( file.exists() )
|
||||
@@ -189,7 +190,7 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
}
|
||||
// Spigot End
|
||||
|
||||
- if (file.exists() && file.isFile()) {
|
||||
+ if (normalFile) { // Akarin - avoid double I/O operation
|
||||
nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file)));
|
||||
}
|
||||
// Spigot Start
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 9e840e4a39728a5f36b0ce3a79e9f3b9fddbd2b6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
||||
<tsao-chi@the-lingo.org>
|
||||
Date: Thu, 2 Apr 2020 11:16:18 +0800
|
||||
Subject: [PATCH] Akarin Save json list async
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/JsonList.java | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
|
||||
index c97be42dd..370841cad 100644
|
||||
--- a/src/main/java/net/minecraft/server/JsonList.java
|
||||
+++ b/src/main/java/net/minecraft/server/JsonList.java
|
||||
@@ -168,6 +168,7 @@ public class JsonList<K, V extends JsonListEntry<K>> {
|
||||
}
|
||||
|
||||
public void save() throws IOException {
|
||||
+ Runnable runnable = () -> { // Akarin - Save json list async
|
||||
this.removeStaleEntries(); // Paper - remove expired values before saving
|
||||
Collection<V> collection = this.d.values();
|
||||
String s = this.b.toJson(collection);
|
||||
@@ -176,10 +177,13 @@ public class JsonList<K, V extends JsonListEntry<K>> {
|
||||
try {
|
||||
bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
|
||||
bufferedwriter.write(s);
|
||||
+ } catch (IOException e) { // Akarin - Save json list async
|
||||
+ JsonList.LOGGER.warn("Failed to save " + this.c, e); // Akarin - Save json list async
|
||||
} finally {
|
||||
IOUtils.closeQuietly(bufferedwriter);
|
||||
}
|
||||
-
|
||||
+ }; // Akarin - Save json list async
|
||||
+ MCUtil.scheduleAsyncTask(runnable); // Akarin - Save json list async
|
||||
}
|
||||
|
||||
public void load() throws FileNotFoundException {
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,170 +0,0 @@
|
||||
From 617cb03e6388b01fac2a9e8b3d31cd1b3496dbc5 Mon Sep 17 00:00:00 2001
|
||||
From: Sotr <i@omc.hk>
|
||||
Date: Wed, 15 Apr 2020 03:51:50 +0700
|
||||
Subject: [PATCH] Akarin Optimize door interact with pathfinding
|
||||
|
||||
---
|
||||
.../akarin/server/IndexedBlockPosition.java | 35 +++++++++++++
|
||||
.../server/BehaviorInteractDoor.java | 49 ++++++++++++++++---
|
||||
.../net/minecraft/server/BehaviorSleep.java | 2 +-
|
||||
3 files changed, 77 insertions(+), 9 deletions(-)
|
||||
create mode 100644 src/main/java/io/akarin/server/IndexedBlockPosition.java
|
||||
|
||||
diff --git a/src/main/java/io/akarin/server/IndexedBlockPosition.java b/src/main/java/io/akarin/server/IndexedBlockPosition.java
|
||||
new file mode 100644
|
||||
index 000000000..83bf1d4ca
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/akarin/server/IndexedBlockPosition.java
|
||||
@@ -0,0 +1,35 @@
|
||||
+package io.akarin.server;
|
||||
+
|
||||
+import net.minecraft.server.BlockPosition;
|
||||
+
|
||||
+public class IndexedBlockPosition {
|
||||
+ private final int index;
|
||||
+ private final BlockPosition position;
|
||||
+
|
||||
+ public IndexedBlockPosition(int index, BlockPosition position) {
|
||||
+ this.index = index;
|
||||
+ this.position = position;
|
||||
+ }
|
||||
+
|
||||
+ public static IndexedBlockPosition of(int index, BlockPosition position) {
|
||||
+ return new IndexedBlockPosition(index, position);
|
||||
+ }
|
||||
+
|
||||
+ public int index() {
|
||||
+ return index;
|
||||
+ }
|
||||
+
|
||||
+ public BlockPosition get() {
|
||||
+ return position;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return position.hashCode();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(Object obj) {
|
||||
+ return position.equals(obj);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
index 01d9c2d92..3db22c5f4 100644
|
||||
--- a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
+++ b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
@@ -1,7 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
+import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
+import io.akarin.server.IndexedBlockPosition;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -19,32 +21,63 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController();
|
||||
PathEntity pathentity = (PathEntity) behaviorcontroller.getMemory(MemoryModuleType.PATH).get();
|
||||
List<GlobalPos> list = (List) behaviorcontroller.getMemory(MemoryModuleType.INTERACTABLE_DOORS).get();
|
||||
+ // Akarin start - remove stream
|
||||
+ /*
|
||||
List<BlockPosition> list1 = (List) pathentity.d().stream().map((pathpoint) -> {
|
||||
return new BlockPosition(pathpoint.a, pathpoint.b, pathpoint.c);
|
||||
}).collect(Collectors.toList());
|
||||
- Set<BlockPosition> set = this.a(worldserver, list, list1);
|
||||
+ */
|
||||
+
|
||||
+ List<PathPoint> points = pathentity.getPoints();
|
||||
+ java.util.Map<BlockPosition, Integer> list1 = new java.util.HashMap<BlockPosition, Integer>(points.size());
|
||||
+ for (int index = 0; index < points.size(); index++) {
|
||||
+ PathPoint point = points.get(index);
|
||||
+ list1.put(new BlockPosition(point.a, point.b, point.c), index);
|
||||
+ }
|
||||
+
|
||||
+ // Akarin end
|
||||
+ Set<io.akarin.server.IndexedBlockPosition> set = this.a(worldserver, list, list1); // Akarin - IndexedBlockPosition
|
||||
int j = pathentity.f() - 1;
|
||||
|
||||
this.a(worldserver, list1, set, j, entityliving, behaviorcontroller);
|
||||
}
|
||||
|
||||
- private Set<BlockPosition> a(WorldServer worldserver, List<GlobalPos> list, List<BlockPosition> list1) {
|
||||
+ private Set<io.akarin.server.IndexedBlockPosition> a(WorldServer worldserver, List<GlobalPos> list, java.util.Map<BlockPosition, Integer> list1) { // Akarin - List -> Map, IndexedBlockPosition
|
||||
+ // Akarin start - remove stream
|
||||
+ /*
|
||||
Stream stream = list.stream().filter((globalpos) -> {
|
||||
return globalpos.getDimensionManager() == worldserver.getWorldProvider().getDimensionManager();
|
||||
}).map(GlobalPos::getBlockPosition);
|
||||
|
||||
list1.getClass();
|
||||
return (Set) stream.filter(list1::contains).collect(Collectors.toSet());
|
||||
+ */
|
||||
+
|
||||
+ Set<io.akarin.server.IndexedBlockPosition> set = Sets.newHashSet();
|
||||
+ DimensionManager manager = worldserver.getWorldProvider().getDimensionManager();
|
||||
+
|
||||
+ for (GlobalPos globalPos : list) {
|
||||
+ if (globalPos.getDimensionManager() == manager) {
|
||||
+ BlockPosition position = globalPos.getBlockPosition();
|
||||
+ Integer index = list1.get(position);
|
||||
+ if (index != null) // contains
|
||||
+ set.add(IndexedBlockPosition.of(index, position));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return set;
|
||||
+ // Akarin end
|
||||
}
|
||||
|
||||
- private void a(WorldServer worldserver, List<BlockPosition> list, Set<BlockPosition> set, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) {
|
||||
- set.forEach((blockposition) -> {
|
||||
- int j = list.indexOf(blockposition);
|
||||
+ private void a(WorldServer worldserver, java.util.Map<BlockPosition, Integer> list, Set<io.akarin.server.IndexedBlockPosition> set, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) { // Akarin - List -> Map, IndexedBlockPosition
|
||||
+ set.forEach((indexedblockposition) -> { // Akarin - IndexedBlockPosition
|
||||
+ BlockPosition blockposition = indexedblockposition.get(); // Akarin - IndexedBlockPosition
|
||||
+ // int j = list.indexOf(blockposition); // Akarin - IndexedBlockPosition
|
||||
IBlockData iblockdata = worldserver.getType(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (TagsBlock.WOODEN_DOORS.isTagged(block) && block instanceof BlockDoor) {
|
||||
- boolean flag = j >= i;
|
||||
+ boolean flag = indexedblockposition.index() >= i; // Akarin - IndexedBlockPosition
|
||||
|
||||
// CraftBukkit start - entities opening doors
|
||||
org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition));
|
||||
@@ -74,14 +107,14 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
|
||||
a(worldserver, list, i, entityliving, behaviorcontroller);
|
||||
}
|
||||
|
||||
- public static void a(WorldServer worldserver, List<BlockPosition> list, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) {
|
||||
+ public static void a(WorldServer worldserver, java.util.Map<BlockPosition, Integer> list, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) { // Akarin - List -> Map
|
||||
behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).ifPresent((set) -> {
|
||||
Iterator iterator = set.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
GlobalPos globalpos = (GlobalPos) iterator.next();
|
||||
BlockPosition blockposition = globalpos.getBlockPosition();
|
||||
- int j = list.indexOf(blockposition);
|
||||
+ int j = list.getOrDefault(blockposition, -1); // Akarin - List -> Map
|
||||
|
||||
if (worldserver.getWorldProvider().getDimensionManager() != globalpos.getDimensionManager()) {
|
||||
iterator.remove();
|
||||
diff --git a/src/main/java/net/minecraft/server/BehaviorSleep.java b/src/main/java/net/minecraft/server/BehaviorSleep.java
|
||||
index dfe0f6650..46eb63308 100644
|
||||
--- a/src/main/java/net/minecraft/server/BehaviorSleep.java
|
||||
+++ b/src/main/java/net/minecraft/server/BehaviorSleep.java
|
||||
@@ -57,7 +57,7 @@ public class BehaviorSleep extends Behavior<EntityLiving> {
|
||||
protected void a(WorldServer worldserver, EntityLiving entityliving, long i) {
|
||||
if (i > this.a) {
|
||||
entityliving.getBehaviorController().getMemory(MemoryModuleType.OPENED_DOORS).ifPresent((set) -> {
|
||||
- BehaviorInteractDoor.a(worldserver, (List) ImmutableList.of(), 0, entityliving, entityliving.getBehaviorController());
|
||||
+ BehaviorInteractDoor.a(worldserver, com.google.common.collect.ImmutableMap.of(), 0, entityliving, entityliving.getBehaviorController()); // Akarin - List -> Map
|
||||
});
|
||||
entityliving.entitySleep(((GlobalPos) entityliving.getBehaviorController().getMemory(MemoryModuleType.HOME).get()).getBlockPosition());
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,42 +0,0 @@
|
||||
From bb1039b72c063e2a5f8185a3aeb64014bca60ff4 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 21 Feb 2020 17:04:51 -0600
|
||||
Subject: [PATCH] Purpur MC-125757 Fix - Always increment arrow despawn counter
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityArrow.java | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
index 4dc53d3fa..3b1b133f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
@@ -147,6 +147,8 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
this.extinguish();
|
||||
}
|
||||
|
||||
+ this.checkDespawnCounter(); // Purpur - moved from below - MC-125757
|
||||
+
|
||||
if (this.inGround && !flag) {
|
||||
if (this.aq != iblockdata && this.world.a(this.getBoundingBox().g(0.06D))) {
|
||||
this.inGround = false;
|
||||
@@ -154,7 +156,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
this.despawnCounter = 0;
|
||||
this.as = 0;
|
||||
} else if (!this.world.isClientSide) {
|
||||
- this.i();
|
||||
+ // this.i(); // Purpur moved up - MC-125757
|
||||
}
|
||||
|
||||
++this.d;
|
||||
@@ -275,6 +277,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
}
|
||||
}
|
||||
|
||||
+ protected void checkDespawnCounter() { i(); } // Purpur - OBFHELPER
|
||||
protected void i() {
|
||||
++this.despawnCounter;
|
||||
if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,32 +0,0 @@
|
||||
From fbfdf8d2a0899a87c93b7de7ddcfcf7fd94bb1a5 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 4 Apr 2020 03:07:59 -0500
|
||||
Subject: [PATCH] Purpur Skip events if there's no listeners
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/CommandDispatcher.java | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java
|
||||
index 2d512aa4f..2c8ef6dd6 100644
|
||||
--- a/src/main/java/net/minecraft/server/CommandDispatcher.java
|
||||
+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java
|
||||
@@ -274,6 +274,7 @@ public class CommandDispatcher {
|
||||
}
|
||||
|
||||
private void runSync(EntityPlayer entityplayer, Collection<String> bukkit, RootCommandNode<ICompletionProvider> rootcommandnode) {
|
||||
+ if (PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Purpur - skip all this crap if there's nothing listening
|
||||
// Paper end - Async command map building
|
||||
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandListenerWrapper>(entityplayer.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper
|
||||
PlayerCommandSendEvent event = new PlayerCommandSendEvent(entityplayer.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
||||
@@ -286,6 +287,7 @@ public class CommandDispatcher {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ } // Purpur - skip event
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,218 +0,0 @@
|
||||
From ce9af22565f9719a92cb3011327c997b6bd72ee9 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Tue, 21 Apr 2020 15:49:52 +0200
|
||||
Subject: [PATCH] Purpur Add more timings timers
|
||||
|
||||
---
|
||||
.../co/aikar/timings/MinecraftTimings.java | 22 +++++++++++++++++++
|
||||
.../minecraft/server/EntityInsentient.java | 12 ++++++++++
|
||||
.../net/minecraft/server/EntityLiving.java | 16 +++++++++++++-
|
||||
.../server/PathfinderGoalSelector.java | 6 +++++
|
||||
.../net/minecraft/server/WorldServer.java | 2 ++
|
||||
5 files changed, 57 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||||
index 2966c5731..ae5586737 100644
|
||||
--- a/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||||
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||||
@@ -45,6 +45,28 @@ public final class MinecraftTimings {
|
||||
|
||||
public static final Timing scoreboardScoreSearch = Timings.ofSafe("Scoreboard score search"); // Tuinity - add timings for scoreboard search
|
||||
|
||||
+ // Purpur start
|
||||
+ public static final Timing goalCleanup = Timings.ofSafe("PathfinderGoal - Cleanup");
|
||||
+ public static final Timing goalUpdate = Timings.ofSafe("PathfinderGoal - Update");
|
||||
+ public static final Timing goalTick = Timings.ofSafe("PathfinderGoal - Tick");
|
||||
+
|
||||
+ public static final Timing entityMovementTick = Timings.ofSafe("Entity Movement");
|
||||
+ public static final Timing entityMovementTickAI = Timings.ofSafe("Entity Movement - AI");
|
||||
+ public static final Timing entityMovementTickNewAI = Timings.ofSafe("Entity Movement - New AI");
|
||||
+ public static final Timing entityMovementTickJump = Timings.ofSafe("Entity Movement - Jump");
|
||||
+ public static final Timing entityMovementTickTravel = Timings.ofSafe("Entity Movement - Travel");
|
||||
+ public static final Timing entityMovementTickPush = Timings.ofSafe("Entity Movement - Push");
|
||||
+
|
||||
+ public static final Timing entityInsentientSensing = Timings.ofSafe("Entity Insentient - Sensing");
|
||||
+ public static final Timing entityInsentientTargetSelector = Timings.ofSafe("Entity Insentient - TargetSelector");
|
||||
+ public static final Timing entityInsentientGoalSelector = Timings.ofSafe("Entity Insentient - GoalSelector");
|
||||
+ public static final Timing entityInsentientNavigation = Timings.ofSafe("Entity Insentient - Navigation");
|
||||
+ public static final Timing entityInsentientMobTick = Timings.ofSafe("Entity Insentient - MobTick");
|
||||
+ public static final Timing entityInsentientControls = Timings.ofSafe("Entity Insentient - Controls");
|
||||
+
|
||||
+ public static final Timing passengerTick = Timings.ofSafe("Passenger Tick");
|
||||
+ // Purpur end
|
||||
+
|
||||
private static final Map<Class<?>, String> taskNameCache = new MapMaker().weakKeys().makeMap();
|
||||
|
||||
private MinecraftTimings() {}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index eec434374..916deddd7 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -677,21 +677,32 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
}
|
||||
// Paper end
|
||||
this.world.getMethodProfiler().enter("sensing");
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientSensing.startTiming(); // Purpur
|
||||
this.bw.a();
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientSensing.stopTiming(); // Purpur
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().enter("targetSelector");
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientTargetSelector.startTiming(); // Purpur
|
||||
this.targetSelector.doTick();
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientTargetSelector.stopTiming(); // Purpur
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().enter("goalSelector");
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientGoalSelector.startTiming(); // Purpur
|
||||
this.goalSelector.doTick();
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientGoalSelector.stopTiming(); // Purpur
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().enter("navigation");
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientNavigation.startTiming(); // Purpur
|
||||
this.navigation.c();
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientNavigation.stopTiming(); // Purpur
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().enter("mob tick");
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientMobTick.startTiming(); // Purpur
|
||||
this.mobTick();
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientMobTick.stopTiming(); // Purpur
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().enter("controls");
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientControls.startTiming(); // Purpur
|
||||
this.world.getMethodProfiler().enter("move");
|
||||
this.moveController.a();
|
||||
this.world.getMethodProfiler().exitEnter("look");
|
||||
@@ -699,6 +710,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
this.world.getMethodProfiler().exitEnter("jump");
|
||||
this.bq.b();
|
||||
this.world.getMethodProfiler().exit();
|
||||
+ co.aikar.timings.MinecraftTimings.entityInsentientControls.stopTiming(); // Purpur
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.K();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 7a01daa57..1d66afe9b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2413,7 +2413,11 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
- this.movementTick();
|
||||
+
|
||||
+ MinecraftTimings.entityMovementTick.startTiming(); // Purpur
|
||||
+ if (!dead) this.movementTick(); // Purpur
|
||||
+ MinecraftTimings.entityMovementTick.stopTiming(); // Purpur
|
||||
+
|
||||
double d0 = this.locX() - this.lastX;
|
||||
double d1 = this.locZ() - this.lastZ;
|
||||
float f = (float) (d0 * d0 + d1 * d1);
|
||||
@@ -2620,18 +2624,23 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
this.setMot(d4, d5, d6);
|
||||
this.world.getMethodProfiler().enter("ai");
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickAI.startTiming(); // Purpur
|
||||
if (this.isFrozen()) {
|
||||
this.jumping = false;
|
||||
this.aZ = 0.0F;
|
||||
this.bb = 0.0F;
|
||||
} else if (this.doAITick()) {
|
||||
this.world.getMethodProfiler().enter("newAi");
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickNewAI.startTiming(); // Purpur
|
||||
this.doTick();
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickNewAI.stopTiming(); // Purpur
|
||||
this.world.getMethodProfiler().exit();
|
||||
}
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickAI.stopTiming(); // Purpur
|
||||
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().enter("jump");
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickJump.startTiming(); // Purpur
|
||||
if (this.jumping) {
|
||||
if (this.N > 0.0D && (!this.onGround || this.N > 0.4D)) {
|
||||
this.c(TagsFluid.WATER);
|
||||
@@ -2646,21 +2655,26 @@ public abstract class EntityLiving extends Entity {
|
||||
} else {
|
||||
this.jumpTicks = 0;
|
||||
}
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickJump.stopTiming(); // Purpur
|
||||
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().enter("travel");
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickTravel.startTiming(); // Purpur
|
||||
this.aZ *= 0.98F;
|
||||
this.bb *= 0.98F;
|
||||
this.n();
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
|
||||
this.e(new Vec3D((double) this.aZ, (double) this.ba, (double) this.bb));
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickTravel.stopTiming(); // Purpur
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.world.getMethodProfiler().enter("push");
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickPush.startTiming(); // Purpur
|
||||
if (this.bn > 0) {
|
||||
--this.bn;
|
||||
this.a(axisalignedbb, this.getBoundingBox());
|
||||
}
|
||||
+ co.aikar.timings.MinecraftTimings.entityMovementTickPush.stopTiming(); // Purpur
|
||||
|
||||
if(!de.tr7zw.yapfa.YapfaConfig.disableEntityCollisions) // YAPFA
|
||||
this.collideNearby();
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
index a68fc11ec..95dde6653 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
@@ -78,6 +78,7 @@ public class PathfinderGoalSelector {
|
||||
private static final PathfinderGoal.Type[] PATHFINDER_GOAL_TYPES = PathfinderGoal.Type.values(); // Paper - remove streams from pathfindergoalselector
|
||||
|
||||
public void doTick() {
|
||||
+ co.aikar.timings.MinecraftTimings.goalCleanup.startTiming();
|
||||
this.e.enter("goalCleanup");
|
||||
// Paper start - remove streams from pathfindergoalselector
|
||||
for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
@@ -97,8 +98,10 @@ public class PathfinderGoalSelector {
|
||||
}
|
||||
|
||||
});
|
||||
+ co.aikar.timings.MinecraftTimings.goalCleanup.stopTiming();
|
||||
this.e.exit();
|
||||
this.e.enter("goalUpdate");
|
||||
+ co.aikar.timings.MinecraftTimings.goalUpdate.startTiming();
|
||||
// Paper start - remove streams from pathfindergoalselector
|
||||
goal_update_loop: for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
PathfinderGoalWrapped wrappedGoal = iterator.next();
|
||||
@@ -141,8 +144,10 @@ public class PathfinderGoalSelector {
|
||||
wrappedGoal.c();
|
||||
}
|
||||
// Paper end - remove streams from pathfindergoalselector
|
||||
+ co.aikar.timings.MinecraftTimings.goalUpdate.stopTiming();
|
||||
this.e.exit();
|
||||
this.e.enter("goalTick");
|
||||
+ co.aikar.timings.MinecraftTimings.goalTick.startTiming();
|
||||
// Paper start - remove streams from pathfindergoalselector
|
||||
for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
PathfinderGoalWrapped wrappedGoal = iterator.next();
|
||||
@@ -151,6 +156,7 @@ public class PathfinderGoalSelector {
|
||||
}
|
||||
}
|
||||
// Paper end - remove streams from pathfindergoalselector
|
||||
+ co.aikar.timings.MinecraftTimings.goalTick.stopTiming();
|
||||
this.e.exit();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 24cd10c96..44eec7b1b 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -1302,7 +1302,9 @@ public class WorldServer extends World {
|
||||
return IRegistry.ENTITY_TYPE.getKey(entity1.getEntityType()).toString();
|
||||
});
|
||||
gameprofilerfiller.c("tickPassenger");
|
||||
+ co.aikar.timings.MinecraftTimings.passengerTick.startTiming(); // Purpur
|
||||
entity1.passengerTick();
|
||||
+ co.aikar.timings.MinecraftTimings.passengerTick.stopTiming(); // Purpur
|
||||
gameprofilerfiller.exit();
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,39 +0,0 @@
|
||||
From ab054278d0f0a33616d880af02263ac45ddd212e Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Tue, 21 Apr 2020 16:14:10 +0200
|
||||
Subject: [PATCH] Modify default configs
|
||||
|
||||
---
|
||||
src/main/java/com/destroystokyo/paper/PaperConfig.java | 2 +-
|
||||
src/main/java/com/destroystokyo/paper/PaperWorldConfig.java | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 8444819f0..f83c43f6c 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -202,7 +202,7 @@ public class PaperConfig {
|
||||
|
||||
public static String timingsServerName;
|
||||
private static void timings() {
|
||||
- boolean timings = getBoolean("timings.enabled", true);
|
||||
+ boolean timings = getBoolean("timings.enabled", false); // YAPFA don't profile by default
|
||||
boolean verboseTimings = getBoolean("timings.verbose", true);
|
||||
TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
|
||||
TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses"));
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index ecacb72b9..340502d92 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -648,7 +648,7 @@ public class PaperWorldConfig {
|
||||
}
|
||||
|
||||
public boolean cooldownHopperWhenFull = true;
|
||||
- public boolean disableHopperMoveEvents = false;
|
||||
+ public boolean disableHopperMoveEvents = true; // YAPFA disable by default
|
||||
private void hopperOptimizations() {
|
||||
cooldownHopperWhenFull = getBoolean("hopper.cooldown-when-full", cooldownHopperWhenFull);
|
||||
log("Cooldown Hoppers when Full: " + (cooldownHopperWhenFull ? "enabled" : "disabled"));
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,60 +0,0 @@
|
||||
From 4b13ca08957ac2c70e129670244a74120f69d7e4 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 11 May 2020 21:00:44 +0200
|
||||
Subject: [PATCH] lithium MixinDirection
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/EnumDirection.java | 16 ++++++++++++----
|
||||
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java
|
||||
index 3b7bb296d..b4258ec78 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnumDirection.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnumDirection.java
|
||||
@@ -17,13 +17,13 @@ public enum EnumDirection implements INamable {
|
||||
DOWN(0, 1, -1, "down", EnumDirection.EnumAxisDirection.NEGATIVE, EnumDirection.EnumAxis.Y, new BaseBlockPosition(0, -1, 0)), UP(1, 0, -1, "up", EnumDirection.EnumAxisDirection.POSITIVE, EnumDirection.EnumAxis.Y, new BaseBlockPosition(0, 1, 0)), NORTH(2, 3, 2, "north", EnumDirection.EnumAxisDirection.NEGATIVE, EnumDirection.EnumAxis.Z, new BaseBlockPosition(0, 0, -1)), SOUTH(3, 2, 0, "south", EnumDirection.EnumAxisDirection.POSITIVE, EnumDirection.EnumAxis.Z, new BaseBlockPosition(0, 0, 1)), WEST(4, 5, 1, "west", EnumDirection.EnumAxisDirection.NEGATIVE, EnumDirection.EnumAxis.X, new BaseBlockPosition(-1, 0, 0)), EAST(5, 4, 3, "east", EnumDirection.EnumAxisDirection.POSITIVE, EnumDirection.EnumAxis.X, new BaseBlockPosition(1, 0, 0));
|
||||
|
||||
private final int g;
|
||||
- private final int h;
|
||||
+ private final int h; // YAPFA this is idOpposit(yarn)
|
||||
private final int i;
|
||||
private final String j;
|
||||
private final EnumDirection.EnumAxis k;
|
||||
private final EnumDirection.EnumAxisDirection l;
|
||||
private final BaseBlockPosition m;
|
||||
- private static final EnumDirection[] n = values();
|
||||
+ private static final EnumDirection[] n = values(); private static final EnumDirection[] ALL = n;// YAPFA OBF HELPER
|
||||
private static final Map<String, EnumDirection> o = (Map) Arrays.stream(EnumDirection.n).collect(Collectors.toMap(EnumDirection::l, (enumdirection) -> {
|
||||
return enumdirection;
|
||||
}));
|
||||
@@ -95,8 +95,12 @@ public enum EnumDirection implements INamable {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * @reason Avoid the modulo/abs operations
|
||||
+ * @author JellySquid
|
||||
+ */
|
||||
public EnumDirection opposite() {
|
||||
- return fromType1(this.h);
|
||||
+ return ALL[this.h];
|
||||
}
|
||||
|
||||
public EnumDirection f() {
|
||||
@@ -182,8 +186,12 @@ public enum EnumDirection implements INamable {
|
||||
return (float) ((this.i & 3) * 90);
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * @reason Do not allocate an excessive number of Direction arrays
|
||||
+ * @author JellySquid
|
||||
+ */
|
||||
public static EnumDirection a(Random random) {
|
||||
- return values()[random.nextInt(values().length)];
|
||||
+ return ALL[random.nextInt(ALL.length)];
|
||||
}
|
||||
|
||||
public static EnumDirection a(double d0, double d1, double d2) {
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,59 +0,0 @@
|
||||
From a433ea4d262e200a4f746625dc641712a60e7524 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 11 May 2020 21:02:57 +0200
|
||||
Subject: [PATCH] lithium MixinBox
|
||||
|
||||
---
|
||||
.../net/minecraft/server/AxisAlignedBB.java | 34 ++++++++++++++++---
|
||||
1 file changed, 30 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java
|
||||
index 688c5b1bd..e78e27588 100644
|
||||
--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java
|
||||
+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java
|
||||
@@ -150,12 +150,38 @@ public class AxisAlignedBB {
|
||||
return new AxisAlignedBB((double) structureboundingbox.a, (double) structureboundingbox.b, (double) structureboundingbox.c, (double) (structureboundingbox.d + 1), (double) (structureboundingbox.e + 1), (double) (structureboundingbox.f + 1));
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * @reason Simplify the code to better help the JVM optimize it
|
||||
+ * @author JellySquid
|
||||
+ */
|
||||
public double a(EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
- return enumdirection_enumaxis.a(this.minX, this.minY, this.minZ);
|
||||
- }
|
||||
-
|
||||
+ switch (enumdirection_enumaxis) {
|
||||
+ case X:
|
||||
+ return this.minX;
|
||||
+ case Y:
|
||||
+ return this.minY;
|
||||
+ case Z:
|
||||
+ return this.minZ;
|
||||
+ }
|
||||
+
|
||||
+ throw new IllegalArgumentException();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @reason Simplify the code to better help the JVM optimize it
|
||||
+ * @author JellySquid
|
||||
+ */
|
||||
public double b(EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
- return enumdirection_enumaxis.a(this.maxX, this.maxY, this.maxZ);
|
||||
+ switch (enumdirection_enumaxis) {
|
||||
+ case X:
|
||||
+ return this.maxX;
|
||||
+ case Y:
|
||||
+ return this.maxY;
|
||||
+ case Z:
|
||||
+ return this.maxZ;
|
||||
+ }
|
||||
+
|
||||
+ throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,80 +0,0 @@
|
||||
From ab79d849781b7d9ce55ac075c3ba44ef131d1d32 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 11 May 2020 21:37:44 +0200
|
||||
Subject: [PATCH] lithium enum_values
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/BlockPiston.java | 8 ++++----
|
||||
src/main/java/net/minecraft/server/EntityLiving.java | 6 +++++-
|
||||
.../java/net/minecraft/server/PistonExtendsChecker.java | 4 +++-
|
||||
3 files changed, 12 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
index 8312ed779..23a2c1a91 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
@@ -138,8 +138,9 @@ public class BlockPiston extends BlockDirectional {
|
||||
|
||||
}
|
||||
|
||||
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // YAPFA - don't recreate
|
||||
+
|
||||
private boolean a(World world, BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
- EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
int i = aenumdirection.length;
|
||||
|
||||
int j;
|
||||
@@ -156,12 +157,11 @@ public class BlockPiston extends BlockDirectional {
|
||||
return true;
|
||||
} else {
|
||||
BlockPosition blockposition1 = blockposition.up();
|
||||
- EnumDirection[] aenumdirection1 = EnumDirection.values();
|
||||
|
||||
- j = aenumdirection1.length;
|
||||
+ j = aenumdirection.length;
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
- EnumDirection enumdirection2 = aenumdirection1[k];
|
||||
+ EnumDirection enumdirection2 = aenumdirection[k];
|
||||
|
||||
if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) {
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 1d66afe9b..2b3e264ed 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2499,9 +2499,13 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * @reason Avoid cloning enum values
|
||||
+ */
|
||||
+ private final static EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
||||
+
|
||||
// Paper start - split into own method from above
|
||||
public void updateEntityEquipment() {
|
||||
- EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
||||
int k = aenumitemslot.length;
|
||||
for (int l = 0; l < k; ++l) {
|
||||
EnumItemSlot enumitemslot = aenumitemslot[l];
|
||||
diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
||||
index de1c98cca..1ac3e5a37 100644
|
||||
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
||||
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
||||
@@ -167,9 +167,11 @@ public class PistonExtendsChecker {
|
||||
this.f.addAll(list2);
|
||||
}
|
||||
|
||||
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // YAPFA - don't recreate
|
||||
+
|
||||
private boolean a(BlockPosition blockposition) {
|
||||
IBlockData iblockdata = this.a.getType(blockposition);
|
||||
- EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
+
|
||||
int i = aenumdirection.length;
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,109 +0,0 @@
|
||||
From 4234086655d80465db6e7bcc13936ab6bab9edd3 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 11 May 2020 21:50:18 +0200
|
||||
Subject: [PATCH] lithium MixinAxisCycleDirection
|
||||
|
||||
---
|
||||
.../net/minecraft/server/EnumAxisCycle.java | 90 +++++++++++++++++++
|
||||
1 file changed, 90 insertions(+)
|
||||
create mode 100644 src/main/java/net/minecraft/server/EnumAxisCycle.java
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EnumAxisCycle.java b/src/main/java/net/minecraft/server/EnumAxisCycle.java
|
||||
new file mode 100644
|
||||
index 000000000..d05cddcc9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java
|
||||
@@ -0,0 +1,90 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+public enum EnumAxisCycle {
|
||||
+
|
||||
+ NONE {
|
||||
+ @Override
|
||||
+ public int a(int i, int j, int k, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
+ return enumdirection_enumaxis.a(i, j, k);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
+ return enumdirection_enumaxis;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumAxisCycle a() {
|
||||
+ return this;
|
||||
+ }
|
||||
+ },
|
||||
+ FORWARD {
|
||||
+ @Override
|
||||
+ public int a(int i, int j, int k, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
+ return enumdirection_enumaxis.a(k, i, j);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The JVM has difficulty optimizing these functions due to the use of dynamic dispatch. They can trivially be
|
||||
+ * implemented as a simple switch lookup table.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
+ switch (enumdirection_enumaxis) {
|
||||
+ case X:
|
||||
+ return EnumDirection.EnumAxis.Y;
|
||||
+ case Y:
|
||||
+ return EnumDirection.EnumAxis.Z;
|
||||
+ case Z:
|
||||
+ return EnumDirection.EnumAxis.X;
|
||||
+ }
|
||||
+
|
||||
+ throw new IllegalArgumentException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumAxisCycle a() {
|
||||
+ return BACKWARD;
|
||||
+ }
|
||||
+ },
|
||||
+ BACKWARD {
|
||||
+ @Override
|
||||
+ public int a(int i, int j, int k, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
+ return enumdirection_enumaxis.a(j, k, i);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
+ switch (enumdirection_enumaxis) {
|
||||
+ case X:
|
||||
+ return EnumDirection.EnumAxis.Z;
|
||||
+ case Y:
|
||||
+ return EnumDirection.EnumAxis.X;
|
||||
+ case Z:
|
||||
+ return EnumDirection.EnumAxis.Y;
|
||||
+ }
|
||||
+
|
||||
+ throw new IllegalArgumentException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumAxisCycle a() {
|
||||
+ return FORWARD;
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ public static final EnumDirection.EnumAxis[] d = EnumDirection.EnumAxis.values();
|
||||
+ public static final EnumAxisCycle[] e = values();
|
||||
+
|
||||
+ private EnumAxisCycle() {}
|
||||
+
|
||||
+ public abstract int a(int i, int j, int k, EnumDirection.EnumAxis enumdirection_enumaxis);
|
||||
+
|
||||
+ public abstract EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis);
|
||||
+
|
||||
+ public abstract EnumAxisCycle a();
|
||||
+
|
||||
+ public static EnumAxisCycle a(EnumDirection.EnumAxis enumdirection_enumaxis, EnumDirection.EnumAxis enumdirection_enumaxis1) {
|
||||
+ return EnumAxisCycle.e[Math.floorMod(enumdirection_enumaxis1.ordinal() - enumdirection_enumaxis.ordinal(), 3)];
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,39 +0,0 @@
|
||||
From f2bae99a264f92eb358ffbe933bc640ecc913ab1 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 11 May 2020 22:07:17 +0200
|
||||
Subject: [PATCH] lithium MixinGoalSelector
|
||||
|
||||
Only replaces the set type, might want to also port the logic rewrite in the future
|
||||
---
|
||||
.../java/net/minecraft/server/PathfinderGoalSelector.java | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
index 95dde6653..8c0c93197 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
||||
@@ -1,7 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector
|
||||
-import com.google.common.collect.Sets;
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
|
||||
+
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator; // Paper - remove streams from pathfindergoalselector
|
||||
@@ -26,7 +27,10 @@ public class PathfinderGoalSelector {
|
||||
}
|
||||
};
|
||||
private final Map<PathfinderGoal.Type, PathfinderGoalWrapped> c = new EnumMap(PathfinderGoal.Type.class);
|
||||
- private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet();public Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER
|
||||
+ /**
|
||||
+ * Replace the task set with an optimized collection type which performs better for iteration.
|
||||
+ */
|
||||
+ private final Set<PathfinderGoalWrapped> d = new ObjectLinkedOpenHashSet<PathfinderGoalWrapped>();/* YAPFA better set */public Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER
|
||||
private final GameProfilerFiller e;
|
||||
private final EnumSet<PathfinderGoal.Type> f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
|
||||
private final OptimizedSmallEnumSet<PathfinderGoal.Type> goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,116 +0,0 @@
|
||||
From 1610e22769a72ab49a755f32df790a01c750b71b Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Mon, 11 May 2020 22:56:27 +0200
|
||||
Subject: [PATCH] lithium MixinLandPathNodeMaker
|
||||
|
||||
---
|
||||
.../minecraft/server/PathfinderNormal.java | 66 +++++++++++++++----
|
||||
1 file changed, 55 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
index f406abd84..cbe9b6439 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
@@ -1,6 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
|
||||
+
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
@@ -8,6 +12,12 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class PathfinderNormal extends PathfinderAbstract {
|
||||
|
||||
+ // YAPFA start
|
||||
+
|
||||
+ // This is not thread-safe!
|
||||
+ private static final Reference2ReferenceMap<IBlockData, PathType> commonTypes = new Reference2ReferenceOpenHashMap<>();
|
||||
+ // YAPFA end
|
||||
+
|
||||
protected float j;
|
||||
|
||||
public PathfinderNormal() {}
|
||||
@@ -455,12 +465,48 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
// Tuinity end - reduce blockpos allocation
|
||||
IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
|
||||
if (iblockdata == null) return PathType.BLOCKED; // Paper
|
||||
- Block block = iblockdata.getBlock();
|
||||
- Material material = iblockdata.getMaterial();
|
||||
+ // Check early if the block is air as it will always be open regardless of other conditions
|
||||
+ if(iblockdata.isAir())return PathType.OPEN;
|
||||
+
|
||||
+ // Get the cached type for this block state
|
||||
+ PathType type = commonTypes.get(iblockdata);
|
||||
+
|
||||
+ // No result has been cached for this block state yet, so calculate and cache it
|
||||
+ if (type == null) {
|
||||
+ commonTypes.put(iblockdata, type = getPathType(iblockaccess, blockposition, iblockdata));
|
||||
+ }
|
||||
+ // If the node type is open, it means that we were unable to determine a more specific type, so we need
|
||||
+ // to check the fallback path.
|
||||
+ if (type == PathType.OPEN) {
|
||||
+ // This is only ever called in vanilla after all other possibilities are exhausted, but before fluid checks
|
||||
+ // It should be safe to perform it last in actuality and take advantage of the cache for fluid types as well
|
||||
+ // since fluids will always pass this check.
|
||||
+ if (!iblockdata.a(iblockaccess, blockposition, PathMode.LAND)) {
|
||||
+ return PathType.BLOCKED;
|
||||
+ }
|
||||
|
||||
- if (iblockdata.isAir()) {
|
||||
+ // All checks succeed, this path node really is open!
|
||||
return PathType.OPEN;
|
||||
- } else if (!block.a(TagsBlock.TRAPDOORS) && block != Blocks.LILY_PAD) {
|
||||
+ }
|
||||
+
|
||||
+ // Return the cached value since we found an obstacle earlier
|
||||
+ return type;
|
||||
+
|
||||
+
|
||||
+
|
||||
+ // Tuinity start - reduce blockpos allocation
|
||||
+ } finally {
|
||||
+ blockposition.close();
|
||||
+ }
|
||||
+ // Tuinity end - reduce blockpos allocation
|
||||
+ }
|
||||
+
|
||||
+ private static PathType getPathType(IBlockAccess iblockaccess, BlockPosition.PooledBlockPosition blockposition,
|
||||
+ IBlockData iblockdata) {
|
||||
+ Block block = iblockdata.getBlock();
|
||||
+ Material material = iblockdata.getMaterial();
|
||||
+
|
||||
+ if (!block.a(TagsBlock.TRAPDOORS) && block != Blocks.LILY_PAD) {
|
||||
if (block == Blocks.FIRE) {
|
||||
return PathType.DAMAGE_FIRE;
|
||||
} else if (block == Blocks.CACTUS) {
|
||||
@@ -484,17 +530,15 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
} else if (!block.a(TagsBlock.FENCES) && !block.a(TagsBlock.WALLS) && (!(block instanceof BlockFenceGate) || (Boolean) iblockdata.get(BlockFenceGate.OPEN))) {
|
||||
Fluid fluid = iblockdata.getFluid(); // Tuinity - optimise out world#getFluid
|
||||
|
||||
- return fluid.a(TagsFluid.WATER) ? PathType.WATER : (fluid.a(TagsFluid.LAVA) ? PathType.LAVA : (iblockdata.a(iblockaccess, blockposition, PathMode.LAND) ? PathType.OPEN : PathType.BLOCKED));
|
||||
+ if(fluid.a(TagsFluid.WATER))return PathType.WATER;
|
||||
+ if(fluid.a(TagsFluid.LAVA))return PathType.LAVA;
|
||||
+
|
||||
+ return PathType.OPEN;
|
||||
} else {
|
||||
return PathType.FENCE;
|
||||
}
|
||||
} else {
|
||||
return PathType.TRAPDOOR;
|
||||
}
|
||||
- // Tuinity start - reduce blockpos allocation
|
||||
- } finally {
|
||||
- blockposition.close();
|
||||
- }
|
||||
- // Tuinity end - reduce blockpos allocation
|
||||
- }
|
||||
+ }
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,211 +0,0 @@
|
||||
From b4ebbec2a49e352d00a35a45d0a9e0333fb3d5b3 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Tue, 12 May 2020 00:38:31 +0200
|
||||
Subject: [PATCH] lithium MixinBiome
|
||||
|
||||
---
|
||||
.../common/util/collections/HashedList.java | 168 ++++++++++++++++++
|
||||
.../java/net/minecraft/server/BiomeBase.java | 4 +-
|
||||
2 files changed, 171 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
|
||||
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
|
||||
new file mode 100644
|
||||
index 000000000..a2e3e96e1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
|
||||
@@ -0,0 +1,168 @@
|
||||
+package me.jellysquid.mods.lithium.common.util.collections;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectArraySet;
|
||||
+
|
||||
+import java.util.*;
|
||||
+
|
||||
+/**
|
||||
+ * Wraps a {@link List} with a hash table which provides O(1) lookups for {@link Collection#contains(Object)}.
|
||||
+ *
|
||||
+ * @see https://github.com/jellysquid3/lithium-fabric/blob/1.16.x/fabric/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
|
||||
+ */
|
||||
+public class HashedList<T> implements List<T> {
|
||||
+ private final List<T> list;
|
||||
+ private final Set<T> set;
|
||||
+
|
||||
+ private HashedList(List<T> list, Set<T> set) {
|
||||
+ this.list = list;
|
||||
+ this.set = set;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int size() {
|
||||
+ return this.list.size();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isEmpty() {
|
||||
+ return this.list.isEmpty();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean contains(Object o) {
|
||||
+ return this.set.contains(o);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Iterator<T> iterator() {
|
||||
+ return this.list.iterator();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Object[] toArray() {
|
||||
+ return this.list.toArray();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public <T1> T1[] toArray(T1[] a) {
|
||||
+ return this.list.toArray(a);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean add(T t) {
|
||||
+ this.set.add(t);
|
||||
+
|
||||
+ return this.list.add(t);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean remove(Object o) {
|
||||
+ this.set.remove(o);
|
||||
+
|
||||
+ return this.list.remove(o);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean containsAll(Collection<?> c) {
|
||||
+ return this.set.containsAll(c);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean addAll(Collection<? extends T> c) {
|
||||
+ this.set.addAll(c);
|
||||
+
|
||||
+ return this.list.addAll(c);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean addAll(int index, Collection<? extends T> c) {
|
||||
+ this.set.addAll(c);
|
||||
+
|
||||
+ return this.list.addAll(index, c);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean removeAll(Collection<?> c) {
|
||||
+ this.set.removeAll(c);
|
||||
+
|
||||
+ return this.list.removeAll(c);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean retainAll(Collection<?> c) {
|
||||
+ this.set.retainAll(c);
|
||||
+
|
||||
+ return this.list.retainAll(c);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void clear() {
|
||||
+ this.set.clear();
|
||||
+ this.list.clear();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public T get(int index) {
|
||||
+ return this.list.get(index);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public T set(int index, T element) {
|
||||
+ T prev = this.list.set(index, element);
|
||||
+
|
||||
+ if (prev != null) {
|
||||
+ this.set.remove(prev);
|
||||
+ }
|
||||
+
|
||||
+ this.set.add(element);
|
||||
+
|
||||
+ return prev;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void add(int index, T element) {
|
||||
+ this.set.add(element);
|
||||
+
|
||||
+ this.list.add(index, element);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public T remove(int index) {
|
||||
+ T prev = this.list.remove(index);
|
||||
+
|
||||
+ if (prev != null) {
|
||||
+ this.set.remove(prev);
|
||||
+ }
|
||||
+
|
||||
+ return prev;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int indexOf(Object o) {
|
||||
+ return this.list.indexOf(o);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int lastIndexOf(Object o) {
|
||||
+ return this.list.lastIndexOf(o);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ListIterator<T> listIterator() {
|
||||
+ return this.list.listIterator();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ListIterator<T> listIterator(int index) {
|
||||
+ return this.list.listIterator(index);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<T> subList(int fromIndex, int toIndex) {
|
||||
+ return this.list.subList(fromIndex, toIndex);
|
||||
+ }
|
||||
+
|
||||
+ public static <T> HashedList<T> wrapper(List<T> list) {
|
||||
+ return new HashedList<>(list, new ObjectArraySet<>(list));
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
|
||||
index ef6c85557..49ca5f8cc 100644
|
||||
--- a/src/main/java/net/minecraft/server/BiomeBase.java
|
||||
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
|
||||
@@ -4,6 +4,8 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import it.unimi.dsi.fastutil.longs.Long2FloatLinkedOpenHashMap;
|
||||
+import me.jellysquid.mods.lithium.common.util.collections.HashedList;
|
||||
+
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -104,7 +106,7 @@ public abstract class BiomeBase {
|
||||
for (j = 0; j < i; ++j) {
|
||||
EnumCreatureType enumcreaturetype = aenumcreaturetype[j];
|
||||
|
||||
- this.v.put(enumcreaturetype, new MobList()); // Paper
|
||||
+ this.v.put(enumcreaturetype, HashedList.wrapper(new MobList())); // Paper // YAPFA lithium change
|
||||
}
|
||||
|
||||
} else {
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,117 +0,0 @@
|
||||
From 481a33f0227035223a90855c9d90d9139ac8ed98 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Tue, 12 May 2020 01:16:14 +0200
|
||||
Subject: [PATCH] lithium MixinTypeFilterableList
|
||||
|
||||
---
|
||||
.../net/minecraft/server/EntitySlice.java | 97 +++++++++++++++++++
|
||||
1 file changed, 97 insertions(+)
|
||||
create mode 100644 src/main/java/net/minecraft/server/EntitySlice.java
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySlice.java b/src/main/java/net/minecraft/server/EntitySlice.java
|
||||
new file mode 100644
|
||||
index 000000000..e61f53a15
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySlice.java
|
||||
@@ -0,0 +1,97 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import java.util.AbstractCollection;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collection;
|
||||
+import java.util.Collections;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.stream.Collectors;
|
||||
+
|
||||
+import com.google.common.collect.Iterators;
|
||||
+import com.google.common.collect.Lists;
|
||||
+import com.google.common.collect.Maps;
|
||||
+
|
||||
+public class EntitySlice<T> extends AbstractCollection<T> {
|
||||
+ private final Map<Class<?>, List<T>> a = Maps.newHashMap();
|
||||
+ private final Class<T> b;
|
||||
+ private final List<T> c = Lists.newArrayList();
|
||||
+
|
||||
+ public EntitySlice(Class<T> var0) {
|
||||
+ this.b = var0;
|
||||
+ this.a.put(var0, this.c);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean add(T var0) {
|
||||
+ boolean var1 = false;
|
||||
+ for (Map.Entry<Class<?>, List<T>> var3 : this.a.entrySet()) {
|
||||
+ if (!var3.getKey().isInstance(var0))
|
||||
+ continue;
|
||||
+ var1 |= var3.getValue().add(var0);
|
||||
+ }
|
||||
+ return var1;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean remove(Object var0) {
|
||||
+ boolean var1 = false;
|
||||
+ for (Map.Entry<Class<?>, List<T>> var3 : this.a.entrySet()) {
|
||||
+ if (!var3.getKey().isInstance(var0))
|
||||
+ continue;
|
||||
+ List<T> var4 = var3.getValue();
|
||||
+ var1 |= var4.remove(var0);
|
||||
+ }
|
||||
+ return var1;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean contains(Object var0) {
|
||||
+ return this.a(var0.getClass()).contains(var0);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @reason Only perform the slow Class#isAssignableFrom(Class) if a list doesn't exist for the type, otherwise
|
||||
+ * we can assume it's already valid. The slow-path code is moved to a separate method to help the JVM inline this.
|
||||
+ * @author JellySquid
|
||||
+ */
|
||||
+ public <S> Collection<S> a(Class<S> var02) {
|
||||
+ Collection<T> collection = this.a.get(var02);
|
||||
+
|
||||
+ if(collection == null) {
|
||||
+ collection = createCollection(var02);
|
||||
+ }
|
||||
+
|
||||
+ return (Collection<S>) Collections.unmodifiableCollection(collection);
|
||||
+ }
|
||||
+
|
||||
+ public <S> Collection<T> createCollection(Class<S> var02) {
|
||||
+ if (!this.b.isAssignableFrom(var02)) {
|
||||
+ throw new IllegalArgumentException("Don't know how to search for " + var02);
|
||||
+ }
|
||||
+ List<T> list = new ArrayList<>();
|
||||
+
|
||||
+ for (T allElement : this.c) {
|
||||
+ if (var02.isInstance(allElement)) {
|
||||
+ list.add(allElement);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ this.a.put(var02, list);
|
||||
+ return list;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Iterator<T> iterator() {
|
||||
+ if (this.c.isEmpty()) {
|
||||
+ return Collections.emptyIterator();
|
||||
+ }
|
||||
+ return Iterators.unmodifiableIterator(this.c.iterator());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int size() {
|
||||
+ return this.c.size();
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,41 +0,0 @@
|
||||
From d345be4dc0b8cd474190e7b819fa315d90c9eced Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Tue, 16 Jun 2020 17:29:20 +0200
|
||||
Subject: [PATCH] Item stuck sleep config
|
||||
|
||||
---
|
||||
src/main/java/de/tr7zw/yapfa/YapfaConfig.java | 5 +++++
|
||||
src/main/java/net/minecraft/server/EntityItem.java | 2 +-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
index 29587589c..78d21c2ea 100644
|
||||
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
@@ -226,4 +226,9 @@ public class YapfaConfig {
|
||||
pistonPushLimit = getInt("settings.pistonPushLimit", 12);
|
||||
}
|
||||
|
||||
+ public static int itemStuckSleepTicks = 1;
|
||||
+ private static void itemStuckSleepTicks() {
|
||||
+ itemStuckSleepTicks = getInt("settings.itemStuckSleepTicks", 1);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index 2926fbb95..42884fba1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -79,7 +79,7 @@ public class EntityItem extends Entity {
|
||||
|
||||
if (this.world.isClientSide) {
|
||||
this.noclip = false;
|
||||
- } else {
|
||||
+ } else if(!this.onGround || this.noclip || this.ticksLived % de.tr7zw.yapfa.YapfaConfig.itemStuckSleepTicks == 0) { // YAPFA
|
||||
this.noclip = !this.world.getCubes(this);
|
||||
if (this.noclip) {
|
||||
this.k(this.locX(), (this.getBoundingBox().minY + this.getBoundingBox().maxY) / 2.0D, this.locZ());
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,181 +0,0 @@
|
||||
From 203ec11528c759173d4c210127fe7c755dd285ca Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Fri, 19 Jun 2020 19:21:35 +0200
|
||||
Subject: [PATCH] Option for simpler Villagers
|
||||
|
||||
Option to extremly simplefy the villager AI.
|
||||
---
|
||||
src/main/java/de/tr7zw/yapfa/YapfaConfig.java | 10 +++
|
||||
.../net/minecraft/server/EntityVillager.java | 84 ++++++++++++++++++-
|
||||
2 files changed, 91 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
index 78d21c2ea..5af955493 100644
|
||||
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
|
||||
@@ -231,4 +231,14 @@ public class YapfaConfig {
|
||||
itemStuckSleepTicks = getInt("settings.itemStuckSleepTicks", 1);
|
||||
}
|
||||
|
||||
+ public static boolean simplerVillagerBehavior = false;
|
||||
+ private static void simplerVillagerBehavior() {
|
||||
+ simplerVillagerBehavior = getBoolean("settings.villager.simplerVillagerBehavior", false);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean villagersHideAtNight = false;
|
||||
+ private static void villagersHideAtNight() {
|
||||
+ villagersHideAtNight = getBoolean("settings.villager.villagersHideAtNight", false);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index 7da267d28..f875494b5 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@@ -6,6 +6,8 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
import com.mojang.datafixers.types.DynamicOps;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
+
|
||||
+import de.tr7zw.yapfa.YapfaConfig;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -29,6 +31,9 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent;
|
||||
|
||||
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
|
||||
|
||||
+ //YAPFA
|
||||
+ private boolean simplerVillagerBehavior = YapfaConfig.simplerVillagerBehavior; //get this during villager creation so a reloaded config doesn't get them into an invalid state
|
||||
+
|
||||
private static final DataWatcherObject<VillagerData> bz = DataWatcher.a(EntityVillager.class, DataWatcherRegistry.q);
|
||||
public static final Map<Item, Integer> bx = ImmutableMap.of(Items.BREAD, 4, Items.POTATO, 1, Items.CARROT, 1, Items.BEETROOT, 1);
|
||||
private static final Set<Item> bA = ImmutableSet.of(Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, new Item[]{Items.BEETROOT_SEEDS});
|
||||
@@ -61,13 +66,51 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
public EntityVillager(EntityTypes<? extends EntityVillager> entitytypes, World world, VillagerType villagertype) {
|
||||
super(entitytypes, world);
|
||||
this.bG = new Reputation();
|
||||
- ((Navigation) this.getNavigation()).a(true);
|
||||
- this.getNavigation().d(true);
|
||||
+ if(!simplerVillagerBehavior) {
|
||||
+ ((Navigation) this.getNavigation()).a(true);
|
||||
+ this.getNavigation().d(true);
|
||||
+ }else {
|
||||
+ initPathfinder();
|
||||
+ }
|
||||
this.setCanPickupLoot(true);
|
||||
this.setVillagerData(this.getVillagerData().withType(villagertype).withProfession(VillagerProfession.NONE));
|
||||
this.bo = this.a(new Dynamic(DynamicOpsNBT.a, new NBTTagCompound()));
|
||||
+
|
||||
}
|
||||
|
||||
+ //YAPFA start
|
||||
+ @Override
|
||||
+ protected void initPathfinder() {
|
||||
+ if(!simplerVillagerBehavior)return;
|
||||
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||
+ if(YapfaConfig.villagersHideAtNight) {
|
||||
+ this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, PotionUtil.a(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEffects.ENTITY_WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> {
|
||||
+ return !this.world.isDay() && !entityvillagertrader.isInvisible();
|
||||
+ }));
|
||||
+ this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, new ItemStack(Items.MILK_BUCKET), SoundEffects.ENTITY_WANDERING_TRADER_REAPPEARED, (entityvillagertrader) -> {
|
||||
+ return this.world.isDay() && entityvillagertrader.isInvisible();
|
||||
+ }));
|
||||
+ }
|
||||
+ this.goalSelector.a(1, new PathfinderGoalTradeWithPlayer(this));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalAvoidTarget<>(this, EntityZombie.class, 8.0F, 0.5D, 0.5D));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalAvoidTarget<>(this, EntityEvoker.class, 12.0F, 0.5D, 0.5D));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalAvoidTarget<>(this, EntityVindicator.class, 8.0F, 0.5D, 0.5D));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalAvoidTarget<>(this, EntityVex.class, 8.0F, 0.5D, 0.5D));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalAvoidTarget<>(this, EntityPillager.class, 15.0F, 0.5D, 0.5D));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalAvoidTarget<>(this, EntityIllagerIllusioner.class, 12.0F, 0.5D, 0.5D));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.5D));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalLookAtTradingPlayer(this));
|
||||
+ this.goalSelector.a(2, new PathfinderGoalStrollVillage(this, 0.6D));
|
||||
+ this.goalSelector.a(3, new PathfinderGoalMoveThroughVillage(this, 0.6D, false, 4, () -> {
|
||||
+ return false;
|
||||
+ }));
|
||||
+ this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, 0.35D));
|
||||
+ this.goalSelector.a(8, new PathfinderGoalRandomStrollLand(this, 0.35D));
|
||||
+ this.goalSelector.a(9, new PathfinderGoalInteract(this, EntityHuman.class, 3.0F, 1.0F));
|
||||
+ this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
|
||||
+ }
|
||||
+ //YAPFA end
|
||||
+
|
||||
@Override
|
||||
public BehaviorController<EntityVillager> getBehaviorController() {
|
||||
return (BehaviorController<EntityVillager>) super.getBehaviorController(); // CraftBukkit - decompile error
|
||||
@@ -75,6 +118,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
|
||||
@Override
|
||||
protected BehaviorController<?> a(Dynamic<?> dynamic) {
|
||||
+ if(simplerVillagerBehavior)return super.a(dynamic); //YAPFA Don't use behaviorcontroller for simple Villagers
|
||||
BehaviorController<EntityVillager> behaviorcontroller = new BehaviorController<>(EntityVillager.bN, EntityVillager.bO, dynamic);
|
||||
|
||||
this.a(behaviorcontroller);
|
||||
@@ -153,12 +197,44 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
}
|
||||
// Spigot End
|
||||
|
||||
+ // YAPFA start
|
||||
+ private VillagerProfession getRandomProfession() {
|
||||
+ int type = random.nextInt(13);
|
||||
+ switch(type) {
|
||||
+ case 0: return VillagerProfession.ARMORER;
|
||||
+ case 1: return VillagerProfession.BUTCHER;
|
||||
+ case 2: return VillagerProfession.CARTOGRAPHER;
|
||||
+ case 3: return VillagerProfession.CLERIC;
|
||||
+ case 4: return VillagerProfession.FARMER;
|
||||
+ case 5: return VillagerProfession.FISHERMAN;
|
||||
+ case 6: return VillagerProfession.FLETCHER;
|
||||
+ case 7: return VillagerProfession.LEATHERWORKER;
|
||||
+ case 8: return VillagerProfession.LIBRARIAN;
|
||||
+ case 9: return VillagerProfession.MASON;
|
||||
+ case 10: return VillagerProfession.SHEPHERD;
|
||||
+ case 11: return VillagerProfession.TOOLSMITH;
|
||||
+ case 12: return VillagerProfession.WEAPONSMITH;
|
||||
+ default: return VillagerProfession.FARMER;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // YAPFA end
|
||||
+
|
||||
@Override // Paper start - tick trades while inactive
|
||||
protected void mobTick() { mobTick(false); }
|
||||
protected void mobTick(boolean inactive) {
|
||||
// Paper end
|
||||
+ // YAPFA start
|
||||
+ if(simplerVillagerBehavior && this.getVillagerData().getProfession() == VillagerProfession.NONE)
|
||||
+ this.setVillagerData(this.getVillagerData().withProfession(getRandomProfession()));
|
||||
+ if(simplerVillagerBehavior) {
|
||||
+ if (eF()) {
|
||||
+ eE();
|
||||
+ }
|
||||
+ }
|
||||
+ // YAPFA end
|
||||
this.world.getMethodProfiler().enter("brain");
|
||||
- if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper
|
||||
+ if(!simplerVillagerBehavior) if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper // YAPFA
|
||||
this.world.getMethodProfiler().exit();
|
||||
if (!this.et() && this.bB > 0) {
|
||||
--this.bB;
|
||||
@@ -556,6 +632,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
}
|
||||
|
||||
private void a(Entity entity) {
|
||||
+ if(simplerVillagerBehavior)return; // YAPFA
|
||||
if (this.world instanceof WorldServer) {
|
||||
Optional<List<EntityLiving>> optional = this.bo.getMemory(MemoryModuleType.VISIBLE_MOBS);
|
||||
|
||||
@@ -572,6 +649,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
}
|
||||
|
||||
public void a(MemoryModuleType<GlobalPos> memorymoduletype) {
|
||||
+ if(simplerVillagerBehavior)return; // YAPFA
|
||||
if (this.world instanceof WorldServer) {
|
||||
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
|
||||
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,77 +0,0 @@
|
||||
From fc57ac7c185f3eb5c2805f25344b868babeb5310 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Thu, 25 Jun 2020 23:40:12 +0200
|
||||
Subject: [PATCH] Heavily optimize furnance fuel and recipe lookups
|
||||
|
||||
---
|
||||
.../net/minecraft/server/CraftingManager.java | 7 ++++++
|
||||
.../minecraft/server/TileEntityFurnace.java | 22 +++++++++++++++++++
|
||||
2 files changed, 29 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
index 15e2439d6..e226e0069 100644
|
||||
--- a/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
@@ -87,6 +87,13 @@ public class CraftingManager extends ResourceDataJson {
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<T> craft(Recipes<T> recipes, C c0, World world) {
|
||||
// YAPFA start
|
||||
+ if(c0.getCurrentRecipe() != null) {
|
||||
+ Optional<T> optional = recipes.a(c0.getCurrentRecipe(), world, c0);
|
||||
+ if(optional.isPresent()) {
|
||||
+ c0.setCurrentRecipe(optional.get());
|
||||
+ return optional;
|
||||
+ }
|
||||
+ }
|
||||
for(IRecipe<C> rep : this.a(recipes).values()) {
|
||||
Optional<T> optional = recipes.a(rep, world, c0);
|
||||
if(optional.isPresent()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
index 7d50b7056..9299148a8 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
@@ -97,7 +97,13 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
this.c = recipes;
|
||||
}
|
||||
|
||||
+ //YAPFA
|
||||
+ private static Map<Item, Integer> cachedFuelMap = null;
|
||||
+
|
||||
public static Map<Item, Integer> f() {
|
||||
+ if(cachedFuelMap != null) {
|
||||
+ return cachedFuelMap; // YAPFA
|
||||
+ }
|
||||
Map<Item, Integer> map = Maps.newLinkedHashMap();
|
||||
|
||||
a(map, (IMaterial) Items.LAVA_BUCKET, 20000);
|
||||
@@ -160,6 +166,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
a(map, (IMaterial) Blocks.FLETCHING_TABLE, 300);
|
||||
a(map, (IMaterial) Blocks.SMITHING_TABLE, 300);
|
||||
a(map, (IMaterial) Blocks.COMPOSTER, 300);
|
||||
+ cachedFuelMap = map; // YAPFA
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -594,4 +601,19 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
}
|
||||
|
||||
}
|
||||
+
|
||||
+ // YAPFA start
|
||||
+ private IRecipe cachedRecipe = null;
|
||||
+ @Override
|
||||
+ public IRecipe getCurrentRecipe() {
|
||||
+ return cachedRecipe;
|
||||
+ }
|
||||
+ @Override
|
||||
+ public void setCurrentRecipe(IRecipe recipe) {
|
||||
+ cachedRecipe = recipe;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ // YAPFA end
|
||||
+
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,329 +0,0 @@
|
||||
From 5f2f5a3294c8d2e71c9459f0f88c272c477b6848 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Fri, 26 Jun 2020 01:11:47 +0200
|
||||
Subject: [PATCH] Optimize Hopper logic
|
||||
|
||||
---
|
||||
.../net/minecraft/server/BlockHopper.java | 229 ++++++++++++++++++
|
||||
.../minecraft/server/TileEntityHopper.java | 36 ++-
|
||||
2 files changed, 261 insertions(+), 4 deletions(-)
|
||||
create mode 100644 src/main/java/net/minecraft/server/BlockHopper.java
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java
|
||||
new file mode 100644
|
||||
index 000000000..63e024e9d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/BlockHopper.java
|
||||
@@ -0,0 +1,229 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import java.util.OptionalInt;
|
||||
+import net.minecraft.server.Block;
|
||||
+import net.minecraft.server.BlockActionContext;
|
||||
+import net.minecraft.server.BlockPosition;
|
||||
+import net.minecraft.server.BlockProperties;
|
||||
+import net.minecraft.server.BlockStateBoolean;
|
||||
+import net.minecraft.server.BlockStateDirection;
|
||||
+import net.minecraft.server.BlockStateList;
|
||||
+import net.minecraft.server.BlockTileEntity;
|
||||
+import net.minecraft.server.Container;
|
||||
+import net.minecraft.server.Entity;
|
||||
+import net.minecraft.server.EntityHuman;
|
||||
+import net.minecraft.server.EntityLiving;
|
||||
+import net.minecraft.server.EnumBlockMirror;
|
||||
+import net.minecraft.server.EnumBlockRotation;
|
||||
+import net.minecraft.server.EnumDirection;
|
||||
+import net.minecraft.server.EnumHand;
|
||||
+import net.minecraft.server.EnumInteractionResult;
|
||||
+import net.minecraft.server.EnumRenderType;
|
||||
+import net.minecraft.server.IBlockAccess;
|
||||
+import net.minecraft.server.IBlockData;
|
||||
+import net.minecraft.server.IBlockDataHolder;
|
||||
+import net.minecraft.server.IBlockState;
|
||||
+import net.minecraft.server.IChatBaseComponent;
|
||||
+import net.minecraft.server.IHopper;
|
||||
+import net.minecraft.server.IInventory;
|
||||
+import net.minecraft.server.ITileInventory;
|
||||
+import net.minecraft.server.InventoryUtils;
|
||||
+import net.minecraft.server.ItemStack;
|
||||
+import net.minecraft.server.MinecraftKey;
|
||||
+import net.minecraft.server.MovingObjectPositionBlock;
|
||||
+import net.minecraft.server.OperatorBoolean;
|
||||
+import net.minecraft.server.PathMode;
|
||||
+import net.minecraft.server.StatisticList;
|
||||
+import net.minecraft.server.TileEntity;
|
||||
+import net.minecraft.server.TileEntityHopper;
|
||||
+import net.minecraft.server.VoxelShape;
|
||||
+import net.minecraft.server.VoxelShapeCollision;
|
||||
+import net.minecraft.server.VoxelShapes;
|
||||
+import net.minecraft.server.World;
|
||||
+
|
||||
+public class BlockHopper extends BlockTileEntity {
|
||||
+ public static final BlockStateDirection FACING = BlockProperties.M;
|
||||
+ public static final BlockStateBoolean ENABLED = BlockProperties.f;
|
||||
+ private static final VoxelShape c = Block.a((double) 0.0, (double) 10.0, (double) 0.0, (double) 16.0, (double) 16.0,
|
||||
+ (double) 16.0);
|
||||
+ private static final VoxelShape d = Block.a((double) 4.0, (double) 4.0, (double) 4.0, (double) 12.0, (double) 10.0,
|
||||
+ (double) 12.0);
|
||||
+ private static final VoxelShape e = VoxelShapes.a((VoxelShape) d, (VoxelShape) c);
|
||||
+ private static final VoxelShape f = VoxelShapes.a((VoxelShape) e, (VoxelShape) IHopper.a,
|
||||
+ (OperatorBoolean) OperatorBoolean.ONLY_FIRST);
|
||||
+ private static final VoxelShape g = VoxelShapes.a((VoxelShape) f,
|
||||
+ (VoxelShape) Block.a((double) 6.0, (double) 0.0, (double) 6.0, (double) 10.0, (double) 4.0, (double) 10.0));
|
||||
+ private static final VoxelShape h = VoxelShapes.a((VoxelShape) f, (VoxelShape) Block.a((double) 12.0, (double) 4.0,
|
||||
+ (double) 6.0, (double) 16.0, (double) 8.0, (double) 10.0));
|
||||
+ private static final VoxelShape i = VoxelShapes.a((VoxelShape) f,
|
||||
+ (VoxelShape) Block.a((double) 6.0, (double) 4.0, (double) 0.0, (double) 10.0, (double) 8.0, (double) 4.0));
|
||||
+ private static final VoxelShape j = VoxelShapes.a((VoxelShape) f, (VoxelShape) Block.a((double) 6.0, (double) 4.0,
|
||||
+ (double) 12.0, (double) 10.0, (double) 8.0, (double) 16.0));
|
||||
+ private static final VoxelShape k = VoxelShapes.a((VoxelShape) f,
|
||||
+ (VoxelShape) Block.a((double) 0.0, (double) 4.0, (double) 6.0, (double) 4.0, (double) 8.0, (double) 10.0));
|
||||
+ private static final VoxelShape w = IHopper.a;
|
||||
+ private static final VoxelShape x = VoxelShapes.a((VoxelShape) IHopper.a, (VoxelShape) Block.a((double) 12.0,
|
||||
+ (double) 8.0, (double) 6.0, (double) 16.0, (double) 10.0, (double) 10.0));
|
||||
+ private static final VoxelShape y = VoxelShapes.a((VoxelShape) IHopper.a,
|
||||
+ (VoxelShape) Block.a((double) 6.0, (double) 8.0, (double) 0.0, (double) 10.0, (double) 10.0, (double) 4.0));
|
||||
+ private static final VoxelShape z = VoxelShapes.a((VoxelShape) IHopper.a, (VoxelShape) Block.a((double) 6.0,
|
||||
+ (double) 8.0, (double) 12.0, (double) 10.0, (double) 10.0, (double) 16.0));
|
||||
+ private static final VoxelShape A = VoxelShapes.a((VoxelShape) IHopper.a,
|
||||
+ (VoxelShape) Block.a((double) 0.0, (double) 8.0, (double) 6.0, (double) 4.0, (double) 10.0, (double) 10.0));
|
||||
+
|
||||
+ public BlockHopper(Block.Info var0) {
|
||||
+ super(var0);
|
||||
+ this.p((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set((IBlockState) FACING,
|
||||
+ (Comparable) EnumDirection.DOWN)).set((IBlockState) ENABLED, (Comparable) Boolean.valueOf(true)));
|
||||
+ }
|
||||
+
|
||||
+ public VoxelShape a(IBlockData var0, IBlockAccess var1, BlockPosition var2, VoxelShapeCollision var3) {
|
||||
+ switch ((EnumDirection) var0.get((IBlockState) FACING)) {
|
||||
+ case DOWN : {
|
||||
+ return g;
|
||||
+ }
|
||||
+ case NORTH : {
|
||||
+ return i;
|
||||
+ }
|
||||
+ case SOUTH : {
|
||||
+ return j;
|
||||
+ }
|
||||
+ case WEST : {
|
||||
+ return k;
|
||||
+ }
|
||||
+ case EAST : {
|
||||
+ return h;
|
||||
+ }
|
||||
+ }
|
||||
+ return f;
|
||||
+ }
|
||||
+
|
||||
+ public VoxelShape j(IBlockData var0, IBlockAccess var1, BlockPosition var2) {
|
||||
+ switch ((EnumDirection) var0.get((IBlockState) FACING)) {
|
||||
+ case DOWN : {
|
||||
+ return w;
|
||||
+ }
|
||||
+ case NORTH : {
|
||||
+ return y;
|
||||
+ }
|
||||
+ case SOUTH : {
|
||||
+ return z;
|
||||
+ }
|
||||
+ case WEST : {
|
||||
+ return A;
|
||||
+ }
|
||||
+ case EAST : {
|
||||
+ return x;
|
||||
+ }
|
||||
+ }
|
||||
+ return IHopper.a;
|
||||
+ }
|
||||
+
|
||||
+ public IBlockData getPlacedState(BlockActionContext var0) {
|
||||
+ EnumDirection var1;
|
||||
+ return (IBlockData) ((IBlockData) this.getBlockData().set((IBlockState) FACING,
|
||||
+ (Comparable) ((var1 = var0.getClickedFace().opposite()).m() == EnumDirection.EnumAxis.Y
|
||||
+ ? EnumDirection.DOWN
|
||||
+ : var1))).set((IBlockState) ENABLED, (Comparable) Boolean.valueOf(true));
|
||||
+ }
|
||||
+
|
||||
+ public TileEntity createTile(IBlockAccess var0) {
|
||||
+ return new TileEntityHopper();
|
||||
+ }
|
||||
+
|
||||
+ public void postPlace(World var0, BlockPosition var1, IBlockData var2, EntityLiving var3, ItemStack var4) {
|
||||
+ TileEntity var5;
|
||||
+ if (var4.hasName() && (var5 = var0.getTileEntity(var1)) instanceof TileEntityHopper) {
|
||||
+ ((TileEntityHopper) var5).setCustomName(var4.getName());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void onPlace(IBlockData var0, World var1, BlockPosition var2, IBlockData var3, boolean var4) {
|
||||
+ if (var3.getBlock() == var0.getBlock()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.a(var1, var2, var0);
|
||||
+ }
|
||||
+
|
||||
+ public EnumInteractionResult interact(IBlockData var0, World var1, BlockPosition var2, EntityHuman var3,
|
||||
+ EnumHand var4, MovingObjectPositionBlock var5) {
|
||||
+ if (var1.isClientSide) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ TileEntity var6 = var1.getTileEntity(var2);
|
||||
+ if (var6 instanceof TileEntityHopper) {
|
||||
+ var3.openContainer((ITileInventory) ((TileEntityHopper) var6));
|
||||
+ var3.a(StatisticList.INSPECT_HOPPER);
|
||||
+ }
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ public void doPhysics(IBlockData var0, World var1, BlockPosition var2, Block var3, BlockPosition var4,
|
||||
+ boolean var5) {
|
||||
+ this.a(var1, var2, var0);
|
||||
+ //YAPFA start
|
||||
+ TileEntity tileEntity = var1.getTileEntity(var2);
|
||||
+ if (tileEntity instanceof TileEntityHopper) {
|
||||
+ ((TileEntityHopper)tileEntity).flushCaches();
|
||||
+ }
|
||||
+ // YAPFA end
|
||||
+ }
|
||||
+
|
||||
+ private void a(World var0, BlockPosition var1, IBlockData var2) {
|
||||
+ boolean var3;
|
||||
+ boolean bl = var3 = !var0.isBlockIndirectlyPowered(var1);
|
||||
+ if (var3 != (Boolean) var2.get((IBlockState) ENABLED)) {
|
||||
+ var0.setTypeAndData(var1, (IBlockData) var2.set((IBlockState) ENABLED, (Comparable) Boolean.valueOf(var3)),
|
||||
+ 4);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void remove(IBlockData var0, World var1, BlockPosition var2, IBlockData var3, boolean var4) {
|
||||
+ if (var0.getBlock() == var3.getBlock()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ TileEntity var5 = var1.getTileEntity(var2);
|
||||
+ if (var5 instanceof TileEntityHopper) {
|
||||
+ InventoryUtils.dropInventory((World) var1, (BlockPosition) var2, (IInventory) ((TileEntityHopper) var5));
|
||||
+ var1.updateAdjacentComparators(var2, (Block) this);
|
||||
+ }
|
||||
+ super.remove(var0, var1, var2, var3, var4);
|
||||
+ }
|
||||
+
|
||||
+ public EnumRenderType c(IBlockData var0) {
|
||||
+ return EnumRenderType.MODEL;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isComplexRedstone(IBlockData var0) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ public int a(IBlockData var0, World var1, BlockPosition var2) {
|
||||
+ return Container.a((TileEntity) var1.getTileEntity(var2));
|
||||
+ }
|
||||
+
|
||||
+ public IBlockData a(IBlockData var0, EnumBlockRotation var1) {
|
||||
+ return (IBlockData) var0.set((IBlockState) FACING,
|
||||
+ (Comparable) var1.a((EnumDirection) var0.get((IBlockState) FACING)));
|
||||
+ }
|
||||
+
|
||||
+ public IBlockData a(IBlockData var0, EnumBlockMirror var1) {
|
||||
+ return var0.a(var1.a((EnumDirection) var0.get((IBlockState) FACING)));
|
||||
+ }
|
||||
+
|
||||
+ protected void a(BlockStateList.a<Block, IBlockData> var0) {
|
||||
+ var0.a(new IBlockState[]{FACING, ENABLED});
|
||||
+ }
|
||||
+
|
||||
+ public void a(IBlockData var0, World var1, BlockPosition var2, Entity var3) {
|
||||
+ TileEntity var4 = var1.getTileEntity(var2);
|
||||
+ if (var4 instanceof TileEntityHopper) {
|
||||
+ ((TileEntityHopper) var4).a(var3);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public boolean a(IBlockData var0, IBlockAccess var1, BlockPosition var2, PathMode var3) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
index c755faed4..0e5ee991b 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
+import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
@@ -611,14 +612,28 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
|
||||
@Nullable
|
||||
private IInventory k() {
|
||||
+ if(this.cachedPush != null)return this.cachedPush;
|
||||
EnumDirection enumdirection = (EnumDirection) this.getBlock().get(BlockHopper.FACING);
|
||||
|
||||
- return b(this.getWorld(), this.position.shift(enumdirection));
|
||||
+ this.cachedPush = b(this.getWorld(), this.position.shift(enumdirection));
|
||||
+ return this.cachedPush;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IInventory b(IHopper ihopper) {
|
||||
- return a(ihopper.getWorld(), ihopper.z(), ihopper.A() + 1.0D, ihopper.B());
|
||||
+ //YAPFA start
|
||||
+ if(ihopper instanceof TileEntityHopper) {
|
||||
+ TileEntityHopper hopper = (TileEntityHopper) ihopper;
|
||||
+ if(hopper.cachedAbove != null) {
|
||||
+ return hopper.cachedAbove;
|
||||
+ }
|
||||
+ IInventory inv = a(ihopper.getWorld(), ihopper.z(), ihopper.A() + 1.0D, ihopper.B());
|
||||
+ hopper.cachedAbove = inv;
|
||||
+ return inv;
|
||||
+ }else {
|
||||
+ return a(ihopper.getWorld(), ihopper.z(), ihopper.A() + 1.0D, ihopper.B());
|
||||
+ }
|
||||
+ //YAPFA end
|
||||
}
|
||||
|
||||
public static List<EntityItem> c(IHopper ihopper) {
|
||||
@@ -658,7 +673,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
if (object == null && (!optimizeEntities || !org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding())) { // Paper
|
||||
List<Entity> list = world.getEntities((Entity) null, new AxisAlignedBB(d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D), IEntitySelector.d);
|
||||
|
||||
@@ -666,7 +681,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
object = (IInventory) list.get(world.random.nextInt(list.size()));
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
return (IInventory) object;
|
||||
}
|
||||
|
||||
@@ -728,4 +743,17 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
||||
protected Container createContainer(int i, PlayerInventory playerinventory) {
|
||||
return new ContainerHopper(i, playerinventory, this);
|
||||
}
|
||||
+
|
||||
+ // YAPFA start
|
||||
+
|
||||
+ private IInventory cachedAbove = null;
|
||||
+ private IInventory cachedPush = null;
|
||||
+
|
||||
+ public void flushCaches() {
|
||||
+ cachedAbove = null;
|
||||
+ cachedPush = null;
|
||||
+ }
|
||||
+
|
||||
+ // YAPFA end
|
||||
+
|
||||
}
|
||||
--
|
||||
2.25.1.windows.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 30d59c2a98c12d62b63dcbd48db70bab1a06fb65 Mon Sep 17 00:00:00 2001
|
||||
From cc5313e0e8db5f4110b990ed6aa41f4373951d30 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Wed, 26 Feb 2020 18:37:34 +0100
|
||||
Subject: [PATCH] Brandings
|
||||
@ -53,10 +53,10 @@ index 000000000..b7a73408e
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 3c9392077..f0959d301 100644
|
||||
index 0ccfc0729..e1373f2c0 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1630,7 +1630,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@@ -1504,7 +1504,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
@ -66,10 +66,10 @@ index 3c9392077..f0959d301 100644
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 760752eae..6181f5886 100644
|
||||
index de7364e97..63c4cb1d1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -205,7 +205,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -229,7 +229,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
@ -79,10 +79,10 @@ index 760752eae..6181f5886 100644
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 004b6ce13..d68251d70 100644
|
||||
index 257f46003..ea997a853 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -312,7 +312,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -317,7 +317,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
@Override
|
||||
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
@ -1,4 +1,4 @@
|
||||
From dcb243542a2a24563d515100a9b9c393c66d0ae2 Mon Sep 17 00:00:00 2001
|
||||
From e304e94d21624772129ea90152199518dba2eb0e Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Wed, 26 Feb 2020 21:39:58 +0100
|
||||
Subject: [PATCH] Don't save Fireworks and Arrows
|
||||
@ -8,13 +8,13 @@ Subject: [PATCH] Don't save Fireworks and Arrows
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 37f854764..6d62a1af5 100644
|
||||
index 2b9c0105f..b28b668bd 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1763,7 +1763,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -1719,7 +1719,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
}
|
||||
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
- String s = this.getSaveID();
|
||||
+ if(this instanceof EntityFireworks || this instanceof EntityArrow)return false; // YAPFA
|
||||
+ String s = this.getSaveID();
|
@ -1,15 +1,15 @@
|
||||
From 0317ae3d5823e21bb23b654753463efae5deb2a0 Mon Sep 17 00:00:00 2001
|
||||
From 4f0a395b13722946811e1453770f69bf6d70641e Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Wed, 26 Feb 2020 22:22:02 +0100
|
||||
Subject: [PATCH] Add GameProfileLookupEvent
|
||||
|
||||
---
|
||||
.../paper/profile/CraftPlayerProfile.java | 22 ++++++++++++++-----
|
||||
.../net/minecraft/server/TileEntitySkull.java | 15 ++++++++++++-
|
||||
2 files changed, 31 insertions(+), 6 deletions(-)
|
||||
.../paper/profile/CraftPlayerProfile.java | 26 ++++++++++++++-----
|
||||
.../net/minecraft/server/TileEntitySkull.java | 15 ++++++++++-
|
||||
2 files changed, 33 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
index 00b7630cc..74ffeab50 100644
|
||||
index d73de9eb8..8b9c017bd 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
@@ -5,9 +5,13 @@ import com.google.common.base.Charsets;
|
||||
@ -26,15 +26,17 @@ index 00b7630cc..74ffeab50 100644
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.spigotmc.SpigotConfig;
|
||||
|
||||
@@ -183,11 +187,19 @@ public class CraftPlayerProfile implements PlayerProfile {
|
||||
@@ -183,13 +187,21 @@ public class CraftPlayerProfile implements PlayerProfile {
|
||||
|
||||
boolean isCompleteFromCache = this.completeFromCache(false, onlineMode);
|
||||
boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
|
||||
if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
|
||||
- GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
|
||||
- if (result != null) {
|
||||
- copyProfileProperties(result, this.profile, true);
|
||||
- }
|
||||
- server.getUserCache().saveProfile(this.profile);
|
||||
- if (this.profile.isComplete()) {
|
||||
- server.getUserCache().saveProfile(this.profile);
|
||||
- }
|
||||
+ // YAPFA start
|
||||
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
@ -45,14 +47,16 @@ index 00b7630cc..74ffeab50 100644
|
||||
+ if (result != null) {
|
||||
+ copyProfileProperties(result, this.profile, true);
|
||||
+ }
|
||||
+ server.getUserCache().saveProfile(this.profile);
|
||||
+ if (this.profile.isComplete()) {
|
||||
+ server.getUserCache().saveProfile(this.profile);
|
||||
+ }
|
||||
+ }
|
||||
+ // YAPFA end
|
||||
}
|
||||
return profile.isComplete() && (!onlineMode || !textures || hasTextures());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
|
||||
index 93030a7b2..8bd78ef91 100644
|
||||
index fb7aa15c2..7d7ab2fc0 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
|
||||
@@ -4,9 +4,14 @@ import com.google.common.collect.Iterables;
|
||||
@ -70,7 +74,7 @@ index 93030a7b2..8bd78ef91 100644
|
||||
// Spigot start
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
@@ -74,7 +79,15 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
|
||||
@@ -77,7 +82,15 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
|
||||
|
||||
if ( property == null )
|
||||
{
|
@ -1,54 +1,50 @@
|
||||
From 62ec7712ed6ecad895b32d7968ff4200110af0ec Mon Sep 17 00:00:00 2001
|
||||
From 24155adba5a1a7cadfcf0a61c3e0d8f77cd8509b Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Thu, 5 Mar 2020 21:13:33 +0100
|
||||
Subject: [PATCH] Add getLastTickMs() api
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/MinecraftServer.java | 7 +++++++
|
||||
src/main/java/net/minecraft/server/MinecraftServer.java | 5 +++++
|
||||
src/main/java/org/bukkit/craftbukkit/CraftServer.java | 9 +++++++++
|
||||
src/main/java/org/spigotmc/TicksPerSecondCommand.java | 2 +-
|
||||
3 files changed, 17 insertions(+), 1 deletion(-)
|
||||
3 files changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 16535da3e..f41584b85 100644
|
||||
index e1373f2c0..9bb5e0c98 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -901,6 +901,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@@ -933,6 +933,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
|
||||
// Paper End
|
||||
// Spigot End
|
||||
+
|
||||
+ public static long lastTickMs = 0; // YAPFA
|
||||
|
||||
public void run() {
|
||||
protected void v() {
|
||||
try {
|
||||
@@ -965,9 +967,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.methodProfiler.d().d();
|
||||
}
|
||||
|
||||
+
|
||||
+
|
||||
@@ -997,7 +999,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.a(gameprofilertick);
|
||||
this.methodProfiler.a();
|
||||
this.methodProfiler.enter("tick");
|
||||
+ long tickStart = System.currentTimeMillis(); // YAPFA
|
||||
this.a(this::canSleepForTick);
|
||||
+ lastTickMs = System.currentTimeMillis() - tickStart; // YAPFA
|
||||
this.methodProfiler.exitEnter("nextTickWait");
|
||||
this.ac = true;
|
||||
this.ab = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
|
||||
@@ -975,6 +981,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.methodProfiler.exit();
|
||||
this.X = true;
|
||||
this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
|
||||
@@ -1006,6 +1010,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.methodProfiler.b();
|
||||
this.b(gameprofilertick);
|
||||
this.hasTicked = true;
|
||||
+
|
||||
}
|
||||
} else {
|
||||
this.a((CrashReport) null);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 206165c13..0998fcaaa 100644
|
||||
index 63c4cb1d1..3ee0a6e34 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2285,4 +2285,13 @@ public final class CraftServer implements Server {
|
||||
@@ -2354,4 +2354,13 @@ public final class CraftServer implements Server {
|
||||
return mobGoals;
|
||||
}
|
||||
// Paper end
|
Loading…
Reference in New Issue
Block a user