From 7d3d4a1e7cf2bac81b1e3afebe57a3a0ce08032d Mon Sep 17 00:00:00 2001 From: IThundxr Date: Thu, 21 Mar 2024 07:09:24 -0400 Subject: [PATCH 1/6] feat: Track Placement breaks flowers (#5821) * feat: tracks break flowers during placement * chore: cleanup import --- .../simibubi/create/content/trains/track/TrackPlacement.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java b/src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java index d5870a04b..a77a23218 100644 --- a/src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java +++ b/src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java @@ -33,6 +33,7 @@ import net.minecraft.core.Direction.AxisDirection; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.Tag; +import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Inventory; @@ -508,8 +509,7 @@ public class TrackPlacement { // copy over all shared properties from the shaped state to the correct track material block BlockState toPlace = BlockHelper.copyProperties(state, info.trackMaterial.getBlock().defaultBlockState()); - boolean canPlace = stateAtPos.getMaterial() - .isReplaceable(); + boolean canPlace = stateAtPos.getMaterial().isReplaceable() || stateAtPos.is(BlockTags.FLOWERS); if (canPlace) info.requiredTracks++; if (simulate) From 41f957a94d12521f00153688f0e9015bf66bd4d3 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 22 Mar 2024 09:23:20 -0400 Subject: [PATCH 2/6] Fix changing bogey style not updating the block properly (#6273) * Fix bogey block's placing the wrong block * Clean the code up a bit * Fix bitflag --- .../trains/bogey/AbstractBogeyBlock.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/trains/bogey/AbstractBogeyBlock.java b/src/main/java/com/simibubi/create/content/trains/bogey/AbstractBogeyBlock.java index f84f63500..220c59d58 100644 --- a/src/main/java/com/simibubi/create/content/trains/bogey/AbstractBogeyBlock.java +++ b/src/main/java/com/simibubi/create/content/trains/bogey/AbstractBogeyBlock.java @@ -227,15 +227,21 @@ public abstract class AbstractBogeyBlock ext sbbe.setBogeyData(sbbe.getBogeyData().merge(defaultData)); if (size == getSize()) { + if (state.getBlock() != style.getBlockOfSize(size)) { + CompoundTag oldData = sbbe.getBogeyData(); + level.setBlock(pos, copyProperties(state, getStateOfSize(sbbe, size)), Block.UPDATE_ALL); + if (!(level.getBlockEntity(pos) instanceof AbstractBogeyBlockEntity bogeyBlockEntity)) + return InteractionResult.FAIL; + bogeyBlockEntity.setBogeyData(oldData); + } player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style") .append(": ").append(style.displayName), true); } else { CompoundTag oldData = sbbe.getBogeyData(); - level.setBlock(pos, this.getStateOfSize(sbbe, size), 3); - BlockEntity newBlockEntity = level.getBlockEntity(pos); - if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newBlockEntity1)) + level.setBlock(pos, this.getStateOfSize(sbbe, size), Block.UPDATE_ALL); + if (!(level.getBlockEntity(pos) instanceof AbstractBogeyBlockEntity bogeyBlockEntity)) return InteractionResult.FAIL; - newBlockEntity1.setBogeyData(oldData); + bogeyBlockEntity.setBogeyData(oldData); player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size") .append(": ").append(style.displayName), true); } @@ -312,18 +318,18 @@ public abstract class AbstractBogeyBlock ext return target; } - public BlockState getNextSize(AbstractBogeyBlockEntity sbte) { + public BlockState getNextSize(AbstractBogeyBlockEntity sbbe) { BogeySizes.BogeySize size = this.getSize(); - BogeyStyle style = sbte.getStyle(); + BogeyStyle style = sbbe.getStyle(); BlockState nextBlock = style.getNextBlock(size).defaultBlockState(); - nextBlock = copyProperties(sbte.getBlockState(), nextBlock); + nextBlock = copyProperties(sbbe.getBlockState(), nextBlock); return nextBlock; } - public BlockState getStateOfSize(AbstractBogeyBlockEntity sbte, BogeySizes.BogeySize size) { - BogeyStyle style = sbte.getStyle(); + public BlockState getStateOfSize(AbstractBogeyBlockEntity sbbe, BogeySizes.BogeySize size) { + BogeyStyle style = sbbe.getStyle(); BlockState state = style.getBlockOfSize(size).defaultBlockState(); - return copyProperties(sbte.getBlockState(), state); + return copyProperties(sbbe.getBlockState(), state); } public BogeyStyle getNextStyle(Level level, BlockPos pos) { From 51db53c74f8497a486a30e1ce4a01f092f2194bf Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 22 Mar 2024 09:27:35 -0400 Subject: [PATCH 3/6] Fix Copycat step placement helper (#6267) --- .../decoration/copycat/CopycatStepBlock.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatStepBlock.java b/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatStepBlock.java index 11af92da6..6d8954177 100644 --- a/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatStepBlock.java +++ b/src/main/java/com/simibubi/create/content/decoration/copycat/CopycatStepBlock.java @@ -4,8 +4,10 @@ import java.util.function.Predicate; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; +import com.simibubi.create.content.kinetics.steamEngine.PoweredShaftBlock; import com.simibubi.create.foundation.placement.IPlacementHelper; import com.simibubi.create.foundation.placement.PlacementHelpers; +import com.simibubi.create.foundation.placement.PlacementOffset; import com.simibubi.create.foundation.placement.PoleHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.VoxelShaper; @@ -36,6 +38,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.jetbrains.annotations.NotNull; + public class CopycatStepBlock extends WaterloggedCopycatBlock { public static final EnumProperty HALF = BlockStateProperties.HALF; @@ -134,7 +138,7 @@ public class CopycatStepBlock extends WaterloggedCopycatBlock { return (state.getValue(HALF) == Half.TOP) == (face == Direction.UP); return state.getValue(FACING) == face; } - + @Override public boolean shouldFaceAlwaysRender(BlockState state, Direction face) { return canFaceBeOccluded(state, face.getOpposite()); @@ -222,10 +226,21 @@ public class CopycatStepBlock extends WaterloggedCopycatBlock { } @Override - public Predicate getItemPredicate() { + public @NotNull Predicate getItemPredicate() { return AllBlocks.COPYCAT_STEP::isIn; } + @Override + public @NotNull PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos, + BlockHitResult ray) { + PlacementOffset offset = super.getOffset(player, world, state, pos, ray); + + if (offset.isSuccessful()) + offset.withTransform(offset.getTransform() + .andThen(s -> s.setValue(HALF, state.getValue(HALF)))); + + return offset; + } } } From 6802a1316be36ba2ad513362bc23641b9f7a7654 Mon Sep 17 00:00:00 2001 From: attackeight <71084901+Attack8@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:35:10 -0400 Subject: [PATCH 4/6] Respect 'eternal' modifier from Forbidden and Arcanus in Deployer Recipes (#6231) - We Could be Immortal - Fixes Creators-of-Create#6220 --- build.gradle | 2 ++ .../content/kinetics/deployer/BeltDeployerCallbacks.java | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 51000d1ce..a203b1be0 100644 --- a/build.gradle +++ b/build.gradle @@ -204,6 +204,8 @@ dependencies { // 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") + //runtimeOnly fg.deobf("curse.maven:forbidden-arcanus-309858:4729924") + //runtimeOnly fg.deobf("curse.maven:valhelsia-core-416935:3886212") // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/BeltDeployerCallbacks.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/BeltDeployerCallbacks.java index d86d05294..81f43d9ca 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/BeltDeployerCallbacks.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/BeltDeployerCallbacks.java @@ -94,7 +94,7 @@ public class BeltDeployerCallbacks { public static void activate(TransportedItemStack transported, TransportedItemStackHandlerBehaviour handler, DeployerBlockEntity blockEntity, Recipe recipe) { - + List collect = RecipeApplier.applyRecipeOn(ItemHandlerHelper.copyStackWithSize(transported.stack, 1), recipe) .stream() @@ -113,7 +113,7 @@ public class BeltDeployerCallbacks { .collect(Collectors.toList()); blockEntity.award(AllAdvancements.DEPLOYER); - + TransportedItemStack left = transported.copy(); blockEntity.player.spawnedItemEffects = transported.stack.copy(); left.stack.shrink(1); @@ -128,8 +128,9 @@ public class BeltDeployerCallbacks { } ItemStack heldItem = blockEntity.player.getMainHandItem(); - boolean unbreakable = heldItem.hasTag() && heldItem.getTag() - .getBoolean("Unbreakable"); + boolean unbreakable = heldItem.hasTag() && ( + heldItem.getTag().getBoolean("Unbreakable") || + heldItem.getTag().getString("Modifier").equals("forbidden_arcanus:eternal")); // Forbidden Arcanus Compat, See Creators-of-Create#6220 boolean keepHeld = recipe instanceof ItemApplicationRecipe && ((ItemApplicationRecipe) recipe).shouldKeepHeldItem(); From efb3cf490d6552ee1c2e7fbf2c1dd077dd5d88c2 Mon Sep 17 00:00:00 2001 From: Jay Turner Date: Fri, 22 Mar 2024 13:38:56 +0000 Subject: [PATCH 5/6] Add null-safety check on usage of BlockEntity.loadStatic (#6224) --- .../create/foundation/utility/BlockHelper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java index 6435dbd49..4d229b2a5 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -298,10 +298,12 @@ public class BlockHelper { if (data != null) { if (existingBlockEntity instanceof IMergeableBE mergeable) { BlockEntity loaded = BlockEntity.loadStatic(target, state, data); - if (existingBlockEntity.getType() - .equals(loaded.getType())) { - mergeable.accept(loaded); - return; + if (loaded != null) { + if (existingBlockEntity.getType() + .equals(loaded.getType())) { + mergeable.accept(loaded); + return; + } } } BlockEntity blockEntity = world.getBlockEntity(target); From d66170c8fed5d02ad46f44fd0e66685be88a3170 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 22 Mar 2024 09:45:41 -0400 Subject: [PATCH 6/6] fix: Schematicannon request wrong blocks (#5830) * fix: schematics request tall grass block which is unobtainable (#5814) * fix: give large ferns the same treatment * remove unused imports * comments * fix requirement for farmers delight rich soil --- .../schematics/requirement/ItemRequirement.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java b/src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java index 6b07940dc..eb2045b62 100644 --- a/src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java +++ b/src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java @@ -6,8 +6,10 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.simibubi.create.foundation.data.recipe.Mods; import com.simibubi.create.foundation.utility.NBTProcessors; +import net.minecraft.core.Registry; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.decoration.ItemFrame; @@ -94,10 +96,19 @@ public class ItemRequirement { if (block instanceof SnowLayerBlock) return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SnowLayerBlock.LAYERS) .intValue())); + // FD's rich soil extends FarmBlock so this is to make sure the cost is correct (it should be rich soil not dirt) + if (block == Registry.BLOCK.get(Mods.FD.asResource("rich_soil_farmland"))) + return new ItemRequirement(ItemUseType.CONSUME, Registry.ITEM.get(Mods.FD.asResource("rich_soil"))); if (block instanceof FarmBlock || block instanceof DirtPathBlock) return new ItemRequirement(ItemUseType.CONSUME, Items.DIRT); if (block instanceof AbstractBannerBlock && be instanceof BannerBlockEntity bannerBE) return new ItemRequirement(new StrictNbtStackRequirement(bannerBE.getItem(), ItemUseType.CONSUME)); + // Tall grass doesnt exist as a block so use 2 grass blades + if (block == Blocks.TALL_GRASS) + return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(Items.GRASS, 2)); + // Large ferns don't exist as blocks so use 2 ferns instead + if (block == Blocks.LARGE_FERN) + return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(Items.FERN, 2)); return new ItemRequirement(ItemUseType.CONSUME, item); }