summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2012-12-08 02:45:50 -0600
committerfeildmaster <admin@feildmaster.com>2012-12-08 02:45:50 -0600
commite760d6eb31682e2c3691b9c161d766adde0fcaa3 (patch)
treee8a288356c78ecd027c824e2e3270bcd52e39b3c /src/main/java/net/minecraft/server
parent24abdd556d26576610a66bb00c925bd8fcca7ced (diff)
downloadcraftbukkit-e760d6eb31682e2c3691b9c161d766adde0fcaa3.tar
craftbukkit-e760d6eb31682e2c3691b9c161d766adde0fcaa3.tar.gz
craftbukkit-e760d6eb31682e2c3691b9c161d766adde0fcaa3.tar.lz
craftbukkit-e760d6eb31682e2c3691b9c161d766adde0fcaa3.tar.xz
craftbukkit-e760d6eb31682e2c3691b9c161d766adde0fcaa3.zip
Add SlotFurnaceResult for diff visibility
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r--src/main/java/net/minecraft/server/SlotFurnaceResult.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
new file mode 100644
index 00000000..ed2e00d3
--- /dev/null
+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
@@ -0,0 +1,69 @@
+package net.minecraft.server;
+
+public class SlotFurnaceResult extends Slot {
+
+ private EntityHuman a;
+ private int b;
+
+ public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) {
+ super(iinventory, i, j, k);
+ this.a = entityhuman;
+ }
+
+ public boolean isAllowed(ItemStack itemstack) {
+ return false;
+ }
+
+ public ItemStack a(int i) {
+ if (this.d()) {
+ this.b += Math.min(i, this.getItem().count);
+ }
+
+ return super.a(i);
+ }
+
+ public void a(EntityHuman entityhuman, ItemStack itemstack) {
+ this.b(itemstack);
+ super.a(entityhuman, itemstack);
+ }
+
+ protected void a(ItemStack itemstack, int i) {
+ this.b += i;
+ this.b(itemstack);
+ }
+
+ protected void b(ItemStack itemstack) {
+ itemstack.a(this.a.world, this.a, this.b);
+ if (!this.a.world.isStatic) {
+ int i = this.b;
+ float f = RecipesFurnace.getInstance().c(itemstack.id);
+ int j;
+
+ if (f == 0.0F) {
+ i = 0;
+ } else if (f < 1.0F) {
+ j = MathHelper.d((float) i * f);
+ if (j < MathHelper.f((float) i * f) && (float) Math.random() < (float) i * f - (float) j) {
+ ++j;
+ }
+
+ i = j;
+ }
+
+ while (i > 0) {
+ j = EntityExperienceOrb.getOrbValue(i);
+ i -= j;
+ this.a.world.addEntity(new EntityExperienceOrb(this.a.world, this.a.locX, this.a.locY + 0.5D, this.a.locZ + 0.5D, j));
+ }
+ }
+
+ this.b = 0;
+ if (itemstack.id == Item.IRON_INGOT.id) {
+ this.a.a((Statistic) AchievementList.k, 1);
+ }
+
+ if (itemstack.id == Item.COOKED_FISH.id) {
+ this.a.a((Statistic) AchievementList.p, 1);
+ }
+ }
+}