add consumeFuel to FurnaceBurnEvent

This commit is contained in:
Jake Potrebic 2021-04-22 16:45:28 -07:00
parent 6a311ade3a
commit 8683cde7c0

View File

@ -38,7 +38,7 @@
protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) {
super(blockEntityType, pos, state);
@@ -110,8 +125,39 @@
@@ -110,9 +125,40 @@
}
};
this.recipesUsed = new Reference2IntOpenHashMap();
@ -46,7 +46,7 @@
+ this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail
+ this.recipeType = recipeType; // Paper - cook speed multiplier API
}
+
+ // CraftBukkit start - add fields and methods
+ private int maxStack = MAX_STACK;
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@ -76,9 +76,10 @@
+ this.maxStack = size;
+ }
+ // CraftBukkit end
+
private boolean isLit() {
return this.litTimeRemaining > 0;
}
@@ -135,6 +181,11 @@
this.recipesUsed.put(ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(s)), nbttagcompound1.getInt(s));
}
@ -108,7 +109,7 @@
} else {
recipeholder = null;
}
@@ -183,9 +235,20 @@
@@ -183,11 +235,22 @@
int i = blockEntity.getMaxStackSize();
if (!blockEntity.isLit() && AbstractFurnaceBlockEntity.canBurn(world.registryAccess(), recipeholder, singlerecipeinput, blockEntity.items, i)) {
@ -129,8 +130,11 @@
+ if (blockEntity.isLit() && furnaceBurnEvent.isBurning()) {
+ // CraftBukkit end
flag1 = true;
if (flag3) {
- if (flag3) {
+ if (flag3 && furnaceBurnEvent.willConsumeFuel()) { // Paper - add consumeFuel to FurnaceBurnEvent
Item item = itemstack.getItem();
itemstack.shrink(1);
@@ -199,11 +262,23 @@
}