From a8c368f42645c5bb65fd31d8b0681c87c8d39b8b Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 21 Mar 2022 00:29:45 +0100 Subject: [PATCH] Patch F - Fixed Create's JEI plugin not reloading recipes properly - Reverted an AT that seems to cause issues with compiling in IDEs - Fixed Contraption disassembly causing inventory contents to be rolled back - Fixed Crushing Wheels not working correctly - Items idling on top of Crushing Wheels are no longer prevented from being picked up by players - Fixed automated compatibility picking up custom recipes from the mod "occultism" --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + gradle.properties | 2 +- .../com/simibubi/create/AllRecipeTypes.java | 10 +- src/main/java/com/simibubi/create/Create.java | 2 +- .../simibubi/create/compat/jei/CreateJEI.java | 147 ++++++++++-------- .../components/crafter/RecipeGridHandler.java | 2 +- .../crusher/CrushingWheelControllerBlock.java | 4 +- .../CrushingWheelControllerTileEntity.java | 4 +- .../mixer/MechanicalMixerTileEntity.java | 2 +- .../press/MechanicalPressTileEntity.java | 14 +- .../components/saw/SawTileEntity.java | 2 +- .../AbstractContraptionEntity.java | 22 +-- .../foundation/block/CopperBlockSet.java | 4 +- .../resources/META-INF/accesstransformer.cfg | 1 - src/main/resources/META-INF/mods.toml | 2 +- 15 files changed, 118 insertions(+), 101 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1a0c4b59f..e4ebb27c6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -49,6 +49,7 @@ body: label: Mod Version description: The version of the mod you were using when the bug occured options: + - "0.4.0f" - "0.4.0e" - "0.4.0d" - "0.4.0c" diff --git a/gradle.properties b/gradle.properties index b447a7889..c121035f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false # mod version info -mod_version = 0.4e +mod_version = 0.4f minecraft_version = 1.18.1 forge_version = 39.1.0 diff --git a/src/main/java/com/simibubi/create/AllRecipeTypes.java b/src/main/java/com/simibubi/create/AllRecipeTypes.java index 5747e792c..a15df4a6a 100644 --- a/src/main/java/com/simibubi/create/AllRecipeTypes.java +++ b/src/main/java/com/simibubi/create/AllRecipeTypes.java @@ -1,8 +1,10 @@ package com.simibubi.create; import java.util.Optional; +import java.util.Set; import java.util.function.Supplier; +import com.google.common.collect.ImmutableSet; import com.simibubi.create.compat.jei.ConversionRecipe; import com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe; import com.simibubi.create.content.contraptions.components.crusher.CrushingRecipe; @@ -134,7 +136,13 @@ public enum AllRecipeTypes implements IRecipeTypeInfo { }); } - public static boolean isManualRecipe(Recipe recipe) { + public static final Set RECIPE_DENY_SET = + ImmutableSet.of(new ResourceLocation("occultism", "spirit_trade"), new ResourceLocation("occultism", "ritual")); + + public static boolean shouldIgnoreInAutomation(Recipe recipe) { + RecipeSerializer serializer = recipe.getSerializer(); + if (serializer != null && RECIPE_DENY_SET.contains(serializer.getRegistryName())) + return true; return recipe.getId() .getPath() .endsWith("_manual_only"); diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index c4049703c..41e28504c 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -57,7 +57,7 @@ public class Create { public static final String ID = "create"; public static final String NAME = "Create"; - public static final String VERSION = "0.4e"; + public static final String VERSION = "0.4f"; public static final Logger LOGGER = LogManager.getLogger(); diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index e46310a76..31ecb312c 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -85,141 +85,152 @@ public class CreateJEI implements IModPlugin { public IIngredientManager ingredientManager; private final List> allCategories = new ArrayList<>(); - private final CreateRecipeCategory + + private void loadCategories() { + allCategories.clear(); + CreateRecipeCategory milling = register("milling", MillingCategory::new).addTypedRecipes(AllRecipeTypes.MILLING) - .catalyst(AllBlocks.MILLSTONE::get) - .build(), + .catalyst(AllBlocks.MILLSTONE::get) + .build(), - crushing = register("crushing", CrushingCategory::new).addTypedRecipes(AllRecipeTypes.CRUSHING) + crushing = register("crushing", CrushingCategory::new).addTypedRecipes(AllRecipeTypes.CRUSHING) .addTypedRecipesExcluding(AllRecipeTypes.MILLING::getType, AllRecipeTypes.CRUSHING::getType) .catalyst(AllBlocks.CRUSHING_WHEEL::get) .build(), - pressing = register("pressing", PressingCategory::new).addTypedRecipes(AllRecipeTypes.PRESSING) + pressing = register("pressing", PressingCategory::new).addTypedRecipes(AllRecipeTypes.PRESSING) .catalyst(AllBlocks.MECHANICAL_PRESS::get) .build(), - washing = register("fan_washing", FanWashingCategory::new).addTypedRecipes(AllRecipeTypes.SPLASHING) + washing = register("fan_washing", FanWashingCategory::new).addTypedRecipes(AllRecipeTypes.SPLASHING) .catalystStack(ProcessingViaFanCategory.getFan("fan_washing")) .build(), - smoking = register("fan_smoking", FanSmokingCategory::new).addTypedRecipes(() -> RecipeType.SMOKING) + smoking = register("fan_smoking", FanSmokingCategory::new).addTypedRecipes(() -> RecipeType.SMOKING) .catalystStack(ProcessingViaFanCategory.getFan("fan_smoking")) .build(), - blasting = register("fan_blasting", FanBlastingCategory::new) + blasting = register("fan_blasting", FanBlastingCategory::new) .addTypedRecipesExcluding(() -> RecipeType.SMELTING, () -> RecipeType.BLASTING) .addTypedRecipes(() -> RecipeType.BLASTING) .removeRecipes(() -> RecipeType.SMOKING) .catalystStack(ProcessingViaFanCategory.getFan("fan_blasting")) .build(), - haunting = register("fan_haunting", FanHauntingCategory::new).addTypedRecipes(AllRecipeTypes.HAUNTING) - .catalystStack(ProcessingViaFanCategory.getFan("fan_haunting")).build(), + haunting = register("fan_haunting", FanHauntingCategory::new).addTypedRecipes(AllRecipeTypes.HAUNTING) + .catalystStack(ProcessingViaFanCategory.getFan("fan_haunting")) + .build(), - mixing = register("mixing", MixingCategory::standard).addTypedRecipes(AllRecipeTypes.MIXING) + mixing = register("mixing", MixingCategory::standard).addTypedRecipes(AllRecipeTypes.MIXING) .catalyst(AllBlocks.MECHANICAL_MIXER::get) .catalyst(AllBlocks.BASIN::get) .build(), - seqAssembly = register("sequenced_assembly", SequencedAssemblyCategory::new) + seqAssembly = register("sequenced_assembly", SequencedAssemblyCategory::new) .addTypedRecipes(AllRecipeTypes.SEQUENCED_ASSEMBLY) .build(), - autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless) - .addAllRecipesIf(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe) && r.getIngredients() - .size() > 1 && !MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.isManualRecipe(r), - BasinRecipe::convertShapeless) + autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless) + .addAllRecipesIf(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe) + && r.getIngredients() + .size() > 1 + && !MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.shouldIgnoreInAutomation(r), + BasinRecipe::convertShapeless) .catalyst(AllBlocks.MECHANICAL_MIXER::get) .catalyst(AllBlocks.BASIN::get) .enableWhen(c -> c.allowShapelessInMixer) .build(), - brewing = register("automatic_brewing", MixingCategory::autoBrewing) - .addRecipes(() -> PotionMixingRecipes.ALL) - .catalyst(AllBlocks.MECHANICAL_MIXER::get) - .catalyst(AllBlocks.BASIN::get) - .build(), + brewing = + register("automatic_brewing", MixingCategory::autoBrewing).addRecipes(() -> PotionMixingRecipes.ALL) + .catalyst(AllBlocks.MECHANICAL_MIXER::get) + .catalyst(AllBlocks.BASIN::get) + .build(), - sawing = register("sawing", SawingCategory::new).addTypedRecipes(AllRecipeTypes.CUTTING) + sawing = register("sawing", SawingCategory::new).addTypedRecipes(AllRecipeTypes.CUTTING) .catalyst(AllBlocks.MECHANICAL_SAW::get) .build(), - blockCutting = register("block_cutting", () -> new BlockCuttingCategory(Items.STONE_BRICK_STAIRS)) - .addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding( - RecipeType.STONECUTTING, recipe -> AllRecipeTypes.isManualRecipe(recipe)))) - .catalyst(AllBlocks.MECHANICAL_SAW::get) - .enableWhen(c -> c.allowStonecuttingOnSaw) - .build(), + blockCutting = + register("block_cutting", () -> new BlockCuttingCategory(Items.STONE_BRICK_STAIRS)) + .addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding( + RecipeType.STONECUTTING, recipe -> AllRecipeTypes.shouldIgnoreInAutomation(recipe)))) + .catalyst(AllBlocks.MECHANICAL_SAW::get) + .enableWhen(c -> c.allowStonecuttingOnSaw) + .build(), - woodCutting = register("wood_cutting", () -> new BlockCuttingCategory(Items.OAK_STAIRS)) + woodCutting = register("wood_cutting", () -> new BlockCuttingCategory(Items.OAK_STAIRS)) .addRecipes(() -> CondensedBlockCuttingRecipe - .condenseRecipes(getTypedRecipesExcluding(SawTileEntity.woodcuttingRecipeType.get(), - recipe -> AllRecipeTypes.isManualRecipe(recipe)))) + .condenseRecipes(getTypedRecipesExcluding(SawTileEntity.woodcuttingRecipeType.get(), + recipe -> AllRecipeTypes.shouldIgnoreInAutomation(recipe)))) .catalyst(AllBlocks.MECHANICAL_SAW::get) .enableWhenBool(c -> c.allowWoodcuttingOnSaw.get() && ModList.get() - .isLoaded("druidcraft")) + .isLoaded("druidcraft")) .build(), - packing = register("packing", PackingCategory::standard).addTypedRecipes(AllRecipeTypes.COMPACTING) + packing = register("packing", PackingCategory::standard).addTypedRecipes(AllRecipeTypes.COMPACTING) .catalyst(AllBlocks.MECHANICAL_PRESS::get) .catalyst(AllBlocks.BASIN::get) .build(), - autoSquare = register("automatic_packing", PackingCategory::autoSquare) + autoSquare = register("automatic_packing", PackingCategory::autoSquare) .addAllRecipesIf( - r -> (r instanceof CraftingRecipe) && !(r instanceof MechanicalCraftingRecipe) - && MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.isManualRecipe(r), - BasinRecipe::convertShapeless) + r -> (r instanceof CraftingRecipe) && !(r instanceof MechanicalCraftingRecipe) + && MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.shouldIgnoreInAutomation(r), + BasinRecipe::convertShapeless) .catalyst(AllBlocks.MECHANICAL_PRESS::get) .catalyst(AllBlocks.BASIN::get) .enableWhen(c -> c.allowShapedSquareInPress) .build(), - polishing = register("sandpaper_polishing", PolishingCategory::new).addTypedRecipes(AllRecipeTypes.SANDPAPER_POLISHING) + polishing = register("sandpaper_polishing", PolishingCategory::new) + .addTypedRecipes(AllRecipeTypes.SANDPAPER_POLISHING) .catalyst(AllItems.SAND_PAPER::get) .catalyst(AllItems.RED_SAND_PAPER::get) .build(), - deploying = register("deploying", DeployingCategory::new) - .addTypedRecipes(AllRecipeTypes.DEPLOYING) + deploying = register("deploying", DeployingCategory::new).addTypedRecipes(AllRecipeTypes.DEPLOYING) .addTypedRecipes(AllRecipeTypes.SANDPAPER_POLISHING::getType, DeployerApplicationRecipe::convert) .catalyst(AllBlocks.DEPLOYER::get) .catalyst(AllBlocks.DEPOT::get) .catalyst(AllItems.BELT_CONNECTOR::get) .build(), - mysteryConversion = register("mystery_conversion", MysteriousItemConversionCategory::new) + mysteryConversion = register("mystery_conversion", MysteriousItemConversionCategory::new) .addRecipes(() -> MysteriousItemConversionCategory.RECIPES) .build(), - spoutFilling = register("spout_filling", SpoutCategory::new).addTypedRecipes(AllRecipeTypes.FILLING) + spoutFilling = register("spout_filling", SpoutCategory::new).addTypedRecipes(AllRecipeTypes.FILLING) .addRecipeListConsumer(recipes -> SpoutCategory.consumeRecipes(recipes::add, ingredientManager)) .catalyst(AllBlocks.SPOUT::get) .build(), - draining = register("draining", ItemDrainCategory::new) + draining = register("draining", ItemDrainCategory::new) .addRecipeListConsumer(recipes -> ItemDrainCategory.consumeRecipes(recipes::add, ingredientManager)) .addTypedRecipes(AllRecipeTypes.EMPTYING) .catalyst(AllBlocks.ITEM_DRAIN::get) .build(), - autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new) - .addAllRecipesIf(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe) && r.getIngredients() - .size() == 1) - .addTypedRecipesIf(() -> RecipeType.CRAFTING, recipe -> recipe instanceof IShapedRecipe && !AllRecipeTypes.isManualRecipe(recipe)) + autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new) + .addAllRecipesIf(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe) + && r.getIngredients() + .size() == 1 + && !AllRecipeTypes.shouldIgnoreInAutomation(r)) + .addTypedRecipesIf(() -> RecipeType.CRAFTING, + recipe -> recipe instanceof IShapedRecipe && !AllRecipeTypes.shouldIgnoreInAutomation(recipe)) .catalyst(AllBlocks.MECHANICAL_CRAFTER::get) .enableWhen(c -> c.allowRegularCraftingInCrafter) .build(), - mechanicalCrafting = register("mechanical_crafting", MechanicalCraftingCategory::new) + mechanicalCrafting = register("mechanical_crafting", MechanicalCraftingCategory::new) .addTypedRecipes(AllRecipeTypes.MECHANICAL_CRAFTING) .catalyst(AllBlocks.MECHANICAL_CRAFTER::get) .build(); - private > CategoryBuilder register(String name, - Supplier> supplier) { + } + + private > CategoryBuilder register(String name, Supplier> supplier) { return new CategoryBuilder(name, supplier); } @@ -236,6 +247,7 @@ public class CreateJEI implements IModPlugin { @Override public void registerCategories(IRecipeCategoryRegistration registration) { + loadCategories(); registration.addRecipeCategories(allCategories.toArray(IRecipeCategory[]::new)); } @@ -253,7 +265,7 @@ public class CreateJEI implements IModPlugin { allCategories.forEach(c -> c.recipes.forEach(s -> registration.addRecipes(s.get(), c.getUid()))); registration.addRecipes(ToolboxColoringRecipeMaker.createRecipes() - .collect(Collectors.toList()), VanillaRecipeCategoryUid.CRAFTING); + .collect(Collectors.toList()), VanillaRecipeCategoryUid.CRAFTING); } @Override @@ -261,7 +273,7 @@ public class CreateJEI implements IModPlugin { allCategories.forEach(c -> c.recipeCatalysts.forEach(s -> registration.addRecipeCatalyst(s.get(), c.getUid()))); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void registerGuiHandlers(IGuiHandlerRegistration registration) { registration.addGenericGuiContainerHandler(AbstractSimiContainerScreen.class, new SlotMover()); @@ -315,14 +327,15 @@ public class CreateJEI implements IModPlugin { return addRecipeListConsumer(recipes -> consumeTypedRecipes(recipes::add, recipeType.get())); } - public CategoryBuilder addTypedRecipes(Supplier> recipeType, Function, T> converter) { + public CategoryBuilder addTypedRecipes(Supplier> recipeType, + Function, T> converter) { return addRecipeListConsumer(recipes -> consumeTypedRecipes(recipe -> { recipes.add(converter.apply(recipe)); }, recipeType.get())); } public CategoryBuilder addTypedRecipesIf(Supplier> recipeType, - Predicate> pred) { + Predicate> pred) { return addRecipeListConsumer(recipes -> consumeTypedRecipes(recipe -> { if (pred.test(recipe)) { recipes.add(recipe); @@ -331,7 +344,7 @@ public class CreateJEI implements IModPlugin { } public CategoryBuilder addTypedRecipesExcluding(Supplier> recipeType, - Supplier> excluded) { + Supplier> excluded) { return addRecipeListConsumer(recipes -> { List> excludedRecipes = getTypedRecipes(excluded.get()); consumeTypedRecipes(recipe -> { @@ -361,7 +374,7 @@ public class CreateJEI implements IModPlugin { public CategoryBuilder catalyst(Supplier supplier) { return catalystStack(() -> new ItemStack(supplier.get() - .asItem())); + .asItem())); } public CategoryBuilder catalystStack(Supplier supplier) { @@ -371,7 +384,7 @@ public class CreateJEI implements IModPlugin { public CategoryBuilder enableWhen(Function configValue) { pred = c -> configValue.apply(c) - .get(); + .get(); return this; } @@ -405,11 +418,10 @@ public class CreateJEI implements IModPlugin { public static void consumeTypedRecipes(Consumer> consumer, RecipeType type) { Map> map = Minecraft.getInstance() .getConnection() - .getRecipeManager() - .recipes - .get(type); + .getRecipeManager().recipes.get(type); if (map != null) { - map.values().forEach(consumer); + map.values() + .forEach(consumer); } } @@ -426,18 +438,21 @@ public class CreateJEI implements IModPlugin { } public static boolean doInputsMatch(Recipe recipe1, Recipe recipe2) { - if (recipe1.getIngredients().isEmpty() || recipe2.getIngredients().isEmpty()) { + if (recipe1.getIngredients() + .isEmpty() + || recipe2.getIngredients() + .isEmpty()) { return false; } ItemStack[] matchingStacks = recipe1.getIngredients() - .get(0) - .getItems(); + .get(0) + .getItems(); if (matchingStacks.length == 0) { return false; } if (recipe2.getIngredients() - .get(0) - .test(matchingStacks[0])) + .get(0) + .test(matchingStacks[0])) return true; return false; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/RecipeGridHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/RecipeGridHandler.java index de7039299..8f6be9a34 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/RecipeGridHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/RecipeGridHandler.java @@ -166,7 +166,7 @@ public class RecipeGridHandler { if (numItems > 9) return false; } - if (AllRecipeTypes.isManualRecipe(recipe)) + if (AllRecipeTypes.shouldIgnoreInAutomation(recipe)) return false; return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java index c0496a737..86499cb51 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerBlock.java @@ -87,8 +87,8 @@ public class CrushingWheelControllerBlock extends DirectionalBlock implements IT return; if (te.crushingspeed == 0) return; - if (entityIn instanceof ItemEntity) - ((ItemEntity) entityIn).setPickUpDelay(10); +// if (entityIn instanceof ItemEntity) +// ((ItemEntity) entityIn).setPickUpDelay(10); CompoundTag data = entityIn.getPersistentData(); if (data.contains("BypassCrushingWheel")) { if (pos.equals(NbtUtils.readBlockPos(data.getCompound("BypassCrushingWheel")))) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java index de30109ed..36ab77f47 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java @@ -81,7 +81,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity { if (blockState == null) return false; Direction direction = blockState.getValue(CrushingWheelControllerBlock.FACING); - return direction == Direction.DOWN || direction.getOpposite() == side; + return direction == Direction.DOWN || direction == side; } @Override @@ -145,7 +145,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity { // Output Items if (facing != Direction.UP) { - Direction inputDir = facing.getOpposite(); + Direction inputDir = facing; BlockPos nextPos = worldPosition.offset(facing.getAxis() == Axis.X ? 1f * offset : 0f, (-1f), facing.getAxis() == Axis.Z ? 1f * offset : 0f); DirectBeltInputBehaviour behaviour = diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java index 2e18ba5ac..b1d090624 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java @@ -241,7 +241,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity { 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.shouldIgnoreInAutomation(r) || r.getType() == AllRecipeTypes.MIXING.getType()); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java index da42a1883..b96180260 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java @@ -3,9 +3,7 @@ package com.simibubi.create.content.contraptions.components.press; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.Set; -import com.google.common.collect.ImmutableSet; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.AllSoundEvents; @@ -32,7 +30,6 @@ import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.Container; import net.minecraft.world.entity.Entity; @@ -41,7 +38,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -345,17 +341,9 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { return AllRecipeTypes.PRESSING.find(pressingInv, level); } - private static final Set RECIPE_DENY_SET = - ImmutableSet.of(new ResourceLocation("occultism", "spirit_trade"), new ResourceLocation("occultism", "ritual")); - public static boolean canCompress(Recipe recipe) { if (!(recipe instanceof CraftingRecipe) || !AllConfigs.SERVER.recipes.allowShapedSquareInPress.get()) return false; - - RecipeSerializer serializer = recipe.getSerializer(); - if (serializer != null && RECIPE_DENY_SET.contains(serializer.getRegistryName())) - return false; - NonNullList ingredients = recipe.getIngredients(); return (ingredients.size() == 4 || ingredients.size() == 9) && ItemHelper.matchAllIngredients(ingredients); } @@ -363,7 +351,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { @Override protected boolean matchStaticFilters(Recipe recipe) { return (recipe instanceof CraftingRecipe && !(recipe instanceof MechanicalCraftingRecipe) - && canCompress(recipe) && !AllRecipeTypes.isManualRecipe(recipe)) + && canCompress(recipe) && !AllRecipeTypes.shouldIgnoreInAutomation(recipe)) || recipe.getType() == AllRecipeTypes.COMPACTING.getType(); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java index defb4f3e6..d1f34a84f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java @@ -365,7 +365,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity { return startedSearch.stream() .filter(RecipeConditions.outputMatchesFilter(filtering)) .filter(RecipeConditions.firstIngredientMatches(inventory.getStackInSlot(0))) - .filter(r -> !AllRecipeTypes.isManualRecipe(r)) + .filter(r -> !AllRecipeTypes.shouldIgnoreInAutomation(r)) .collect(Collectors.toList()); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java index 79b834323..a3db0949f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java @@ -64,7 +64,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit protected Contraption contraption; protected boolean initialized; protected boolean prevPosInvalid; - private boolean ticking; + private boolean skipActorStop; public AbstractContraptionEntity(EntityType entityTypeIn, Level worldIn) { super(entityTypeIn, worldIn); @@ -222,7 +222,9 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit return; } - collidingEntities.entrySet().removeIf(e -> e.getValue().incrementAndGet() > 3); + collidingEntities.entrySet() + .removeIf(e -> e.getValue() + .incrementAndGet() > 3); xo = getX(); yo = getY(); @@ -248,7 +250,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit if (!level.isClientSide) contraption.stalled = false; - ticking = true; + skipActorStop = true; for (MutablePair pair : contraption.getActors()) { MovementContext context = pair.right; StructureBlockInfo blockInfo = pair.left; @@ -285,7 +287,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit contraption.stop(level); return; } - ticking = false; + skipActorStop = false; for (Entity entity : getPassengers()) { if (!(entity instanceof OrientedContraptionEntity)) @@ -440,8 +442,10 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit return; if (contraption == null) return; - + StructureTransform transform = makeStructureTransform(); + + contraption.stop(level); AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this), new ContraptionDisassemblyPacket(this.getId(), transform)); @@ -460,8 +464,9 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit ((AbstractContraptionEntity) entity).disassemble(); } + skipActorStop = true; discard(); - + ejectPassengers(); moveCollidedEntitiesOnDisassembly(transform); AllSoundEvents.CONTRAPTION_DISASSEMBLE.playOnServer(level, blockPosition()); @@ -480,9 +485,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit @Override public void remove(RemovalReason p_146834_) { - if (!level.isClientSide && !isRemoved() && contraption != null) - if (!ticking) - contraption.stop(level); + if (!level.isClientSide && !isRemoved() && contraption != null && !skipActorStop) + contraption.stop(level); if (contraption != null) contraption.onEntityRemoved(this); super.remove(p_146834_); diff --git a/src/main/java/com/simibubi/create/foundation/block/CopperBlockSet.java b/src/main/java/com/simibubi/create/foundation/block/CopperBlockSet.java index 0a2c93745..b266d1bd0 100644 --- a/src/main/java/com/simibubi/create/foundation/block/CopperBlockSet.java +++ b/src/main/java/com/simibubi/create/foundation/block/CopperBlockSet.java @@ -38,6 +38,7 @@ import net.minecraft.world.level.block.WeatheringCopperStairBlock; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.client.model.generators.ModelProvider; +import net.minecraftforge.fml.util.ObfuscationReflectionHelper; public class CopperBlockSet { protected static final WeatherState[] WEATHER_STATES = WeatherState.values(); @@ -325,7 +326,8 @@ public class CopperBlockSet { new WeatheringCopperStairBlock(state, Blocks.AIR.defaultBlockState(), p); // WeatheringCopperStairBlock does not have a constructor that takes a Supplier, // so setting the field directly is the easiest solution - block.stateSupplier = defaultStateSupplier; + ObfuscationReflectionHelper.setPrivateValue(StairBlock.class, block, defaultStateSupplier, + "stateSupplier"); return block; }; } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index c9b47b34d..dbf7cf3d1 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -26,7 +26,6 @@ public net.minecraft.world.item.crafting.RecipeManager f_44007_ # recipes public net.minecraft.world.level.BaseSpawner f_45443_ # spawnPotentials public net.minecraft.world.level.BaseSpawner f_45444_ # nextSpawnData public net.minecraft.world.level.biome.BiomeManager f_47863_ # biomeZoomSeed -public-f net.minecraft.world.level.block.StairBlock stateSupplier public net.minecraft.world.level.block.entity.BeaconBlockEntity f_58648_ # beamSections public net.minecraft.world.level.chunk.HashMapPalette f_62658_ # values public net.minecraft.world.level.chunk.PaletteResize diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 4a3ddd01e..fda36255c 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -5,7 +5,7 @@ license="MIT" [[mods]] modId="create" -version="0.4e" +version="0.4f" displayName="Create" #updateJSONURL="" displayURL="https://www.curseforge.com/minecraft/mc-mods/create"