Skip to content

Commit 4539457

Browse files
committed
Merge branch '1.19/dev' into 1.20/dev
# Conflicts: # common/src/main/java/com/railwayteam/railways/mixin/compat/sodium/MixinBlockOcclusionCache.java
2 parents b5a6d54 + 8edf7f6 commit 4539457

File tree

14 files changed

+371
-367
lines changed

14 files changed

+371
-367
lines changed

common/src/main/java/com/railwayteam/railways/Railways.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.railwayteam.railways;
1+
package com.railwayteam.railways;
22

33
import com.mojang.brigadier.CommandDispatcher;
44
import com.railwayteam.railways.base.data.CRTagGen;
@@ -82,10 +82,6 @@ public static void init() {
8282
registerCommands(CRCommands::register);
8383
CRPackets.PACKETS.registerC2SListener();
8484

85-
if (Mods.isModLoaded("embeddium", null)) {
86-
LOGGER.info("there is a brick about to fall through your roof at terminal velocity");
87-
}
88-
8985
if (Utils.isDevEnv() && !Mods.BYG.isLoaded && !Mods.SODIUM.isLoaded) // force all mixins to load in dev
9086
MixinEnvironment.getCurrentEnvironment().audit();
9187
}

common/src/main/java/com/railwayteam/railways/content/smokestack/block/AbstractSmokeStackBlock.java

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
7676

7777
@Override
7878
public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) {
79+
if (this instanceof DieselSmokeStackBlock)
80+
return super.getCloneItemStack(level, pos, state);
7981
return CRBlocks.SMOKESTACK_GROUP.get(variant).get(state.getValue(STYLE)).asStack();
8082
}
8183

common/src/main/java/com/railwayteam/railways/content/smokestack/block/renderer/DieselSmokeStackRenderer.java

+14-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.railwayteam.railways.registry.CRBlockPartials;
77
import com.simibubi.create.foundation.blockEntity.renderer.SmartBlockEntityRenderer;
88
import com.simibubi.create.foundation.render.CachedBufferer;
9+
import com.simibubi.create.foundation.render.SuperByteBuffer;
910
import net.minecraft.client.renderer.MultiBufferSource;
1011
import net.minecraft.client.renderer.RenderType;
1112
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
@@ -17,15 +18,20 @@ public DieselSmokeStackRenderer(BlockEntityRendererProvider.Context context) {
1718
}
1819

1920
@Override
20-
protected void renderSafe(DieselSmokeStackBlockEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
21-
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
22-
Direction dir = te.getBlockState().getValue(DieselSmokeStackBlock.FACING);
23-
CachedBufferer.partial(CRBlockPartials.DIESEL_STACK_FAN, te.getBlockState())
24-
.translate(0.5, 0.5, 0.5)
21+
protected void renderSafe(DieselSmokeStackBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
22+
super.renderSafe(be, partialTicks, ms, buffer, light, overlay);
23+
Direction dir = be.getBlockState().getValue(DieselSmokeStackBlock.FACING);
24+
25+
SuperByteBuffer byteBuffer = CachedBufferer.partial(CRBlockPartials.DIESEL_STACK_FAN, be.getBlockState());
26+
27+
byteBuffer.light(light);
28+
29+
byteBuffer.translate(0.5, 0.5, 0.5)
2530
.rotateX(dir == Direction.DOWN ? 180 : dir.getAxis().isHorizontal() ? 90 : 0)
2631
.rotateZ(dir.getAxis().isVertical() ? 0 : ((int) dir.toYRot()) % 360)
27-
.rotateY(te.getFanRotation(te.getRpm(partialTicks)))
28-
.translate(-0.5, -0.5, -0.5)
29-
.renderInto(ms, buffer.getBuffer(RenderType.cutout()));
32+
.rotateY(be.getFanRotation(be.getRpm(partialTicks)))
33+
.translate(-0.5, -0.5, -0.5);
34+
35+
byteBuffer.renderInto(ms, buffer.getBuffer(RenderType.cutout()));
3036
}
3137
}

