Hopper cooldowns - patch #50!

This commit is contained in:
md_5 2013-06-02 16:24:20 +10:00
parent bb85281118
commit 62a02a4422
3 changed files with 107 additions and 4 deletions

View file

@ -1,5 +1,5 @@
From abf412d8d3b2888bd6c51df8504fe1df606da9c5 Mon Sep 17 00:00:00 2001 From 6194a2aeb7c71a6d6b2cceeac5e7a1a2ea0fa60c Mon Sep 17 00:00:00 2001
From: thinkofdeath <purggames@gmail.com> From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 15:57:09 +1000 Date: Sun, 2 Jun 2013 15:57:09 +1000
Subject: [PATCH] Add Particle API Subject: [PATCH] Add Particle API

View file

@ -1,5 +1,5 @@
From 168d2da67ba73638c687d0b8e00b741e82aaccf3 Mon Sep 17 00:00:00 2001 From 03cf9c87436da5821b635aedc23144a5c711a2aa Mon Sep 17 00:00:00 2001
From: thinkofdeath <purggames@gmail.com> From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 16:14:30 +1000 Date: Sun, 2 Jun 2013 16:14:30 +1000
Subject: [PATCH] Particle API Subject: [PATCH] Particle API

View file

@ -0,0 +1,103 @@
From 22995b47cda3e4de4d73e4f43f57d26db104b199 Mon Sep 17 00:00:00 2001
From: DerFlash <bte@freenet.de>
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<String> 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