#757: PoweredMinecart - add getter/setter for fuel

By: Shane Bee <shanebolenback@me.com>
This commit is contained in:
CraftBukkit/Spigot 2020-10-13 18:59:56 +11:00
parent 0410e56149
commit f265542e4f
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/server/EntityMinecartFurnace.java
+++ b/net/minecraft/server/EntityMinecartFurnace.java
@@ -3,7 +3,7 @@
public class EntityMinecartFurnace extends EntityMinecartAbstract {
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityMinecartFurnace.class, DataWatcherRegistry.i);
- private int e;
+ public int e; // CraftBukkit PAIL private -> public, RENAME fuel
public double b;
public double c;
private static final RecipeItemStack f = RecipeItemStack.a(Items.COAL, Items.CHARCOAL);

View file

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.server.EntityMinecartFurnace;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
@ -11,6 +12,22 @@ public class CraftMinecartFurnace extends CraftMinecart implements PoweredMineca
super(server, entity);
}
@Override
public EntityMinecartFurnace getHandle() {
return (EntityMinecartFurnace) entity;
}
@Override
public int getFuel() {
return getHandle().e;
}
@Override
public void setFuel(int fuel) {
Preconditions.checkArgument(fuel >= 0, "ticks cannot be negative");
getHandle().e = fuel;
}
@Override
public String toString() {
return "CraftMinecartFurnace";