From 62a02a4422b3d221013516e35eda4e7e8e53f81d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 16:24:20 +1000 Subject: [PATCH] Hopper cooldowns - patch #50! --- Bukkit-Patches/0009-Add-Particle-API.patch | 4 +- CraftBukkit-Patches/0049-Particle-API.patch | 4 +- .../0050-Hopper-Cooldowns.patch | 103 ++++++++++++++++++ 3 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 CraftBukkit-Patches/0050-Hopper-Cooldowns.patch diff --git a/Bukkit-Patches/0009-Add-Particle-API.patch b/Bukkit-Patches/0009-Add-Particle-API.patch index 282426e64..975ecd24c 100644 --- a/Bukkit-Patches/0009-Add-Particle-API.patch +++ b/Bukkit-Patches/0009-Add-Particle-API.patch @@ -1,5 +1,5 @@ -From abf412d8d3b2888bd6c51df8504fe1df606da9c5 Mon Sep 17 00:00:00 2001 -From: thinkofdeath +From 6194a2aeb7c71a6d6b2cceeac5e7a1a2ea0fa60c Mon Sep 17 00:00:00 2001 +From: md_5 Date: Sun, 2 Jun 2013 15:57:09 +1000 Subject: [PATCH] Add Particle API diff --git a/CraftBukkit-Patches/0049-Particle-API.patch b/CraftBukkit-Patches/0049-Particle-API.patch index ecda546ce..c0d1c42a0 100644 --- a/CraftBukkit-Patches/0049-Particle-API.patch +++ b/CraftBukkit-Patches/0049-Particle-API.patch @@ -1,5 +1,5 @@ -From 168d2da67ba73638c687d0b8e00b741e82aaccf3 Mon Sep 17 00:00:00 2001 -From: thinkofdeath +From 03cf9c87436da5821b635aedc23144a5c711a2aa Mon Sep 17 00:00:00 2001 +From: md_5 Date: Sun, 2 Jun 2013 16:14:30 +1000 Subject: [PATCH] Particle API diff --git a/CraftBukkit-Patches/0050-Hopper-Cooldowns.patch b/CraftBukkit-Patches/0050-Hopper-Cooldowns.patch new file mode 100644 index 000000000..72f738d43 --- /dev/null +++ b/CraftBukkit-Patches/0050-Hopper-Cooldowns.patch @@ -0,0 +1,103 @@ +From 22995b47cda3e4de4d73e4f43f57d26db104b199 Mon Sep 17 00:00:00 2001 +From: DerFlash +Date: Sun, 2 Jun 2013 16:23:46 +1000 +Subject: [PATCH] Hopper Cooldowns + + +diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java +index f6d269d..88b2cb0 100644 +--- a/src/main/java/net/minecraft/server/TileEntityHopper.java ++++ b/src/main/java/net/minecraft/server/TileEntityHopper.java +@@ -181,16 +181,19 @@ public class TileEntityHopper extends TileEntity implements IHopper { + boolean flag = this.u() | suckInItems(this); + + if (flag) { +- this.c(8); ++ this.c(org.bukkit.craftbukkit.Spigot.hopperTransferCooldown); // Spigot + this.update(); + return true; + } + } +- +- return false; +- } else { +- return false; + } ++ // Spigot start ++ if ( this.c == 0 ) ++ { ++ this.c( org.bukkit.craftbukkit.Spigot.hopperCheckCooldown ); ++ } ++ // Spigot end ++ return false; + } + + private boolean u() { +@@ -217,7 +220,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { + this.getWorld().getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + this.setItem(i, itemstack); +- this.c(8); // Delay hopper checks ++ this.c(org.bukkit.craftbukkit.Spigot.hopperTransferCooldown); // Spigot + return false; + } + ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.OPPOSITE_FACING[BlockHopper.c(this.p())]); +@@ -298,9 +301,9 @@ public class TileEntityHopper extends TileEntity implements IHopper { + iinventory.setItem(i, itemstack1); + + if (ihopper instanceof TileEntityHopper) { +- ((TileEntityHopper) ihopper).c(8); // Delay hopper checks ++ ((TileEntityHopper) ihopper).c(org.bukkit.craftbukkit.Spigot.hopperTransferCooldown); // Spigot + } else if (ihopper instanceof EntityMinecartHopper) { +- ((EntityMinecartHopper) ihopper).n(4); // Delay hopper minecart checks ++ ((EntityMinecartHopper) ihopper).n(org.bukkit.craftbukkit.Spigot.hopperTransferCooldown / 2); // Spigot + } + + return false; +@@ -404,7 +407,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { + + if (flag) { + if (iinventory instanceof TileEntityHopper) { +- ((TileEntityHopper) iinventory).c(8); ++ ((TileEntityHopper) iinventory).c(org.bukkit.craftbukkit.Spigot.hopperTransferCooldown); // Spigot + } + + iinventory.update(); +diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java +index 8772350..9b9e9fe 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java ++++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +@@ -58,6 +58,8 @@ public class Spigot { + public static List bungeeIPs; + public static int textureResolution = 16; + public static final Pattern validName = Pattern.compile("^[a-zA-Z0-9_-]{2,16}$"); ++ public static int hopperTransferCooldown = 8; ++ public static int hopperCheckCooldown = 8; + + public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) { + commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); +@@ -96,6 +98,8 @@ public class Spigot { + tabPing = configuration.getBoolean("settings.tab-ping", tabPing); + bungeeIPs = configuration.getStringList("settings.bungee-proxies"); + textureResolution = configuration.getInt("settings.texture-resolution", textureResolution); ++ hopperTransferCooldown = configuration.getInt("ticks-per.hopper-transfer", hopperTransferCooldown); ++ hopperCheckCooldown = configuration.getInt("ticks-per.hopper-check", hopperCheckCooldown); + + if (metrics == null) { + try { +diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml +index 8f48c0f..830f3e6 100644 +--- a/src/main/resources/configurations/bukkit.yml ++++ b/src/main/resources/configurations/bukkit.yml +@@ -84,6 +84,8 @@ ticks-per: + animal-spawns: 400 + monster-spawns: 1 + autosave: 0 ++ hopper-transfer: 8 ++ hopper-check: 8 + auto-updater: + enabled: true + on-broken: [warn-console, warn-ops] +-- +1.8.1.2 +