Skip to content

Commit a9ec38d

Browse files
authored
Merge branch 'Creators-of-Create:mc1.18/dev' into mc1.18/dev
2 parents 9072693 + d66170c commit a9ec38d

File tree

7 files changed

+59
-22
lines changed

7 files changed

+59
-22
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ dependencies {
204204
// runtimeOnly fg.deobf("maven.modrinth:rubidium:0.5.3")
205205
// implementation fg.deobf("com.railwayteam.railways:railways-1.18.2-1.1.1:all") { transitive = false }
206206
// runtimeOnly fg.deobf("maven.modrinth:spark:1.10.38-forge")
207+
//runtimeOnly fg.deobf("curse.maven:forbidden-arcanus-309858:4729924")
208+
//runtimeOnly fg.deobf("curse.maven:valhelsia-core-416935:3886212")
207209

208210
// https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
209211
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings

src/main/java/com/simibubi/create/content/decoration/copycat/CopycatStepBlock.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import com.simibubi.create.AllBlocks;
66
import com.simibubi.create.AllShapes;
7+
import com.simibubi.create.content.kinetics.steamEngine.PoweredShaftBlock;
78
import com.simibubi.create.foundation.placement.IPlacementHelper;
89
import com.simibubi.create.foundation.placement.PlacementHelpers;
10+
import com.simibubi.create.foundation.placement.PlacementOffset;
911
import com.simibubi.create.foundation.placement.PoleHelper;
1012
import com.simibubi.create.foundation.utility.Iterate;
1113
import com.simibubi.create.foundation.utility.VoxelShaper;
@@ -36,6 +38,8 @@
3638
import net.minecraft.world.phys.shapes.CollisionContext;
3739
import net.minecraft.world.phys.shapes.VoxelShape;
3840

41+
import org.jetbrains.annotations.NotNull;
42+
3943
public class CopycatStepBlock extends WaterloggedCopycatBlock {
4044

4145
public static final EnumProperty<Half> HALF = BlockStateProperties.HALF;
@@ -134,7 +138,7 @@ public boolean canFaceBeOccluded(BlockState state, Direction face) {
134138
return (state.getValue(HALF) == Half.TOP) == (face == Direction.UP);
135139
return state.getValue(FACING) == face;
136140
}
137-
141+
138142
@Override
139143
public boolean shouldFaceAlwaysRender(BlockState state, Direction face) {
140144
return canFaceBeOccluded(state, face.getOpposite());
@@ -222,10 +226,21 @@ public PlacementHelper() {
222226
}
223227

224228
@Override
225-
public Predicate<ItemStack> getItemPredicate() {
229+
public @NotNull Predicate<ItemStack> getItemPredicate() {
226230
return AllBlocks.COPYCAT_STEP::isIn;
227231
}
228232

233+
@Override
234+
public @NotNull PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos,
235+
BlockHitResult ray) {
236+
PlacementOffset offset = super.getOffset(player, world, state, pos, ray);
237+
238+
if (offset.isSuccessful())
239+
offset.withTransform(offset.getTransform()
240+
.andThen(s -> s.setValue(HALF, state.getValue(HALF))));
241+
242+
return offset;
243+
}
229244
}
230245

231246
}

src/main/java/com/simibubi/create/content/kinetics/deployer/BeltDeployerCallbacks.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static ProcessingResult whenItemHeld(TransportedItemStack s, TransportedI
9494

9595
public static void activate(TransportedItemStack transported, TransportedItemStackHandlerBehaviour handler,
9696
DeployerBlockEntity blockEntity, Recipe<?> recipe) {
97-
97+
9898
List<TransportedItemStack> collect =
9999
RecipeApplier.applyRecipeOn(ItemHandlerHelper.copyStackWithSize(transported.stack, 1), recipe)
100100
.stream()
@@ -113,7 +113,7 @@ public static void activate(TransportedItemStack transported, TransportedItemSta
113113
.collect(Collectors.toList());
114114

115115
blockEntity.award(AllAdvancements.DEPLOYER);
116-
116+
117117
TransportedItemStack left = transported.copy();
118118
blockEntity.player.spawnedItemEffects = transported.stack.copy();
119119
left.stack.shrink(1);
@@ -128,8 +128,9 @@ public static void activate(TransportedItemStack transported, TransportedItemSta
128128
}
129129

130130
ItemStack heldItem = blockEntity.player.getMainHandItem();
131-
boolean unbreakable = heldItem.hasTag() && heldItem.getTag()
132-
.getBoolean("Unbreakable");
131+
boolean unbreakable = heldItem.hasTag() && (
132+
heldItem.getTag().getBoolean("Unbreakable") ||
133+
heldItem.getTag().getString("Modifier").equals("forbidden_arcanus:eternal")); // Forbidden Arcanus Compat, See Creators-of-Create#6220
133134
boolean keepHeld =
134135
recipe instanceof ItemApplicationRecipe && ((ItemApplicationRecipe) recipe).shouldKeepHeldItem();
135136

src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
import java.util.stream.Collectors;
77
import java.util.stream.Stream;
88

9+
import com.simibubi.create.foundation.data.recipe.Mods;
910
import com.simibubi.create.foundation.utility.NBTProcessors;
1011

12+
import net.minecraft.core.Registry;
1113
import net.minecraft.world.entity.Entity;
1214
import net.minecraft.world.entity.decoration.ArmorStand;
1315
import net.minecraft.world.entity.decoration.ItemFrame;
@@ -94,10 +96,19 @@ private static ItemRequirement defaultOf(BlockState state, BlockEntity be) {
9496
if (block instanceof SnowLayerBlock)
9597
return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SnowLayerBlock.LAYERS)
9698
.intValue()));
99+
// FD's rich soil extends FarmBlock so this is to make sure the cost is correct (it should be rich soil not dirt)
100+
if (block == Registry.BLOCK.get(Mods.FD.asResource("rich_soil_farmland")))
101+
return new ItemRequirement(ItemUseType.CONSUME, Registry.ITEM.get(Mods.FD.asResource("rich_soil")));
97102
if (block instanceof FarmBlock || block instanceof DirtPathBlock)
98103
return new ItemRequirement(ItemUseType.CONSUME, Items.DIRT);
99104
if (block instanceof AbstractBannerBlock && be instanceof BannerBlockEntity bannerBE)
100105
return new ItemRequirement(new StrictNbtStackRequirement(bannerBE.getItem(), ItemUseType.CONSUME));
106+
// Tall grass doesnt exist as a block so use 2 grass blades
107+
if (block == Blocks.TALL_GRASS)
108+
return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(Items.GRASS, 2));
109+
// Large ferns don't exist as blocks so use 2 ferns instead
110+
if (block == Blocks.LARGE_FERN)
111+
return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(Items.FERN, 2));
101112

