Merge remote-tracking branch 'origin/mc1.19/dev' into mc1.20.1/dev

This commit is contained in:
simibubi 2024-08-25 20:29:49 +02:00
commit 59a3ab244b
24 changed files with 259 additions and 34 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.20-1.3.3
flywheel_minecraft_version = 1.20.1
flywheel_version = 0.6.10-7
flywheel_version = 0.6.10-11
jei_minecraft_version = 1.20.1
jei_version = 15.10.0.39
curios_minecraft_version = 1.20.1

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;
@ -186,6 +187,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

@ -299,8 +299,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,
@ -140,7 +146,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())
@ -154,8 +160,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;
@ -166,5 +167,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

@ -114,8 +114,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

@ -110,6 +110,8 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
.render(graphics);
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='''

View File

@ -1,6 +1,125 @@
{
"parent": "create:block/display_link/block",
"credit": "Made with Blockbench",
"loader": "forge:composite",
"parent": "block/block",
"textures": {
"3": "create:block/display_link_side_powered"
"0": "create:block/display_link",
"3": "create:block/display_link_side_powered",
"particle": "create:block/brass_casing"
},
"children": {
"base": {
"render_type": "minecraft:solid",
"textures": {
"0": "create:block/display_link",
"3": "create:block/display_link_side_powered"
},
"elements": [
{
"from": [9, 6, 3.5],
"to": [13, 9, 12.5],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]},
"faces": {
"north": {"uv": [14.5, 0, 12.5, 1.5], "texture": "#0"},
"east": {"uv": [14.5, 6, 16, 1.5], "rotation": 90, "texture": "#0"},
"south": {"uv": [12.5, 0, 14.5, 1.5], "texture": "#0"},
"west": {"uv": [14.5, 6, 16, 1.5], "rotation": 90, "texture": "#0"},
"up": {"uv": [14.5, 1.5, 12.5, 6], "rotation": 180, "texture": "#0"}
}
},
{
"from": [1, 1, 1],
"to": [15, 6, 15],
"faces": {
"north": {"uv": [0, 0, 14, 5], "texture": "#3"},
"east": {"uv": [7.5, 9, 10, 16], "rotation": 90, "texture": "#0"},
"south": {"uv": [0, 0, 14, 5], "texture": "#3"},
"west": {"uv": [7.5, 9, 10, 16], "rotation": 90, "texture": "#0"},
"up": {"uv": [0, 9, 7, 16], "texture": "#0"},
"down": {"uv": [0, 1.5, 7, 8.5], "texture": "#0"}
}
},
{
"from": [2, -1, 2],
"to": [14, 1, 14],
"faces": {
"north": {"uv": [0.5, 0, 6.5, 1], "texture": "#0"},
"east": {"uv": [0.5, 0, 6.5, 1], "texture": "#0"},
"south": {"uv": [0.5, 0, 6.5, 1], "texture": "#0"},
"west": {"uv": [0.5, 0, 6.5, 1], "texture": "#0"},
"down": {"uv": [0.5, 2, 6.5, 8], "texture": "#0"}
}
},
{
"from": [3, 5, 3],
"to": [7, 7, 7],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]},
"faces": {
"north": {"uv": [13.5, 10, 11.5, 11], "texture": "#0"},
"east": {"uv": [13.5, 10, 11.5, 11], "texture": "#0"},
"south": {"uv": [13.5, 10, 11.5, 11], "texture": "#0"},
"west": {"uv": [13.5, 10, 11.5, 11], "texture": "#0"},
"up": {"uv": [13.5, 8, 11.5, 10], "texture": "#0"}
}
},
{
"from": [3, 6, 8],
"to": [7, 8, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]},
"faces": {
"north": {"uv": [13.5, 8, 11.5, 9], "texture": "#0"},
"east": {"uv": [13.5, 8, 11.5, 9], "texture": "#0"},
"south": {"uv": [13.5, 8, 11.5, 9], "texture": "#0"},
"west": {"uv": [13.5, 8, 11.5, 9], "texture": "#0"},
"up": {"uv": [13.5, 6, 11.5, 8], "texture": "#0"}
}
}
]
},
"bulb_inner": {
"render_type": "minecraft:cutout",
"textures": {
"0": "create:block/display_link"
},
"elements": [
{
"from": [2.5, 8, 9],
"to": [7.5, 13, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 7.5, 19]},
"faces": {
"south": {"uv": [16, 13.5, 13.5, 16], "texture": "#0"}
}
},
{
"from": [2.5, 8, 10],
"to": [7.5, 13, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]},
"faces": {
"north": {"uv": [16, 13.5, 13.5, 16], "texture": "#0"}
}
}
]
},
"bulb": {
"render_type": "minecraft:translucent",
"textures": {
"0": "create:block/display_link"
},
"elements": [
{
"from": [2.5, 8, 7.5],
"to": [7.5, 13, 12.5],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 0, 0]},
"faces": {
"north": {"uv": [16, 8.5, 13.5, 11], "texture": "#0"},
"east": {"uv": [16, 8.5, 13.5, 11], "texture": "#0"},
"south": {"uv": [16, 8.5, 13.5, 11], "texture": "#0"},
"west": {"uv": [16, 8.5, 13.5, 11], "texture": "#0"},
"up": {"uv": [16, 6, 13.5, 8.5], "texture": "#0"},
"down": {"uv": [16, 11, 13.5, 13.5], "texture": "#0"}
}
}
]
}
}
}

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",
@ -23,7 +24,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