Playtest I

- Fixed classloading issues when flywheel is not present serverside
- Fixed missing texture on the mechanical arm item
- Added back deprecated register method for display behaviours
- Fixed Redstone/Elevator Contacts not switching type after rotated by wrench
- Fixed edited clipboard entry not rendering at correct y in some gui scales
- Fan transparency of copycat blocks now refers to their material
- Fixed new metal bars not being fan transparent
This commit is contained in:
simibubi 2023-04-01 12:42:16 +02:00
parent f3814d0668
commit 4360916316
13 changed files with 99 additions and 18 deletions

View file

@ -5263,7 +5263,7 @@ d99d5c67bdffff60789a19bd51a5c5267c75e0a4 data/create/tags/blocks/casing.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/blocks/contraption_inventory_deny.json
bc203f09dd7f48965d146d0bd035fb904cb75e7d data/create/tags/blocks/copycat_allow.json
d4a3b66f4b763b9a2dcdea74b7273f0ae85cb335 data/create/tags/blocks/copycat_deny.json
2b4c93e5a752ebf54217594766f30d8d60cb4343 data/create/tags/blocks/fan_transparent.json
73c2c85233075d2854d209b71ff2160308a7919c data/create/tags/blocks/fan_transparent.json
ee6d2b53d81f2bed492662b6c06f46c4f2b9ef9b data/create/tags/blocks/movable_empty_collider.json
6e5d3b2123fbb00e7f439c091623619502551bca data/create/tags/blocks/non_movable.json
10781e8cfcbb3486327aace3aa00e437fb44b331 data/create/tags/blocks/ore_override_stone.json

View file

@ -4,6 +4,10 @@
"create:blaze_burner",
"create:lit_blaze_burner",
"create:sail_frame",
"create:andesite_bars",
"create:brass_bars",
"create:copper_bars",
"create:copycat_base",
"minecraft:iron_bars",
"#minecraft:campfires",
"#minecraft:fences",

View file

@ -2103,6 +2103,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.color(MaterialColor.GLOW_LICHEN))
.addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag)
.transform(pickaxeOnly())
.blockstate((c, p) -> p.simpleBlock(c.get(), AssetLookup.partialBaseModel(c, p)))
.register();

View file

@ -10,6 +10,7 @@ import com.simibubi.create.AllTags;
import com.simibubi.create.content.contraptions.particle.AirFlowParticleData;
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
import com.simibubi.create.content.contraptions.processing.InWorldProcessing.Type;
import com.simibubi.create.content.curiosities.frames.CopycatBlock;
import com.simibubi.create.foundation.advancement.AllAdvancements;
import com.simibubi.create.foundation.blockEntity.BlockEntityBehaviour;
import com.simibubi.create.foundation.blockEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
@ -214,7 +215,8 @@ public class AirCurrent {
if (!world.isLoaded(currentPos))
break;
BlockState state = world.getBlockState(currentPos);
if (shouldAlwaysPass(state))
BlockState copycatState = CopycatBlock.getMaterial(world, currentPos);
if (shouldAlwaysPass(copycatState.isAir() ? state : copycatState))
continue;
VoxelShape voxelshape = state.getCollisionShape(world, currentPos, CollisionContext.empty());
if (voxelshape.isEmpty())

View file

@ -16,17 +16,20 @@ import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.foundation.block.IBE;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList;
import net.minecraft.core.Direction.Axis;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
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;
@ -63,6 +66,28 @@ public class ElevatorContactBlock extends WrenchableDirectionalBlock
super.createBlockStateDefinition(builder.add(CALLING, POWERING, POWERED));
}
@Override
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
InteractionResult onWrenched = super.onWrenched(state, context);
if (onWrenched != InteractionResult.SUCCESS)
return onWrenched;
Level level = context.getLevel();
if (level.isClientSide())
return onWrenched;
BlockPos pos = context.getClickedPos();
state = level.getBlockState(pos);
Direction facing = state.getValue(RedstoneContactBlock.FACING);
if (facing.getAxis() != Axis.Y
&& ElevatorColumn.get(level, new ColumnCoords(pos.getX(), pos.getZ(), facing)) != null)
return onWrenched;
level.setBlockAndUpdate(pos, BlockHelper.copyProperties(state, AllBlocks.REDSTONE_CONTACT.getDefaultState()));
return onWrenched;
}
@Nullable
public static ColumnCoords getColumnCoords(LevelAccessor level, BlockPos pos) {
BlockState blockState = level.getBlockState(pos);

View file

@ -7,6 +7,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.network.NetworkEvent.Context;
@ -37,13 +38,16 @@ public class GlueEffectPacket extends SimplePacketBase {
@Override
public boolean handle(Context context) {
context.enqueueWork(() -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
Minecraft mc = Minecraft.getInstance();
if (!mc.player.blockPosition().closerThan(pos, 100))
return;
SuperGlueItem.spawnParticles(mc.level, pos, direction, fullBlock);
}));
context.enqueueWork(() -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> this::handleClient));
return true;
}
@OnlyIn(Dist.CLIENT)
public void handleClient() {
Minecraft mc = Minecraft.getInstance();
if (!mc.player.blockPosition().closerThan(pos, 100))
return;
SuperGlueItem.spawnParticles(mc.level, pos, direction, fullBlock);
}
}

View file

