Merge branch 'mc1.18/dev' into mc1.19/dev

This commit is contained in:
simibubi 2024-08-25 19:51:28 +02:00
commit 0f0e00c781
23 changed files with 138 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -1,4 +1,4 @@
<p align="center"><img src="https://i.imgur.com/SXaePW6.png" alt="Logo" width="200"></p>
<p align="center"><img src="./.idea/icon.png" alt="Logo" width="200"></p>
<h1 align="center">Create <br>
<a href="https://www.patreon.com/simibubi"><img src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dsimibubi%26type%3Dpatrons&style=flat&label=Supporters&color=ff5733" alt="Patreon"></a>
<a href="https://www.curseforge.com/minecraft/mc-mods/create/files"><img src="https://cf.way2muchnoise.eu/versions/328085(c70039).svg" alt="Supported Versions"></a>

View File

@ -23,7 +23,7 @@ use_parchment = true
# dependency versions
registrate_version = MC1.19-1.1.5
flywheel_minecraft_version = 1.19.2
flywheel_version = 0.6.10-20
flywheel_version = 0.6.10-21
jei_minecraft_version = 1.19.2
jei_version = 11.6.0.1024
curios_minecraft_version = 1.19.2

View File

@ -18,6 +18,7 @@ import com.simibubi.create.foundation.advancement.AllAdvancements;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import com.simibubi.create.foundation.blockEntity.behaviour.CenteredSideValueBoxTransform;
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.infrastructure.config.AllConfigs;
@ -194,28 +195,42 @@ public class PulleyBlockEntity extends LinearActuatorBlockEntity implements Thre
if (offset > 0) {
BlockPos magnetPos = worldPosition.below((int) offset);
FluidState ifluidstate = level.getFluidState(magnetPos);
level.destroyBlock(magnetPos, level.getBlockState(magnetPos)
.getCollisionShape(level, magnetPos)
.isEmpty());
level.setBlock(magnetPos, AllBlocks.PULLEY_MAGNET.getDefaultState()
.setValue(BlockStateProperties.WATERLOGGED,
Boolean.valueOf(ifluidstate.getType() == Fluids.WATER)),
66);
if (level.getBlockState(magnetPos)
.getDestroySpeed(level, magnetPos) != -1) {
level.destroyBlock(magnetPos, level.getBlockState(magnetPos)
.getCollisionShape(level, magnetPos)
.isEmpty());
level.setBlock(magnetPos, AllBlocks.PULLEY_MAGNET.getDefaultState()
.setValue(BlockStateProperties.WATERLOGGED,
Boolean.valueOf(ifluidstate.getType() == Fluids.WATER)),
66);
}
}
boolean[] waterlog = new boolean[(int) offset];
for (int i = 1; i <= ((int) offset) - 1; i++) {
BlockPos ropePos = worldPosition.below(i);
FluidState ifluidstate = level.getFluidState(ropePos);
waterlog[i] = ifluidstate.getType() == Fluids.WATER;
level.destroyBlock(ropePos, level.getBlockState(ropePos)
.getCollisionShape(level, ropePos)
.isEmpty());
for (boolean destroyPass : Iterate.trueAndFalse) {
for (int i = 1; i <= ((int) offset) - 1; i++) {
BlockPos ropePos = worldPosition.below(i);
if (level.getBlockState(ropePos)
.getDestroySpeed(level, ropePos) == -1)
continue;
if (destroyPass) {
FluidState ifluidstate = level.getFluidState(ropePos);
waterlog[i] = ifluidstate.getType() == Fluids.WATER;
level.destroyBlock(ropePos, level.getBlockState(ropePos)
.getCollisionShape(level, ropePos)
.isEmpty());
continue;
}
level.setBlock(worldPosition.below(i), AllBlocks.ROPE.getDefaultState()
.setValue(BlockStateProperties.WATERLOGGED, waterlog[i]), 66);
}
}
for (int i = 1; i <= ((int) offset) - 1; i++)
level.setBlock(worldPosition.below(i), AllBlocks.ROPE.getDefaultState()
.setValue(BlockStateProperties.WATERLOGGED, waterlog[i]), 66);
}
if (movedContraption != null && mirrorParent == null)

View File

