Fix mechanical mixer not working for all non shaped recipes. Fixes #1424

This commit is contained in:
Jared 2022-02-15 05:17:31 +02:00
parent 379c243133
commit 51197d2034
No known key found for this signature in database
GPG key ID: DB3BA3B9088A1BDF

View file

@ -32,6 +32,7 @@ import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.level.block.entity.BlockEntityType;
@ -40,6 +41,7 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.crafting.IShapedRecipe;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@ -237,10 +239,10 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
@Override
protected <C extends Container> boolean matchStaticFilters(Recipe<C> r) {
return ((r.getSerializer() == RecipeSerializer.SHAPELESS_RECIPE
&& AllConfigs.SERVER.recipes.allowShapelessInMixer.get() && r.getIngredients()
return ((r instanceof CraftingRecipe && !(r instanceof IShapedRecipe<?>)
&& AllConfigs.SERVER.recipes.allowShapelessInMixer.get() && r.getIngredients()
.size() > 1
&& !MechanicalPressTileEntity.canCompress(r)) && !AllRecipeTypes.isManualRecipe(r)
&& !MechanicalPressTileEntity.canCompress(r)) && !AllRecipeTypes.isManualRecipe(r)
|| r.getType() == AllRecipeTypes.MIXING.getType());
}
@ -289,9 +291,9 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
// SoundEvents.BLOCK_STONE_BREAK
boolean slow = Math.abs(getSpeed()) < 65;
if (slow && AnimationTickHolder.getTicks() % 2 == 0)
if (slow && AnimationTickHolder.getTicks() % 2 == 0)
return;
if (runningTicks == 20)
if (runningTicks == 20)
AllSoundEvents.MIXING.playAt(level, worldPosition, .75f, 1, true);
}