Merge branch 'Creators-of-Create:mc1.18/dev' into mc1.18/mmc-1

This commit is contained in:
attackeight 2024-04-15 20:41:14 -04:00 committed by GitHub
commit 5277d5971d
Failed to generate hash of commit
7 changed files with 59 additions and 22 deletions

View file

@ -208,6 +208,8 @@ dependencies {
// runtimeOnly fg.deobf("maven.modrinth:rubidium:0.5.3") // 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 } // 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("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 // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings

View file

@ -4,8 +4,10 @@ import java.util.function.Predicate;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; 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.IPlacementHelper;
import com.simibubi.create.foundation.placement.PlacementHelpers; 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.placement.PoleHelper;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.VoxelShaper; 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.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.NotNull;
public class CopycatStepBlock extends WaterloggedCopycatBlock { public class CopycatStepBlock extends WaterloggedCopycatBlock {
public static final EnumProperty<Half> HALF = BlockStateProperties.HALF; public static final EnumProperty<Half> HALF = BlockStateProperties.HALF;
@ -222,10 +226,21 @@ public class CopycatStepBlock extends WaterloggedCopycatBlock {
} }
@Override @Override
public Predicate<ItemStack> getItemPredicate() { public @NotNull Predicate<ItemStack> getItemPredicate() {
return AllBlocks.COPYCAT_STEP::isIn; 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;
}
} }
} }

View file

@ -128,8 +128,9 @@ public class BeltDeployerCallbacks {
} }
ItemStack heldItem = blockEntity.player.getMainHandItem(); ItemStack heldItem = blockEntity.player.getMainHandItem();
boolean unbreakable = heldItem.hasTag() && heldItem.getTag() boolean unbreakable = heldItem.hasTag() && (
.getBoolean("Unbreakable"); heldItem.getTag().getBoolean("Unbreakable") ||
heldItem.getTag().getString("Modifier").equals("forbidden_arcanus:eternal")); // Forbidden Arcanus Compat, See Creators-of-Create#6220
boolean keepHeld = boolean keepHeld =
recipe instanceof ItemApplicationRecipe && ((ItemApplicationRecipe) recipe).shouldKeepHeldItem(); recipe instanceof ItemApplicationRecipe && ((ItemApplicationRecipe) recipe).shouldKeepHeldItem();

View file

@ -6,8 +6,10 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.simibubi.create.foundation.data.recipe.Mods;
import com.simibubi.create.foundation.utility.NBTProcessors; import com.simibubi.create.foundation.utility.NBTProcessors;
import net.minecraft.core.Registry;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.decoration.ArmorStand;
import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.decoration.ItemFrame;
@ -94,10 +96,19 @@ public class ItemRequirement {
if (block instanceof SnowLayerBlock) if (block instanceof SnowLayerBlock)
return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SnowLayerBlock.LAYERS) return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SnowLayerBlock.LAYERS)
.intValue())); .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) if (block instanceof FarmBlock || block instanceof DirtPathBlock)
return new ItemRequirement(ItemUseType.CONSUME, Items.DIRT); return new ItemRequirement(ItemUseType.CONSUME, Items.DIRT);
if (block instanceof AbstractBannerBlock && be instanceof BannerBlockEntity bannerBE) if (block instanceof AbstractBannerBlock && be instanceof BannerBlockEntity bannerBE)
return new ItemRequirement(new StrictNbtStackRequirement(bannerBE.getItem(), ItemUseType.CONSUME)); 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); return new ItemRequirement(ItemUseType.CONSUME, item);
} }

View file

