- 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"
This commit is contained in:
simibubi 2022-03-21 00:29:45 +01:00
parent 939b276c56
commit a8c368f426
15 changed files with 118 additions and 101 deletions

View file

@ -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"

View file

@ -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

View file

@ -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<ResourceLocation> 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");

View file

@ -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();

View file

@ -85,7 +85,10 @@ public class CreateJEI implements IModPlugin {
public IIngredientManager ingredientManager;
private final List<CreateRecipeCategory<?>> allCategories = new ArrayList<>();
private final CreateRecipeCategory<?>
private void loadCategories() {
allCategories.clear();
CreateRecipeCategory<?>
milling = register("milling", MillingCategory::new).addTypedRecipes(AllRecipeTypes.MILLING)
.catalyst(AllBlocks.MILLSTONE::get)
@ -116,7 +119,8 @@ public class CreateJEI implements IModPlugin {
.build(),
haunting = register("fan_haunting", FanHauntingCategory::new).addTypedRecipes(AllRecipeTypes.HAUNTING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_haunting")).build(),
.catalystStack(ProcessingViaFanCategory.getFan("fan_haunting"))
.build(),
mixing = register("mixing", MixingCategory::standard).addTypedRecipes(AllRecipeTypes.MIXING)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
@ -128,16 +132,18 @@ public class CreateJEI implements IModPlugin {
.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),
.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)
brewing =
register("automatic_brewing", MixingCategory::autoBrewing).addRecipes(() -> PotionMixingRecipes.ALL)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
.catalyst(AllBlocks.BASIN::get)
.build(),
@ -146,9 +152,10 @@ public class CreateJEI implements IModPlugin {
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.build(),
blockCutting = register("block_cutting", () -> new BlockCuttingCategory(Items.STONE_BRICK_STAIRS))
blockCutting =
register("block_cutting", () -> new BlockCuttingCategory(Items.STONE_BRICK_STAIRS))
.addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding(
RecipeType.STONECUTTING, recipe -> AllRecipeTypes.isManualRecipe(recipe))))
RecipeType.STONECUTTING, recipe -> AllRecipeTypes.shouldIgnoreInAutomation(recipe))))
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.enableWhen(c -> c.allowStonecuttingOnSaw)
.build(),
@ -156,7 +163,7 @@ public class CreateJEI implements IModPlugin {
woodCutting = register("wood_cutting", () -> new BlockCuttingCategory(Items.OAK_STAIRS))
.addRecipes(() -> CondensedBlockCuttingRecipe
.condenseRecipes(getTypedRecipesExcluding(SawTileEntity.woodcuttingRecipeType.get(),
recipe -> AllRecipeTypes.isManualRecipe(recipe))))
recipe -> AllRecipeTypes.shouldIgnoreInAutomation(recipe))))
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.enableWhenBool(c -> c.allowWoodcuttingOnSaw.get() && ModList.get()
.isLoaded("druidcraft"))
@ -170,20 +177,20 @@ public class CreateJEI implements IModPlugin {
autoSquare = register("automatic_packing", PackingCategory::autoSquare)
.addAllRecipesIf(
r -> (r instanceof CraftingRecipe) && !(r instanceof MechanicalCraftingRecipe)
&& MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.isManualRecipe(r),
&& 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)
@ -206,9 +213,12 @@ public class CreateJEI implements IModPlugin {
.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))
.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(),
@ -218,8 +228,9 @@ public class CreateJEI implements IModPlugin {
.catalyst(AllBlocks.MECHANICAL_CRAFTER::get)
.build();
private <T extends Recipe<?>> CategoryBuilder<T> register(String name,
Supplier<CreateRecipeCategory<T>> supplier) {
}
private <T extends Recipe<?>> CategoryBuilder<T> register(String name, Supplier<CreateRecipeCategory<T>> supplier) {
return new CategoryBuilder<T>(name, supplier);
}
@ -236,6 +247,7 @@ public class CreateJEI implements IModPlugin {
@Override
public void registerCategories(IRecipeCategoryRegistration registration) {
loadCategories();
registration.addRecipeCategories(allCategories.toArray(IRecipeCategory[]::new));
}
@ -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,7 +327,8 @@ public class CreateJEI implements IModPlugin {
return addRecipeListConsumer(recipes -> consumeTypedRecipes(recipes::add, recipeType.get()));
}
public CategoryBuilder<T> addTypedRecipes(Supplier<RecipeType<? extends T>> recipeType, Function<Recipe<?>, T> converter) {
public CategoryBuilder<T> addTypedRecipes(Supplier<RecipeType<? extends T>> recipeType,
Function<Recipe<?>, T> converter) {
return addRecipeListConsumer(recipes -> consumeTypedRecipes(recipe -> {
recipes.add(converter.apply(recipe));
}, recipeType.get()));
@ -405,11 +418,10 @@ public class CreateJEI implements IModPlugin {
public static void consumeTypedRecipes(Consumer<Recipe<?>> consumer, RecipeType<?> type) {
Map<ResourceLocation, Recipe<?>> map = Minecraft.getInstance()
.getConnection()
.getRecipeManager()
.recipes
.get(type);
.getRecipeManager().recipes.get(type);
if (map != null) {
map.values().forEach(consumer);
map.values()
.forEach(consumer);
}
}
@ -426,7 +438,10 @@ 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()

View file

@ -166,7 +166,7 @@ public class RecipeGridHandler {
if (numItems > 9)
return false;
}
if (AllRecipeTypes.isManualRecipe(recipe))
if (AllRecipeTypes.shouldIgnoreInAutomation(recipe))
return false;
return true;
}

View file

@ -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"))))

View file

@ -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 =

View file

@ -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());
}

View file

@ -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<ResourceLocation> RECIPE_DENY_SET =
ImmutableSet.of(new ResourceLocation("occultism", "spirit_trade"), new ResourceLocation("occultism", "ritual"));
public static <C extends Container> boolean canCompress(Recipe<C> 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<Ingredient> ingredients = recipe.getIngredients();
return (ingredients.size() == 4 || ingredients.size() == 9) && ItemHelper.matchAllIngredients(ingredients);
}
@ -363,7 +351,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
@Override
protected <C extends Container> boolean matchStaticFilters(Recipe<C> recipe) {
return (recipe instanceof CraftingRecipe && !(recipe instanceof MechanicalCraftingRecipe)
&& canCompress(recipe) && !AllRecipeTypes.isManualRecipe(recipe))
&& canCompress(recipe) && !AllRecipeTypes.shouldIgnoreInAutomation(recipe))
|| recipe.getType() == AllRecipeTypes.COMPACTING.getType();
}

View file

@ -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());
}

View file

@ -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<StructureBlockInfo, MovementContext> 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))
@ -442,6 +444,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
return;
StructureTransform transform = makeStructureTransform();
contraption.stop(level);
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this),
new ContraptionDisassemblyPacket(this.getId(), transform));
@ -460,6 +464,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
((AbstractContraptionEntity) entity).disassemble();
}
skipActorStop = true;
discard();
ejectPassengers();
@ -480,8 +485,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
@Override
public void remove(RemovalReason p_146834_) {
if (!level.isClientSide && !isRemoved() && contraption != null)
if (!ticking)
if (!level.isClientSide && !isRemoved() && contraption != null && !skipActorStop)
contraption.stop(level);
if (contraption != null)
contraption.onEntityRemoved(this);

View file

@ -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;
};
}

View file

@ -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

View file

@ -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"