102113
return new ItemRequirement(ItemUseType.CONSUME, item);
103114
}

src/main/java/com/simibubi/create/content/trains/bogey/AbstractBogeyBlock.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,21 @@ public final InteractionResult use(BlockState state, Level level, BlockPos pos,
227227
sbbe.setBogeyData(sbbe.getBogeyData().merge(defaultData));
228228

229229
if (size == getSize()) {
230+
if (state.getBlock() != style.getBlockOfSize(size)) {
231+
CompoundTag oldData = sbbe.getBogeyData();
232+
level.setBlock(pos, copyProperties(state, getStateOfSize(sbbe, size)), Block.UPDATE_ALL);
233+
if (!(level.getBlockEntity(pos) instanceof AbstractBogeyBlockEntity bogeyBlockEntity))
234+
return InteractionResult.FAIL;
235+
bogeyBlockEntity.setBogeyData(oldData);
236+
}
230237
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style")
231238
.append(": ").append(style.displayName), true);
232239
} else {
233240
CompoundTag oldData = sbbe.getBogeyData();
234-
level.setBlock(pos, this.getStateOfSize(sbbe, size), 3);
235-
BlockEntity newBlockEntity = level.getBlockEntity(pos);
236-
if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newBlockEntity1))
241+
level.setBlock(pos, this.getStateOfSize(sbbe, size), Block.UPDATE_ALL);
242+
if (!(level.getBlockEntity(pos) instanceof AbstractBogeyBlockEntity bogeyBlockEntity))
237243
return InteractionResult.FAIL;
238-
newBlockEntity1.setBogeyData(oldData);
244+
bogeyBlockEntity.setBogeyData(oldData);
239245
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size")
240246
.append(": ").append(style.displayName), true);
241247
}
@@ -312,18 +318,18 @@ private BlockState copyProperties(BlockState source, BlockState target) {
312318
return target;
313319
}
314320