@ -520,12 +520,13 @@ public class ClipboardScreen extends AbstractSimiScreen {
}
private Pos2i convertScreenToLocal(Pos2i pScreenPos) {
return new Pos2i(pScreenPos.x - (width - 192) / 2 - 36 + 10, pScreenPos.y - 32 - 24 - yOffsetOfEditingEntry());
return new Pos2i(pScreenPos.x - (width - 192) / 2 - 36 + 10,
pScreenPos.y - 32 - 24 - yOffsetOfEditingEntry() - guiTop + 14);
}
private Pos2i convertLocalToScreen(Pos2i pLocalScreenPos) {
return new Pos2i(pLocalScreenPos.x + (width - 192) / 2 + 36 - 10,
pLocalScreenPos.y + 32 + 24 + yOffsetOfEditingEntry());
pLocalScreenPos.y + 32 + 24 + yOffsetOfEditingEntry() + guiTop - 14);
}
public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) {

View file

@ -60,6 +60,11 @@ public class AllDisplayBehaviours {
}
}
@Deprecated
public static void assignTile(DisplayBehaviour behaviour, ResourceLocation beType) {
assignBlockEntity(behaviour, beType);
}
public static void assignBlockEntity(DisplayBehaviour behaviour, ResourceLocation beType) {
if (behaviour instanceof DisplaySource source) {
List<DisplaySource> sources = SOURCES_BY_BLOCK_ENTITY.get(beType);
@ -88,6 +93,11 @@ public class AllDisplayBehaviours {
}
}
@Deprecated
public static void assignTile(DisplayBehaviour behaviour, BlockEntityType<?> beType) {
assignBlockEntity(behaviour, beType);
}
public static void assignBlockEntity(DisplayBehaviour behaviour, BlockEntityType<?> beType) {
if (behaviour instanceof DisplaySource source) {
List<DisplaySource> sources = SOURCES_BY_BLOCK_ENTITY.get(beType);

View file

@ -6,13 +6,19 @@ import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.structureMovement.elevator.ElevatorColumn;
import com.simibubi.create.content.contraptions.components.structureMovement.elevator.ElevatorColumn.ColumnCoords;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionResult;
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;
@ -57,6 +63,29 @@ public class RedstoneContactBlock extends WrenchableDirectionalBlock {
return state;
}
@Override
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
InteractionResult onWrenched = super.onWrenched(state, context);
if (onWrenched != InteractionResult.SUCCESS)
return onWrenched;
Level level = context.getLevel();
if (level.isClientSide())
return onWrenched;
BlockPos pos = context.getClickedPos();
state = level.getBlockState(pos);
Direction facing = state.getValue(RedstoneContactBlock.FACING);
if (facing.getAxis() == Axis.Y)
return onWrenched;
if (ElevatorColumn.get(level, new ColumnCoords(pos.getX(), pos.getZ(), facing)) == null)
return onWrenched;
level.setBlockAndUpdate(pos, BlockHelper.copyProperties(state, AllBlocks.ELEVATOR_CONTACT.getDefaultState()));
return onWrenched;
}
@Override
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn,
BlockPos currentPos, BlockPos facingPos) {

View file

@ -6,6 +6,8 @@ import java.util.Map;
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
public class CTSpriteShifter {
@ -17,7 +19,7 @@ public class CTSpriteShifter {
return (CTSpriteShiftEntry) ENTRY_CACHE.get(key);
CTSpriteShiftEntry entry = new CTSpriteShiftEntry(type);
entry.set(blockTexture, connectedTexture);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> entry.set(blockTexture, connectedTexture));
ENTRY_CACHE.put(key, entry);
return entry;
}

View file

@ -4,6 +4,8 @@ import java.util.HashMap;
import java.util.Map;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
public class SpriteShifter {
@ -15,7 +17,7 @@ public class SpriteShifter {
return ENTRY_CACHE.get(key);
SpriteShiftEntry entry = new SpriteShiftEntry();
entry.set(originalLocation, targetLocation);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> entry.set(originalLocation, targetLocation));
ENTRY_CACHE.put(key, entry);
return entry;
}

View file

@ -127,6 +127,7 @@ public class MetalBarsGen {
.initialProperties(() -> Blocks.IRON_BARS)
.properties(p -> p.sound(SoundType.COPPER))
.tag(AllBlockTags.WRENCH_PICKUP.tag)
.tag(AllBlockTags.FAN_TRANSPARENT.tag)
.blockstate(barsBlockState(name, specialEdge))
.item()
.model((c, p) -> {

View file

@ -2,7 +2,7 @@
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"4": "create:block/belt/brass_belt_casing_sideways",
"4": "create:block/mechanical_arm_side",
"5": "create:block/mechanical_arm",
"7": "create:block/brass_block",
"particle": "create:block/crafter_top"
@ -110,10 +110,10 @@
"to": [16, -10, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, -8, 8]},
"faces": {
"north": {"uv": [0, 6.5, 8, 9.5], "texture": "#4"},
"east": {"uv": [0, 6.5, 8, 9.5], "texture": "#4"},
"south": {"uv": [0, 6.5, 8, 9.5], "texture": "#4"},
"west": {"uv": [0, 6.5, 8, 9.5], "texture": "#4"},
"north": {"uv": [0, 0, 16, 6], "texture": "#4"},
"east": {"uv": [0, 0, 16, 6], "texture": "#4"},
"south": {"uv": [0, 0, 16, 6], "texture": "#4"},
"west": {"uv": [0, 0, 16, 6], "texture": "#4"},
"up": {"uv": [0, 0, 16, 16], "texture": "#7"},
"down": {"uv": [0, 0, 16, 16], "texture": "#7"}
}