Skip to content

Commit c3cf3b5

Browse files
authored
Merge pull request #6446 from IThundxr/mc1.18/fix-contraption-step-sounds
Fix contraption step sounds
2 parents d941863 + 62a16a4 commit c3cf3b5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/com/simibubi/create/foundation/mixin/client/EntityContraptionInteractionMixin.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import org.apache.commons.lang3.mutable.MutableBoolean;
1010
import org.apache.logging.log4j.util.TriConsumer;
11-
import org.objectweb.asm.Opcodes;
1211
import org.spongepowered.asm.mixin.Final;
1312
import org.spongepowered.asm.mixin.Mixin;
1413
import org.spongepowered.asm.mixin.Shadow;
@@ -82,7 +81,7 @@ private EntityContraptionInteractionMixin(Class<Entity> baseClass) {
8281
}
8382

8483
@Unique
85-
private void forCollision(Vec3 worldPos, TriConsumer<Contraption, BlockState, BlockPos> action) {
84+
private void create$forCollision(Vec3 worldPos, TriConsumer<Contraption, BlockState, BlockPos> action) {
8685
create$getIntersectingContraptions().forEach(cEntity -> {
8786
Vec3 localPos = ContraptionCollider.worldToLocalPos(worldPos, cEntity);
8887

@@ -100,12 +99,12 @@ private void forCollision(Vec3 worldPos, TriConsumer<Contraption, BlockState, Bl
10099

101100
// involves block step sounds on contraptions
102101
// IFNE line 661 injecting before `!blockstate.isAir(this.world, blockpos)`
103-
@Inject(method = "move", at = @At(value = "JUMP", opcode = Opcodes.IFNE, ordinal = 7))
102+
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;isAir()Z", ordinal = 0))
104103
private void create$contraptionStepSounds(MoverType mover, Vec3 movement, CallbackInfo ci) {
105104
Vec3 worldPos = position.add(0, -0.2, 0);
106105
MutableBoolean stepped = new MutableBoolean(false);
107106

108-
forCollision(worldPos, (contraption, state, pos) -> {
107+
create$forCollision(worldPos, (contraption, state, pos) -> {
109108
playStepSound(pos, state);
110109
stepped.setTrue();
111110
});
@@ -136,7 +135,7 @@ private void forCollision(Vec3 worldPos, TriConsumer<Contraption, BlockState, Bl
136135

137136
if (info == null)
138137
return false;
139-
138+
140139
cEntity.registerColliding(self);
141140
return true;
142141
});
@@ -155,7 +154,7 @@ private void forCollision(Vec3 worldPos, TriConsumer<Contraption, BlockState, Bl
155154
Vec3 worldPos = position.add(0, -0.2, 0);
156155
BlockPos particlePos = new BlockPos(worldPos); // pos where particles are spawned
157156

158-
forCollision(worldPos, (contraption, state, pos) -> {
157+
create$forCollision(worldPos, (contraption, state, pos) -> {
159158
if (!state.addRunningEffects(level, pos, self)
160159
&& state.getRenderShape() != RenderShape.INVISIBLE) {
161160
Vec3 speed = self.getDeltaMovement();

0 commit comments

Comments
 (0)