mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-24 12:00:01 +01:00
Merge pull request #6446 from IThundxr/mc1.18/fix-contraption-step-sounds
Fix contraption step sounds
This commit is contained in:
commit
c3cf3b56e9
1 changed files with 5 additions and 6 deletions
|
@ -8,7 +8,6 @@ import java.util.stream.Stream;
|
|||
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.apache.logging.log4j.util.TriConsumer;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
@ -82,7 +81,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
|||
}
|
||||
|
||||
@Unique
|
||||
private void forCollision(Vec3 worldPos, TriConsumer<Contraption, BlockState, BlockPos> action) {
|
||||
private void create$forCollision(Vec3 worldPos, TriConsumer<Contraption, BlockState, BlockPos> action) {
|
||||
create$getIntersectingContraptions().forEach(cEntity -> {
|
||||
Vec3 localPos = ContraptionCollider.worldToLocalPos(worldPos, cEntity);
|
||||
|
||||
|
@ -100,12 +99,12 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
|||
|
||||
// involves block step sounds on contraptions
|
||||
// IFNE line 661 injecting before `!blockstate.isAir(this.world, blockpos)`
|
||||
@Inject(method = "move", at = @At(value = "JUMP", opcode = Opcodes.IFNE, ordinal = 7))
|
||||
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;isAir()Z", ordinal = 0))
|
||||
private void create$contraptionStepSounds(MoverType mover, Vec3 movement, CallbackInfo ci) {
|
||||
Vec3 worldPos = position.add(0, -0.2, 0);
|
||||
MutableBoolean stepped = new MutableBoolean(false);
|
||||
|
||||
forCollision(worldPos, (contraption, state, pos) -> {
|
||||
create$forCollision(worldPos, (contraption, state, pos) -> {
|
||||
playStepSound(pos, state);
|
||||
stepped.setTrue();
|
||||
});
|
||||
|
@ -136,7 +135,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
|||
|
||||
if (info == null)
|
||||
return false;
|
||||
|
||||
|
||||
cEntity.registerColliding(self);
|
||||
return true;
|
||||
});
|
||||
|
@ -155,7 +154,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
|||
Vec3 worldPos = position.add(0, -0.2, 0);
|
||||
BlockPos particlePos = new BlockPos(worldPos); // pos where particles are spawned
|
||||
|
||||
forCollision(worldPos, (contraption, state, pos) -> {
|
||||
create$forCollision(worldPos, (contraption, state, pos) -> {
|
||||
if (!state.addRunningEffects(level, pos, self)
|
||||
&& state.getRenderShape() != RenderShape.INVISIBLE) {
|
||||
Vec3 speed = self.getDeltaMovement();
|
||||
|
|
Loading…
Add table
Reference in a new issue