Add recipeBrewTime

== AT ==
public net.minecraft.world.inventory.BrewingStandMenu brewingStandData
This commit is contained in:
Tamion
2024-09-15 19:17:12 +02:00
parent cea3e6b65b
commit 8b8acbb898
6 changed files with 110 additions and 18 deletions

View File

@@ -0,0 +1,11 @@
package io.papermc.paper.inventory;
import net.minecraft.world.inventory.SimpleContainerData;
public class BrewingSimpleContainerData extends SimpleContainerData {
public BrewingSimpleContainerData() {
super(3);
this.set(2, 400);
}
}

View File

@@ -41,6 +41,19 @@ public class CraftBrewingStand extends CraftContainer<BrewingStandBlockEntity> i
this.getSnapshot().brewTime = brewTime;
}
// Paper start - Add recipeBrewTime
@Override
public void setRecipeBrewTime(int recipeBrewTime) {
com.google.common.base.Preconditions.checkArgument(recipeBrewTime > 0, "recipeBrewTime must be positive");
this.getSnapshot().recipeBrewTime = recipeBrewTime;
}
@Override
public int getRecipeBrewTime() {
return this.getSnapshot().recipeBrewTime;
}
// Paper end - Add recipeBrewTime
@Override
public int getFuelLevel() {
return this.getSnapshot().fuel;

View File

@@ -163,7 +163,7 @@ public class CraftContainer extends AbstractContainerMenu {
this.delegate = new EnchantmentMenu(windowId, bottom);
break;
case BREWING:
this.delegate = new BrewingStandMenu(windowId, bottom, top, new SimpleContainerData(2));
this.delegate = new BrewingStandMenu(windowId, bottom, top, new io.papermc.paper.inventory.BrewingSimpleContainerData()); // Paper - Add recipeBrewTime
break;
case HOPPER:
this.delegate = new HopperMenu(windowId, bottom, top);

View File

@@ -35,4 +35,17 @@ public class CraftBrewingStandView extends CraftInventoryView<BrewingStandMenu,
Preconditions.checkArgument(brewingTicks > 0, "The given brewing ticks must be greater than 0");
this.container.setData(BrewingStandBlockEntity.DATA_BREW_TIME, brewingTicks);
}
// Paper start - Add recipeBrewTime
@Override
public void setRecipeBrewTime(int recipeBrewTime) {
com.google.common.base.Preconditions.checkArgument(recipeBrewTime > 0, "recipeBrewTime must be positive");
this.container.brewingStandData.set(2, recipeBrewTime);
}
@Override
public int getRecipeBrewTime() {
return this.container.brewingStandData.get(2);
}
// Paper end - Add recipeBrewTime
}