@ -37,6 +37,7 @@ import net.minecraft.world.level.block.CampfireBlock;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.AABB;
@ -188,6 +189,8 @@ public class OpenEndedPipe extends FlowSource {
return false;
if (fluid.isEmpty())
return false;
if (!(fluid.getFluid() instanceof FlowingFluid))
return false;
if (!FluidHelper.hasBlockState(fluid.getFluid()))
return true;

View File

@ -60,6 +60,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
@ -304,12 +305,24 @@ public class BeltBlock extends HorizontalKineticBlock
if (AllBlocks.BRASS_CASING.isIn(heldItem)) {
withBlockEntityDo(world, pos, be -> be.setCasingType(CasingType.BRASS));
updateCoverProperty(world, pos, world.getBlockState(pos));
SoundType soundType = AllBlocks.BRASS_CASING.getDefaultState()
.getSoundType(world, pos, player);
world.playSound(null, pos, soundType.getPlaceSound(), SoundSource.BLOCKS,
(soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);
return InteractionResult.SUCCESS;
}
if (AllBlocks.ANDESITE_CASING.isIn(heldItem)) {
withBlockEntityDo(world, pos, be -> be.setCasingType(CasingType.ANDESITE));
updateCoverProperty(world, pos, world.getBlockState(pos));
SoundType soundType = AllBlocks.ANDESITE_CASING.getDefaultState()
.getSoundType(world, pos, player);
world.playSound(null, pos, soundType.getPlaceSound(), SoundSource.BLOCKS,
(soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);
return InteractionResult.SUCCESS;
}

View File

@ -187,6 +187,8 @@ public class BeltBlockEntity extends KineticBlockEntity {
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
if (!isItemHandlerCap(cap))
return super.getCapability(cap, side);
if (!BeltBlock.canTransportObjects(getBlockState()))
return super.getCapability(cap, side);
if (!isRemoved() && !itemHandler.isPresent())
initializeItemHandler();
return itemHandler.cast();
@ -488,6 +490,8 @@ public class BeltBlockEntity extends KineticBlockEntity {
ItemStack inserted = transportedStack.stack;
ItemStack empty = ItemStack.EMPTY;
if (!BeltBlock.canTransportObjects(getBlockState()))
return inserted;
if (nextBeltController == null)
return inserted;
BeltInventory nextInventory = nextBeltController.getInventory();

View File

@ -300,8 +300,8 @@ public class DeployerHandler {
return;
if (useItem == DENY)
return;
if (item instanceof BlockItem && !(item instanceof CartAssemblerBlockItem)
&& !clickedState.canBeReplaced(new BlockPlaceContext(itemusecontext)))
if (item instanceof CartAssemblerBlockItem
&& clickedState.canBeReplaced(new BlockPlaceContext(itemusecontext)))
return;
// Reposition fire placement for convenience

View File

@ -73,6 +73,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
return;
activate(context, pos, player, mode);
checkForTrackPlacementAdvancement(context, player);
tryDisposeOfExcess(context);
context.stall = player.blockBreakingProgress != null;
}
@ -80,9 +81,13 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) {
Level world = context.world;
player.placedTracks = false;
FilterItemStack filter = context.getFilterFromBE();
if (AllItems.SCHEMATIC.isIn(filter.item()))
if (AllItems.SCHEMATIC.isIn(filter.item())) {
activateAsSchematicPrinter(context, pos, player, world, filter.item());
return;
}
Vec3 facingVec = Vec3.atLowerCornerOf(context.state.getValue(DeployerBlock.FACING)
.getNormal());
@ -101,13 +106,14 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
player.setYRot(AbstractContraptionEntity.yawFromVector(facingVec));
player.setXRot(xRot);
player.placedTracks = false;
DeployerHandler.activate(player, vec, pos, facingVec, mode);
}
protected void checkForTrackPlacementAdvancement(MovementContext context, DeployerFakePlayer player) {
if ((context.contraption instanceof MountedContraption || context.contraption instanceof CarriageContraption)
&& player.placedTracks && context.blockEntityData != null && context.blockEntityData.contains("Owner"))
AllAdvancements.SELF_DEPLOYING.awardTo(world.getPlayerByUUID(context.blockEntityData.getUUID("Owner")));
AllAdvancements.SELF_DEPLOYING.awardTo(context.world.getPlayerByUUID(context.blockEntityData.getUUID("Owner")));
}
protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player,
@ -141,7 +147,7 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
if (!context.contraption.hasUniversalCreativeCrate) {
IItemHandler itemHandler = context.contraption.getSharedInventory();
for (ItemRequirement.StackRequirement required : requiredItems) {
ItemStack stack= ItemHelper
ItemStack stack = ItemHelper
.extract(itemHandler, required::matches, ExtractionCountMode.EXACTLY,
required.stack.getCount(), true);
if (stack.isEmpty())
@ -155,8 +161,11 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
CompoundTag data = BlockHelper.prepareBlockEntityData(blockState, schematicWorld.getBlockEntity(pos));
BlockSnapshot blocksnapshot = BlockSnapshot.create(world.dimension(), world, pos);
BlockHelper.placeSchematicBlock(world, blockState, pos, contextStack, data);
if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP))
blocksnapshot.restore(true, false);
else if (AllBlocks.TRACK.has(blockState))
player.placedTracks = true;
}
@Override

View File

@ -10,6 +10,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.belt.BeltBlock;
import com.simibubi.create.content.kinetics.belt.BeltBlockEntity;
import com.simibubi.create.content.kinetics.belt.BeltHelper;
import com.simibubi.create.content.kinetics.belt.behaviour.TransportedItemStackHandlerBehaviour;
@ -114,7 +115,7 @@ public class AllArmInteractionPointTypes {
@Override
public boolean canCreatePoint(Level level, BlockPos pos, BlockState state) {
return AllBlocks.BELT.has(state) && !(level.getBlockState(pos.above())
.getBlock() instanceof BeltTunnelBlock);
.getBlock() instanceof BeltTunnelBlock) && BeltBlock.canTransportObjects(state);
}
@Override

View File

@ -18,6 +18,7 @@ import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
@ -168,5 +169,10 @@ public class LargeWaterWheelBlock extends RotatedPillarKineticBlock implements I
public static Couple<Integer> getSpeedRange() {
return Couple.create(4, 4);
}
@Override
public boolean isFlammable(BlockState state, BlockGetter level, BlockPos pos, Direction direction) {
return false;
}
}

View File

@ -18,6 +18,7 @@ import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
@ -129,5 +130,10 @@ public class WaterWheelBlock extends DirectionalKineticBlock implements IBE<Wate
public static Couple<Integer> getSpeedRange() {
return Couple.create(8, 8);
}
@Override
public boolean isFlammable(BlockState state, BlockGetter level, BlockPos pos, Direction direction) {
return false;
}
}

View File

@ -112,8 +112,10 @@ public class SchematicHandler implements IGuiOverlay {
if (!active || !stack.getTag()
.getString("File")
.equals(displayedSchematic))
.equals(displayedSchematic)) {
renderers.forEach(r -> r.setActive(false));
init(player, stack);
}
if (!active)
return;

View File

@ -111,7 +111,7 @@ public class FlapDisplayBlockEntity extends KineticBlockEntity {
if ((!level.isClientSide || !isRunning) && !isVirtual())
return;
int activeFlaps = 0;
boolean instant = getSpeed() > 128;
boolean instant = Math.abs(getSpeed()) > 128;
for (FlapDisplayLayout line : lines)
for (FlapDisplaySection section : line.getSections())
activeFlaps += section.tick(instant);

View File

@ -0,0 +1,29 @@
package com.simibubi.create.foundation.mixin;
import com.simibubi.create.content.kinetics.deployer.DeployerFakePlayer;
import com.simibubi.create.foundation.mixin.accessor.UseOnContextAccessor;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(BlockItem.class)
public class BlockItemMixin {
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
private void create$fixDeployerPlacement(BlockPlaceContext pContext, CallbackInfoReturnable<InteractionResult> cir) {
BlockState state = pContext.getLevel().getBlockState(((UseOnContextAccessor) pContext).create$getHitResult().getBlockPos());
if (state != Blocks.AIR.defaultBlockState() && pContext.getPlayer() instanceof DeployerFakePlayer) {
cir.setReturnValue(InteractionResult.PASS);
}
}
}

View File

@ -0,0 +1,14 @@
package com.simibubi.create.foundation.mixin.accessor;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.phys.BlockHitResult;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(UseOnContext.class)
public interface UseOnContextAccessor {
@Invoker("getHitResult")
BlockHitResult create$getHitResult();
}

View File

@ -78,7 +78,7 @@ public class DebugInformation {
.put("Flywheel Backend", () -> Backend.getBackendType().toString())
.put("OpenGL Renderer", GlUtil::getRenderer)
.put("OpenGL Version", GlUtil::getOpenGLVersion)
.put("Graphics Mode", () -> Minecraft.getInstance().options.graphicsMode().toString())
.put("Graphics Mode", () -> Minecraft.getInstance().options.graphicsMode().get().getKey())
.buildTo(DebugInformation::registerClientInfo);
});

View File

@ -108,6 +108,8 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
.render(ms);
ms.popPose();
}
RenderSystem.enableBlend();
ms.pushPose();
ms.translate(width / 2 - 32, 32, -10);

View File

@ -5,12 +5,12 @@ license="MIT"
[[mods]]
modId="create"
# The Implementation-Version property in the jar's MANIFEST.MF file will be used as the mod version at runtime
# The Implementation-Version property in the jar's MANIFEST.MF file will be used as the mod version at runtime
version="${file.jarVersion}"
displayName="Create"
#updateJSONURL=""
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"
logoFile="logo.png"
logoFile="icon.png"
#credits=""
authors="simibubi"
description='''

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View File

@ -6,6 +6,7 @@
"compatibilityLevel": "JAVA_17",
"refmap": "create.refmap.json",
"mixins": [
"BlockItemMixin",
"ClientboundMapItemDataPacketMixin",
"ContraptionDriverInteractMixin",
"CustomItemUseEffectsMixin",
@ -22,7 +23,8 @@
"accessor.LivingEntityAccessor",
"accessor.NbtAccounterAccessor",
"accessor.ServerLevelAccessor",
"accessor.SystemReportAccessor"
"accessor.SystemReportAccessor",
"accessor.UseOnContextAccessor"
],
"client": [
"accessor.AgeableListModelAccessor",

BIN
src/main/resources/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB