diff --git a/build.gradle b/build.gradle index 59d59a6f0..67903fa11 100644 --- a/build.gradle +++ b/build.gradle @@ -208,6 +208,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/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; + } } } 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(); 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); } 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) { 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) 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);