1
0
Fork 0

Allow to specifly full checks rate

kcx-1614
Prototik 2015-05-17 10:16:04 +07:00
parent 4496eada0a
commit fb09fe93c4
4 changed files with 37 additions and 13 deletions

View File

@ -47,7 +47,7 @@ archivesBaseName = 'kcauldron'
ext.mcVersion = "1.7.10" ext.mcVersion = "1.7.10"
ext.cauldronVersion = "4" ext.cauldronVersion = "4"
ext.forgeVersion = "1403" ext.forgeVersion = "1403"
ext.revision = "63" ext.revision = "64"
version = "${mcVersion}-${cauldronVersion}.${forgeVersion}.${revision}" version = "${mcVersion}-${cauldronVersion}.${forgeVersion}.${revision}"
launch4j { launch4j {

View File

@ -1,24 +1,41 @@
--- ../src-base/minecraft/net/minecraft/inventory/Container.java --- ../src-base/minecraft/net/minecraft/inventory/Container.java
+++ ../src-work/minecraft/net/minecraft/inventory/Container.java +++ ../src-work/minecraft/net/minecraft/inventory/Container.java
@@ -13,6 +13,17 @@ @@ -2,17 +2,34 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
+
+// CraftBukkit start +// CraftBukkit start
+import java.util.HashMap; +import java.util.HashMap;
+import java.util.Map; +import java.util.Map;
+
+import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.EntityPlayerMP;
+
+import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.Event.Result; +import org.bukkit.event.Event.Result;
+import org.bukkit.event.inventory.InventoryDragEvent; +import org.bukkit.event.inventory.InventoryDragEvent;
+import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.InventoryView;
+// CraftBukkit end +// CraftBukkit end
+import org.spigotmc.SpigotConfig;
+ +
public abstract class Container public abstract class Container
{ {
public List inventoryItemStacks = new ArrayList(); public List inventoryItemStacks = new ArrayList();
@@ -21,12 +32,52 @@ @@ -21,12 +38,53 @@
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private short transactionID; private short transactionID;
private int field_94535_f = -1; private int field_94535_f = -1;
@ -27,6 +44,7 @@
private final Set field_94537_h = new HashSet(); private final Set field_94537_h = new HashSet();
+ public InventoryView bukkitView = null; // Cauldron + public InventoryView bukkitView = null; // Cauldron
+ private int tickCount = 0; // Spigot + private int tickCount = 0; // Spigot
+ private final int fullMatchRate = SpigotConfig.fullMatchRate; // Spigot
protected List crafters = new ArrayList(); protected List crafters = new ArrayList();
private Set playerList = new HashSet(); private Set playerList = new HashSet();
private static final String __OBFID = "CL_00001730"; private static final String __OBFID = "CL_00001730";
@ -72,7 +90,7 @@
protected Slot addSlotToContainer(Slot p_75146_1_) protected Slot addSlotToContainer(Slot p_75146_1_)
{ {
p_75146_1_.slotNumber = this.inventorySlots.size(); p_75146_1_.slotNumber = this.inventorySlots.size();
@@ -39,7 +90,11 @@ @@ -39,7 +97,11 @@
{ {
if (this.crafters.contains(p_75132_1_)) if (this.crafters.contains(p_75132_1_))
{ {
@ -85,7 +103,7 @@
} }
else else
{ {
@@ -74,7 +129,7 @@ @@ -74,7 +136,7 @@
ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack();
ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i);
@ -94,7 +112,7 @@
{ {
itemstack1 = itemstack == null ? null : itemstack.copy(); itemstack1 = itemstack == null ? null : itemstack.copy();
this.inventoryItemStacks.set(i, itemstack1); this.inventoryItemStacks.set(i, itemstack1);
@@ -85,6 +140,7 @@ @@ -85,6 +147,7 @@
} }
} }
} }
@ -102,7 +120,7 @@
} }
public boolean enchantItem(EntityPlayer p_75140_1_, int p_75140_2_) public boolean enchantItem(EntityPlayer p_75140_1_, int p_75140_2_)
@@ -109,6 +165,10 @@ @@ -109,6 +172,10 @@
public Slot getSlot(int p_75139_1_) public Slot getSlot(int p_75139_1_)
{ {
@ -113,7 +131,7 @@
return (Slot)this.inventorySlots.get(p_75139_1_); return (Slot)this.inventorySlots.get(p_75139_1_);
} }
@@ -168,6 +228,7 @@ @@ -168,6 +235,7 @@
itemstack3 = inventoryplayer.getItemStack().copy(); itemstack3 = inventoryplayer.getItemStack().copy();
i1 = inventoryplayer.getItemStack().stackSize; i1 = inventoryplayer.getItemStack().stackSize;
Iterator iterator = this.field_94537_h.iterator(); Iterator iterator = this.field_94537_h.iterator();
@ -121,7 +139,7 @@
while (iterator.hasNext()) while (iterator.hasNext())
{ {
@@ -190,18 +251,55 @@ @@ -190,18 +258,55 @@
} }
i1 -= itemstack1.stackSize - j1; i1 -= itemstack1.stackSize - j1;
@ -182,7 +200,7 @@
} }
this.func_94533_d(); this.func_94533_d();
@@ -235,10 +333,17 @@ @@ -235,10 +340,17 @@
if (p_75144_2_ == 1) if (p_75144_2_ == 1)
{ {
@ -201,14 +219,14 @@
inventoryplayer.setItemStack((ItemStack)null); inventoryplayer.setItemStack((ItemStack)null);
} }
} }
@@ -730,4 +835,10 @@ @@ -730,4 +842,10 @@
return MathHelper.floor_float(f * 14.0F) + (i > 0 ? 1 : 0); return MathHelper.floor_float(f * 14.0F) + (i > 0 ? 1 : 0);
} }
} }
+ +
+ // Spigot start + // Spigot start
+ public boolean areItemStacksEqual(ItemStack is1, ItemStack is2) { + public boolean areItemStacksEqual(ItemStack is1, ItemStack is2) {
+ return tickCount % 20 == 0 ? ItemStack.areItemStacksEqual(is1, is2) : ItemStack.fastMatches(is1, is2); + return tickCount % fullMatchRate == 0 ? ItemStack.areItemStacksEqual(is1, is2) : ItemStack.fastMatches(is1, is2);
+ } + }
+ // Spigot + // Spigot
} }

View File

@ -11,7 +11,7 @@
+ // CraftBukkit end + // CraftBukkit end
+ this.mapStorage = p_i45283_6_.mapStorage; + this.mapStorage = p_i45283_6_.mapStorage;
+ this.worldScoreboard = p_i45283_6_.getScoreboard(); + this.worldScoreboard = p_i45283_6_.getScoreboard();
+ //this.worldInfo = new DerivedWorldInfo(p_i45283_6_.getWorldInfo()); + this.worldInfo = new DerivedWorldInfo(p_i45283_6_.getWorldInfo());
+ } + }
+ +
+ // Cauldron start - vanilla compatibility + // Cauldron start - vanilla compatibility

View File

@ -267,4 +267,10 @@ public class SpigotConfig
{ {
playerShuffle = getInt( "settings.player-shuffle", 0 ); playerShuffle = getInt( "settings.player-shuffle", 0 );
} }
public static int fullMatchRate;
private static void fullMatchRate()
{
fullMatchRate = getInt( "settings.fullMatchRate", 10);
}
} }