315-
public BlockState getNextSize(AbstractBogeyBlockEntity sbte) {
321+
public BlockState getNextSize(AbstractBogeyBlockEntity sbbe) {
316322
BogeySizes.BogeySize size = this.getSize();
317-
BogeyStyle style = sbte.getStyle();
323+
BogeyStyle style = sbbe.getStyle();
318324
BlockState nextBlock = style.getNextBlock(size).defaultBlockState();
319-
nextBlock = copyProperties(sbte.getBlockState(), nextBlock);
325+
nextBlock = copyProperties(sbbe.getBlockState(), nextBlock);
320326
return nextBlock;
321327
}
322328

323-
public BlockState getStateOfSize(AbstractBogeyBlockEntity sbte, BogeySizes.BogeySize size) {
324-
BogeyStyle style = sbte.getStyle();
329+
public BlockState getStateOfSize(AbstractBogeyBlockEntity sbbe, BogeySizes.BogeySize size) {
330+
BogeyStyle style = sbbe.getStyle();
325331
BlockState state = style.getBlockOfSize(size).defaultBlockState();
326-
return copyProperties(sbte.getBlockState(), state);
332+
return copyProperties(sbbe.getBlockState(), state);
327333
}
328334

329335
public BogeyStyle getNextStyle(Level level, BlockPos pos) {

src/main/java/com/simibubi/create/content/trains/track/TrackPlacement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import net.minecraft.nbt.CompoundTag;
3434
import net.minecraft.nbt.NbtUtils;
3535
import net.minecraft.nbt.Tag;
36+
import net.minecraft.tags.BlockTags;
3637
import net.minecraft.util.Mth;
3738
import net.minecraft.world.InteractionHand;
3839
import net.minecraft.world.entity.player.Inventory;
@@ -508,8 +509,7 @@ private static PlacementInfo placeTracks(Level level, PlacementInfo info, BlockS
508509
// copy over all shared properties from the shaped state to the correct track material block
509510
BlockState toPlace = BlockHelper.copyProperties(state, info.trackMaterial.getBlock().defaultBlockState());
510511

511-
boolean canPlace = stateAtPos.getMaterial()
512-
.isReplaceable();
512+
boolean canPlace = stateAtPos.getMaterial().isReplaceable() || stateAtPos.is(BlockTags.FLOWERS);
513513
if (canPlace)
514514
info.requiredTracks++;
515515
if (simulate)

src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,12 @@ else if (state.is(BlockTags.CAULDRONS))
298298
if (data != null) {
299299
if (existingBlockEntity instanceof IMergeableBE mergeable) {
300300
BlockEntity loaded = BlockEntity.loadStatic(target, state, data);
301-
if (existingBlockEntity.getType()
302-
.equals(loaded.getType())) {
303-
mergeable.accept(loaded);
304-
return;
301+
if (loaded != null) {
302+
if (existingBlockEntity.getType()
303+
.equals(loaded.getType())) {
304+
mergeable.accept(loaded);
305+
return;
306+
}
305307
}
306308
}
307309
BlockEntity blockEntity = world.getBlockEntity(target);

0 commit comments

Comments
 (0)