Custom Potion Mixes
== AT == public-f net.minecraft.server.MinecraftServer potionBrewing
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
public class BrewingStandMenu extends AbstractContainerMenu {
|
||||
|
||||
@@ -35,12 +39,18 @@
|
||||
@@ -35,21 +39,29 @@
|
||||
public final ContainerData brewingStandData;
|
||||
private final Slot ingredientSlot;
|
||||
|
||||
@@ -30,7 +30,21 @@
|
||||
checkContainerSize(inventory, 5);
|
||||
checkContainerDataCount(propertyDelegate, 2);
|
||||
this.brewingStand = inventory;
|
||||
@@ -58,6 +68,7 @@
|
||||
this.brewingStandData = propertyDelegate;
|
||||
PotionBrewing potionbrewer = playerInventory.player.level().potionBrewing();
|
||||
|
||||
- this.addSlot(new BrewingStandMenu.PotionSlot(inventory, 0, 56, 51));
|
||||
- this.addSlot(new BrewingStandMenu.PotionSlot(inventory, 1, 79, 58));
|
||||
- this.addSlot(new BrewingStandMenu.PotionSlot(inventory, 2, 102, 51));
|
||||
+ // Paper start - custom potion mixes
|
||||
+ this.addSlot(new BrewingStandMenu.PotionSlot(inventory, 0, 56, 51, potionbrewer));
|
||||
+ this.addSlot(new BrewingStandMenu.PotionSlot(inventory, 1, 79, 58, potionbrewer));
|
||||
+ this.addSlot(new BrewingStandMenu.PotionSlot(inventory, 2, 102, 51, potionbrewer));
|
||||
+ // Paper end - custom potion mixes
|
||||
this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionbrewer, inventory, 3, 79, 17));
|
||||
this.addSlot(new BrewingStandMenu.FuelSlot(inventory, 4, 17, 17));
|
||||
this.addDataSlots(propertyDelegate);
|
||||
@@ -58,6 +70,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(Player player) {
|
||||
@@ -38,7 +52,45 @@
|
||||
return this.brewingStand.stillValid(player);
|
||||
}
|
||||
|
||||
@@ -198,4 +209,17 @@
|
||||
@@ -79,7 +92,7 @@
|
||||
if (!this.moveItemStackTo(itemstack1, 3, 4, false)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack)) {
|
||||
+ } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack, this.player.player.level().potionBrewing())) { // Paper - custom potion mixes
|
||||
if (!this.moveItemStackTo(itemstack1, 0, 3, false)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
@@ -128,13 +141,15 @@
|
||||
|
||||
private static class PotionSlot extends Slot {
|
||||
|
||||
- public PotionSlot(Container inventory, int index, int x, int y) {
|
||||
+ private final PotionBrewing potionBrewing; // Paper - custom potion mixes
|
||||
+ public PotionSlot(Container inventory, int index, int x, int y, PotionBrewing potionBrewing) { // Paper - custom potion mixes
|
||||
super(inventory, index, x, y);
|
||||
+ this.potionBrewing = potionBrewing; // Paper - custom potion mixes
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
- return PotionSlot.mayPlaceItem(stack);
|
||||
+ return PotionSlot.mayPlaceItem(stack, this.potionBrewing); // Paper - custom potion mixes
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,8 +168,8 @@
|
||||
super.onTake(player, stack);
|
||||
}
|
||||
|
||||
- public static boolean mayPlaceItem(ItemStack stack) {
|
||||
- return stack.is(Items.POTION) || stack.is(Items.SPLASH_POTION) || stack.is(Items.LINGERING_POTION) || stack.is(Items.GLASS_BOTTLE);
|
||||
+ public static boolean mayPlaceItem(ItemStack stack, PotionBrewing potionBrewing) { // Paper - custom potion mixes
|
||||
+ return stack.is(Items.POTION) || stack.is(Items.SPLASH_POTION) || stack.is(Items.LINGERING_POTION) || stack.is(Items.GLASS_BOTTLE) || potionBrewing.isCustomInput(stack); // Paper - Custom Potion Mixes
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,4 +213,17 @@
|
||||
return BrewingStandMenu.EMPTY_SLOT_FUEL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user