mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 12:33:57 +01:00
Less drains More II
- Fixed Potion buckets from Tinkers Construct not interacting correctly with drains and spouts #6316 #4124 #6415
This commit is contained in:
parent
ffa26fc0e4
commit
f964e892de
@ -200,8 +200,8 @@ dependencies {
|
||||
// implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25")
|
||||
// runtimeOnly fg.deobf("vazkii.arl:AutoRegLib:1.4-35.69")
|
||||
// runtimeOnly fg.deobf("vazkii.quark:Quark:r2.0-212.984")
|
||||
// runtimeOnly fg.deobf("slimeknights.mantle:Mantle:1.16.5-1.6.115")
|
||||
// runtimeOnly fg.deobf("slimeknights.tconstruct:TConstruct:1.16.5-3.1.1.252")
|
||||
// runtimeOnly fg.deobf("curse.maven:mantle-74924:4509007")
|
||||
// runtimeOnly fg.deobf("curse.maven:tinkers-construct-74072:4509008")
|
||||
// runtimeOnly fg.deobf("maven.modrinth:rubidium:0.5.3")
|
||||
// implementation fg.deobf("com.railwayteam.railways:railways-1.18.2-1.1.1:all") { transitive = false }
|
||||
// runtimeOnly fg.deobf("maven.modrinth:spark:1.10.38-forge")
|
||||
|
@ -42,7 +42,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
|
||||
|
||||
public static void consumeRecipes(Consumer<EmptyingRecipe> consumer, IIngredientManager ingredientManager) {
|
||||
for (ItemStack stack : ingredientManager.getAllIngredients(VanillaTypes.ITEM_STACK)) {
|
||||
if (stack.getItem() instanceof PotionItem) {
|
||||
if (PotionFluidHandler.isPotionItem(stack)) {
|
||||
FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);
|
||||
Ingredient potion = Ingredient.of(stack);
|
||||
consumer.accept(new ProcessingRecipeBuilder<>(EmptyingRecipe::new, Create.asResource("potions"))
|
||||
|
@ -46,7 +46,7 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
|
||||
public static void consumeRecipes(Consumer<FillingRecipe> consumer, IIngredientManager ingredientManager) {
|
||||
Collection<FluidStack> fluidStacks = ingredientManager.getAllIngredients(ForgeTypes.FLUID_STACK);
|
||||
for (ItemStack stack : ingredientManager.getAllIngredients(VanillaTypes.ITEM_STACK)) {
|
||||
if (stack.getItem() instanceof PotionItem) {
|
||||
if (PotionFluidHandler.isPotionItem(stack)) {
|
||||
FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);
|
||||
Ingredient bottle = Ingredient.of(Items.GLASS_BOTTLE);
|
||||
consumer.accept(new ProcessingRecipeBuilder<>(FillingRecipe::new, Create.asResource("potions"))
|
||||
|
@ -22,9 +22,11 @@ import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffectUtil;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.item.BucketItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.PotionItem;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
@ -36,6 +38,11 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class PotionFluidHandler {
|
||||
|
||||
public static boolean isPotionItem(ItemStack stack) {
|
||||
return stack.getItem() instanceof PotionItem && !(stack.getContainerItem()
|
||||
.getItem() instanceof BucketItem);
|
||||
}
|
||||
|
||||
public static Pair<FluidStack, ItemStack> emptyPotion(ItemStack stack, boolean simulate) {
|
||||
FluidStack fluid = getFluidFromPotionItem(stack);
|
||||
if (!simulate)
|
||||
|
@ -24,7 +24,7 @@ public class GenericItemEmptying {
|
||||
private static final RecipeWrapper WRAPPER = new RecipeWrapper(new ItemStackHandler(1));
|
||||
|
||||
public static boolean canItemBeEmptied(Level world, ItemStack stack) {
|
||||
if (stack.getItem() instanceof PotionItem)
|
||||
if (PotionFluidHandler.isPotionItem(stack))
|
||||
return true;
|
||||
|
||||
WRAPPER.setItem(0, stack);
|
||||
@ -49,7 +49,7 @@ public class GenericItemEmptying {
|
||||
FluidStack resultingFluid = FluidStack.EMPTY;
|
||||
ItemStack resultingItem = ItemStack.EMPTY;
|
||||
|
||||
if (stack.getItem() instanceof PotionItem)
|
||||
if (PotionFluidHandler.isPotionItem(stack))
|
||||
return PotionFluidHandler.emptyPotion(stack, simulate);
|
||||
|
||||
WRAPPER.setItem(0, stack);
|
||||
|
Loading…
Reference in New Issue
Block a user