Compare commits

...

9 commits

Author SHA1 Message Date
IThundxr 9dc23b5942
Merge 3ae2f8ecfe into d66170c8fe 2024-05-02 23:36:36 +00:00
IThundxr 3ae2f8ecfe
fix comment 2024-05-02 19:35:37 -04:00
IThundxr 8151850ab2
fix comment 2024-05-02 19:15:39 -04:00
IThundxr d66170c8fe
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
2024-03-22 14:45:41 +01:00
Jay Turner efb3cf490d
Add null-safety check on usage of BlockEntity.loadStatic (#6224) 2024-03-22 14:38:56 +01:00
attackeight 6802a1316b
Respect 'eternal' modifier from Forbidden and Arcanus in Deployer Recipes (#6231)
- We Could be Immortal
 - Fixes Creators-of-Create#6220
2024-03-22 14:35:10 +01:00
IThundxr 51db53c74f
Fix Copycat step placement helper (#6267) 2024-03-22 14:27:35 +01:00
IThundxr 41f957a94d
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
2024-03-22 14:23:20 +01:00
IThundxr 7d3d4a1e7c
feat: Track Placement breaks flowers (#5821)
* feat: tracks break flowers during placement

* chore: cleanup import
2024-03-21 12:09:24 +01:00
8 changed files with 61 additions and 24 deletions

View file

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

View file

@ -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> 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<ItemStack> getItemPredicate() {
public @NotNull Predicate<ItemStack> 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;
}
}
}

View file

@ -94,7 +94,7 @@ public class BeltDeployerCallbacks {
public static void activate(TransportedItemStack transported, TransportedItemStackHandlerBehaviour handler,
DeployerBlockEntity blockEntity, Recipe<?> recipe) {
List<TransportedItemStack> 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();

View file

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

View file

@ -227,15 +227,21 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> 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<T extends AbstractBogeyBlockEntity> 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) {

View file

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

View file

@ -99,7 +99,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
}
// involves block step sounds on contraptions
// IFNE line 661 injecting before `!blockstate.isAir(this.world, blockpos)`
// IFNE line 736 injecting before `!blockstate1.isAir()`
@Inject(method = "move", at = @At(value = "JUMP", opcode = Opcodes.IFNE, ordinal = 7))
private void create$contraptionStepSounds(MoverType mover, Vec3 movement, CallbackInfo ci) {
Vec3 worldPos = position.add(0, -0.2, 0);
@ -136,7 +136,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
if (info == null)
return false;
cEntity.registerColliding(self);
return true;
});

View file

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