@ -227,15 +227,21 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
sbbe.setBogeyData(sbbe.getBogeyData().merge(defaultData)); sbbe.setBogeyData(sbbe.getBogeyData().merge(defaultData));
if (size == getSize()) { 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") player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style")
.append(": ").append(style.displayName), true); .append(": ").append(style.displayName), true);
} else { } else {
CompoundTag oldData = sbbe.getBogeyData(); CompoundTag oldData = sbbe.getBogeyData();
level.setBlock(pos, this.getStateOfSize(sbbe, size), 3); level.setBlock(pos, this.getStateOfSize(sbbe, size), Block.UPDATE_ALL);
BlockEntity newBlockEntity = level.getBlockEntity(pos); if (!(level.getBlockEntity(pos) instanceof AbstractBogeyBlockEntity bogeyBlockEntity))
if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newBlockEntity1))
return InteractionResult.FAIL; return InteractionResult.FAIL;
newBlockEntity1.setBogeyData(oldData); bogeyBlockEntity.setBogeyData(oldData);
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size") player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size")
.append(": ").append(style.displayName), true); .append(": ").append(style.displayName), true);
} }
@ -312,18 +318,18 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> ext
return target; return target;
} }
public BlockState getNextSize(AbstractBogeyBlockEntity sbte) { public BlockState getNextSize(AbstractBogeyBlockEntity sbbe) {
BogeySizes.BogeySize size = this.getSize(); BogeySizes.BogeySize size = this.getSize();
BogeyStyle style = sbte.getStyle(); BogeyStyle style = sbbe.getStyle();
BlockState nextBlock = style.getNextBlock(size).defaultBlockState(); BlockState nextBlock = style.getNextBlock(size).defaultBlockState();
nextBlock = copyProperties(sbte.getBlockState(), nextBlock); nextBlock = copyProperties(sbbe.getBlockState(), nextBlock);
return nextBlock; return nextBlock;
} }
public BlockState getStateOfSize(AbstractBogeyBlockEntity sbte, BogeySizes.BogeySize size) { public BlockState getStateOfSize(AbstractBogeyBlockEntity sbbe, BogeySizes.BogeySize size) {
BogeyStyle style = sbte.getStyle(); BogeyStyle style = sbbe.getStyle();
BlockState state = style.getBlockOfSize(size).defaultBlockState(); BlockState state = style.getBlockOfSize(size).defaultBlockState();
return copyProperties(sbte.getBlockState(), state); return copyProperties(sbbe.getBlockState(), state);
} }
public BogeyStyle getNextStyle(Level level, BlockPos pos) { public BogeyStyle getNextStyle(Level level, BlockPos pos) {

View file

@ -33,6 +33,7 @@ import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Inventory; 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 // copy over all shared properties from the shaped state to the correct track material block
BlockState toPlace = BlockHelper.copyProperties(state, info.trackMaterial.getBlock().defaultBlockState()); BlockState toPlace = BlockHelper.copyProperties(state, info.trackMaterial.getBlock().defaultBlockState());
boolean canPlace = stateAtPos.getMaterial() boolean canPlace = stateAtPos.getMaterial().isReplaceable() || stateAtPos.is(BlockTags.FLOWERS);
.isReplaceable();
if (canPlace) if (canPlace)
info.requiredTracks++; info.requiredTracks++;
if (simulate) if (simulate)

View file

@ -298,12 +298,14 @@ public class BlockHelper {
if (data != null) { if (data != null) {
if (existingBlockEntity instanceof IMergeableBE mergeable) { if (existingBlockEntity instanceof IMergeableBE mergeable) {
BlockEntity loaded = BlockEntity.loadStatic(target, state, data); BlockEntity loaded = BlockEntity.loadStatic(target, state, data);
if (loaded != null) {
if (existingBlockEntity.getType() if (existingBlockEntity.getType()
.equals(loaded.getType())) { .equals(loaded.getType())) {
mergeable.accept(loaded); mergeable.accept(loaded);
return; return;
} }
} }
}
BlockEntity blockEntity = world.getBlockEntity(target); BlockEntity blockEntity = world.getBlockEntity(target);
if (blockEntity != null) { if (blockEntity != null) {
data.putInt("x", target.getX()); data.putInt("x", target.getX());