common/src/main/java/com/railwayteam/railways/mixin/MixinCarriageContraptionEntity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private void setupBufferDistanceData(CallbackInfo ci) {
208208

209209
@Inject(method = "control", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/trains/entity/Train;getCurrentStation()Lcom/simibubi/create/content/trains/station/GlobalStation;"))
210210
private void noBufferOverrun(BlockPos controlsLocalPos, Collection<Integer> heldControls, Player player,
211-
CallbackInfoReturnable<Boolean> cir, @Local(name="targetSpeed") LocalIntRef targetSpeed) {
211+
CallbackInfoReturnable<Boolean> cir, @Local(ordinal = 0) LocalIntRef targetSpeed) {
212212
if (((IBufferBlockedTrain) carriage.train).railways$isControlBlocked() && ((IBufferBlockedTrain) carriage.train).railways$getBlockedSign() == Mth.sign(targetSpeed.get())) {
213213
targetSpeed.set(0);
214214
}

common/src/main/java/com/railwayteam/railways/mixin/MixinContraption.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@Mixin(Contraption.class)
1717
public class MixinContraption {
1818
@Inject(method = "removeBlocksFromWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;removeBlockEntity(Lnet/minecraft/core/BlockPos;)V"))
19-
private void applyPreTransformCallback(Level world, BlockPos offset, CallbackInfo ci, @Local(name="add") BlockPos add) {
19+
private void applyPreTransformCallback(Level world, BlockPos offset, CallbackInfo ci, @Local(ordinal = 1) BlockPos add) {
2020
BlockEntity be = world.getBlockEntity(add);
2121
if (be instanceof IPreAssembleCallback preTransformCallback)
2222
preTransformCallback.railways$preAssemble();

common/src/main/java/com/railwayteam/railways/mixin/MixinNavigation.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ private void storeBufferSlowdown(MutableObject<Pair<UUID, Boolean>> trackingCros
384384

385385
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/trains/entity/Train;burnFuel()V"))
386386
private void applyBufferSlowdown(Level level, CallbackInfo ci,
387-
@Local(name = "targetDistance") LocalDoubleRef targetDistance) {
387+
@Local(ordinal = 5) LocalDoubleRef targetDistance) {
388388
if (railways$bufferDistance.get() < targetDistance.get())
389389
targetDistance.set(railways$bufferDistance.get());
390390
// reset buffer distance for next time

common/src/main/java/com/railwayteam/railways/mixin/MixinScheduleRuntime.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.railwayteam.railways.mixin;
22

33
import com.llamalad7.mixinextras.sugar.Local;
4-
import com.railwayteam.railways.Railways;
54
import com.railwayteam.railways.content.schedule.WaypointDestinationInstruction;
65
import com.railwayteam.railways.mixin_interfaces.ICustomExecutableInstruction;
76
import com.simibubi.create.content.trains.entity.Train;
@@ -46,7 +45,7 @@ private void startCustomInstruction(CallbackInfoReturnable<GlobalStation> cir) {
4645

4746
@Inject(method = "tickConditions", at = @At("HEAD"), cancellable = true)
4847
private void tickWhenNoConditions(Level level, CallbackInfo ci) {
49-
if (schedule.entries.get(currentEntry).conditions.size() == 0) {
48+
if (schedule.entries.get(currentEntry).conditions.isEmpty()) {
5049
state = ScheduleRuntime.State.PRE_TRANSIT;
5150
currentEntry++;
5251
ci.cancel();
@@ -56,16 +55,15 @@ private void tickWhenNoConditions(Level level, CallbackInfo ci) {
5655
@Inject(method = "tick", at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/trains/schedule/ScheduleRuntime;completed:Z", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER))
5756
private void discardAutoSchedule(Level level, CallbackInfo ci) {
5857
if (isAutoSchedule) {
59-
Railways.LOGGER.info("[DISCARD_SCHEDULE] on train {} called in MixinScheduleRuntime#discardAutoSchedule because a non-looping auto schedule was completed", this.train.name.getString());
6058
discardSchedule();
6159
}
6260
}
6361

6462
// waypoint instructions have no conditions, and so are handled as 'invalid' by the vanilla code (https://github.com/Layers-of-Railways/Railway/issues/329)
6563
@Inject(method = "estimateStayDuration",
66-
at = @At(value = "INVOKE_ASSIGN", target = "Ljava/util/List;get(I)Ljava/lang/Object;", shift = At.Shift.BY, by=2),
64+
at = @At(value = "INVOKE_ASSIGN", target = "Ljava/util/List;get(I)Ljava/lang/Object;", shift = At.Shift.BY, by = 2),
6765
cancellable = true)
68-
private void waypointsAreValid(int index, CallbackInfoReturnable<Integer> cir, @Local(name = "scheduleEntry") ScheduleEntry scheduleEntry) {
66+
private void waypointsAreValid(int index, CallbackInfoReturnable<Integer> cir, @Local ScheduleEntry scheduleEntry) {
6967
if (scheduleEntry.instruction instanceof WaypointDestinationInstruction)
7068
cir.setReturnValue(0);
7169
}

common/src/main/java/com/railwayteam/railways/mixin/MixinStationBlockEntity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private Train returnOverridenTrain(GlobalStation instance) {
113113
}
114114

115115
@Inject(method = "assemble", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getBlockEntity(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/entity/BlockEntity;", ordinal = 0), require = 0)
116-
private void allowAssemblingWithoutControls(UUID playerUUID, CallbackInfo ci, @Local(name="typeOfFirstBogey") AbstractBogeyBlock<?> typeOfFirstBogey, @Local(name="atLeastOneForwardControls") LocalBooleanRef atLeastOneForwardControls) {
116+
private void allowAssemblingWithoutControls(UUID playerUUID, CallbackInfo ci, @Local AbstractBogeyBlock<?> typeOfFirstBogey, @Local(ordinal = 0) LocalBooleanRef atLeastOneForwardControls) {
117117
if (typeOfFirstBogey instanceof HandcarBlock) {
118118
atLeastOneForwardControls.set(true);
119119
}

common/src/main/java/com/railwayteam/railways/mixin/MixinTrackPlacement.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ else if (TrackMaterial.fromItem(stack.getItem()).trackType == CRTrackMaterials.C
4949
private static void placeGenericCrossing0(Level level, TrackPlacement.PlacementInfo info, BlockState state1,
5050
BlockState state2, BlockPos targetPos1, BlockPos targetPos2, boolean simulate,
5151
CallbackInfoReturnable<TrackPlacement.PlacementInfo> cir,
52-
@Share("oldToPlace") LocalRef<BlockState> oldToPlace, @Local(name="toPlace") BlockState toPlace) {
52+
@Share("oldToPlace") LocalRef<BlockState> oldToPlace, @Local(ordinal = 4) BlockState toPlace) {
5353
oldToPlace.set(toPlace);
5454
}
5555

5656
@Inject(method = "placeTracks", at = @At(value = "INVOKE_ASSIGN", target = "Lcom/simibubi/create/content/trains/track/ITrackBlock;overlay(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;)Lnet/minecraft/world/level/block/state/BlockState;", shift = At.Shift.AFTER))
5757
private static void placeGenericCrossing(Level level, TrackPlacement.PlacementInfo info, BlockState state1,
5858
BlockState state2, BlockPos targetPos1, BlockPos targetPos2, boolean simulate,
5959
CallbackInfoReturnable<TrackPlacement.PlacementInfo> cir,
60-
@Local(name="stateAtPos") BlockState stateAtPos,
61-
@Local(name="toPlace") LocalRef<BlockState> toPlace,
60+
@Local(ordinal = 3) BlockState stateAtPos,
61+
@Local(ordinal = 4) LocalRef<BlockState> toPlace,
6262
@Share("oldToPlace") LocalRef<BlockState> oldToPlace,
6363
@Share("crossingData") LocalRef<@Nullable GenericCrossingData> crossingData) {
6464
crossingData.set(null);
@@ -83,7 +83,7 @@ private static void placeGenericCrossing(Level level, TrackPlacement.PlacementIn
8383
private static void maybePlaceCrossing(Level level, TrackPlacement.PlacementInfo info, BlockState state1,
8484
BlockState state2, BlockPos targetPos1, BlockPos targetPos2, boolean simulate,
8585
CallbackInfoReturnable<TrackPlacement.PlacementInfo> cir,
86-
@Local(name="offsetPos") BlockPos offsetPos,
86+
@Local(ordinal = 3) BlockPos offsetPos,
8787
@Share("crossingData") LocalRef<@Nullable GenericCrossingData> crossingDataRef) {
8888
@Nullable GenericCrossingData crossingData = crossingDataRef.get();
8989
if (crossingData != null && level.getBlockEntity(offsetPos) instanceof GenericCrossingBlockEntity genericCrossingBE) {

common/src/main/java/com/railwayteam/railways/mixin/MixinTrain.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ private static void readOccupiedCouplers(CompoundTag tag, Map<UUID, TrackGraph>
236236
}
237237

238238
@Inject(method = "collideWithOtherTrains", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/trains/entity/Train;crash()V", ordinal = 0), cancellable = true)
239-
private void railways$handcarCollision(Level level, Carriage carriage, CallbackInfo ci, @Local Train train, @Local(name = "v", ordinal = 0) Vec3 v) {
239+
private void railways$handcarCollision(Level level, Carriage carriage, CallbackInfo ci, @Local(ordinal = 1) Train train, @Local Pair<Train, Vec3> collision) {
240+
Vec3 v = collision.getSecond();
241+
240242
// Self Train / Train that collided with the other one
241243
if (((IHandcarTrain) this).railways$isHandcar()) {
242244
if (!invalid) {

common/src/main/java/com/railwayteam/railways/mixin/client/MixinStationRenderer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class MixinStationRenderer {
2323
@Inject(method = "renderSafe(Lcom/simibubi/create/content/trains/station/StationBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/foundation/render/CachedBufferer;partial(Lcom/jozufozu/flywheel/core/PartialModel;Lnet/minecraft/world/level/block/state/BlockState;)Lcom/simibubi/create/foundation/render/SuperByteBuffer;"))
2424
private void shiftAssemblyOverlayOnEncasedTracks(
2525
StationBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay,
26-
CallbackInfo ci, @Local(name = "currentPos") MutableBlockPos currentPos, @Local(name = "trackState") BlockState trackState) {
26+
CallbackInfo ci, @Local BlockState trackState, @Local MutableBlockPos currentPos) {
2727
ms.pushPose();
2828

2929
if (trackState.getBlock() instanceof TrackBlock trackBlock

0 commit comments

Comments
 (0)