mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 10:53:44 +01:00
fix mixins
This commit is contained in:
parent
a048285699
commit
9e4198fa79
5 changed files with 19 additions and 21 deletions
|
@ -17,11 +17,11 @@ import net.minecraft.util.math.BlockPos;
|
|||
public class BreakProgressMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private WorldRenderer worldRenderer; // levelRenderer
|
||||
private WorldRenderer levelRenderer; // levelRenderer
|
||||
private final ClientWorld self = (ClientWorld) (Object) this;
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "sendBlockBreakProgress") // levelRenderer
|
||||
@Inject(at = @At("HEAD"), method = "destroyBlockProgress")
|
||||
private void onBreakProgress(int playerEntityId, BlockPos pos, int progress, CallbackInfo ci) {
|
||||
BreakProgressHook.whenBreaking(self, this.worldRenderer, playerEntityId, pos, progress);
|
||||
BreakProgressHook.whenBreaking(self, this.levelRenderer, playerEntityId, pos, progress);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,16 +44,16 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
|||
|
||||
@Final
|
||||
@Shadow
|
||||
protected Random rand; // levelRenderer
|
||||
protected Random random;
|
||||
|
||||
@Shadow
|
||||
private float nextStepDistance; // levelRenderer
|
||||
private float nextStep;
|
||||
|
||||
@Shadow
|
||||
protected abstract float determineNextStepDistance(); // nextStep()F
|
||||
protected abstract float nextStep();
|
||||
|
||||
@Shadow
|
||||
protected abstract void playStepSound(BlockPos p_180429_1_, BlockState p_180429_2_); // nextStep()F
|
||||
protected abstract void playStepSound(BlockPos p_180429_1_, BlockState p_180429_2_);
|
||||
|
||||
private Set<AbstractContraptionEntity> getIntersectingContraptions() {
|
||||
Set<AbstractContraptionEntity> contraptions = ContraptionHandler.loadedContraptions.get(self.level)
|
||||
|
@ -87,7 +87,7 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
|||
}
|
||||
|
||||
@Inject(at = @At(value = "JUMP", opcode = 154, // IFNE line 587 injecting before `!blockstate.isAir(this.world, blockpos)`
|
||||
ordinal = 4), method = "move") // nextStep()F
|
||||
ordinal = 4), method = "move")
|
||||
private void movementMixin(MoverType mover, Vector3d movement, CallbackInfo ci) {
|
||||
Vector3d worldPos = self.position()
|
||||
.add(0, -0.2, 0);
|
||||
|
@ -101,10 +101,10 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
|||
});
|
||||
|
||||
if (stepped.get())
|
||||
this.nextStepDistance = this.determineNextStepDistance();
|
||||
this.nextStep = this.nextStep();
|
||||
}
|
||||
|
||||
@Inject(method = { "spawnSprintingParticles" }, at = @At(value = "TAIL")) // spawnSprintParticle()V
|
||||
@Inject(method = { "spawnSprintParticle" }, at = @At(value = "TAIL"))
|
||||
private void createRunningParticlesMixin(CallbackInfo ci) {
|
||||
Vector3d worldPos = self.position()
|
||||
.add(0, -0.2, 0);
|
||||
|
@ -115,14 +115,14 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
|||
&& blockstate.getRenderShape() != BlockRenderType.INVISIBLE) {
|
||||
Vector3d vec3d = self.getDeltaMovement();
|
||||
self.level.addParticle(new BlockParticleData(ParticleTypes.BLOCK, blockstate).setPos(pos),
|
||||
self.getX() + ((double) rand.nextFloat() - 0.5D) * (double) self.getBbWidth(), self.getY() + 0.1D,
|
||||
self.getZ() + ((double) rand.nextFloat() - 0.5D) * (double) self.getBbWidth(), vec3d.x * -4.0D, 1.5D,
|
||||
self.getX() + ((double) random.nextFloat() - 0.5D) * (double) self.getBbWidth(), self.getY() + 0.1D,
|
||||
self.getZ() + ((double) random.nextFloat() - 0.5D) * (double) self.getBbWidth(), vec3d.x * -4.0D, 1.5D,
|
||||
vec3d.z * -4.0D);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Inject(method = "playSound", at = @At("HEAD"), cancellable = true) // playSound(Lnet/minecraft/util/SoundEvent;FF)V
|
||||
@Inject(method = "playSound", at = @At("HEAD"), cancellable = true)
|
||||
private void playSoundShifted(SoundEvent event, float pitch, float volume, CallbackInfo ci) {
|
||||
if (this.contraption != null && (!self.isSilent() || self instanceof PlayerEntity)) {
|
||||
double x = self.getX();
|
||||
|
|
|
@ -17,8 +17,7 @@ public class FixNormalScalingMixin {
|
|||
* applied, which negates the matrix again, resulting in the matrix being the
|
||||
* same as in the beginning.
|
||||
*/
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/vector/Matrix3f;multiply(F)V", shift = Shift.AFTER), method = "scale(FFF)V", cancellable = true)
|
||||
// At mul(F)V, method: scale(FFF)V
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/vector/Matrix3f;mul(F)V", shift = Shift.AFTER), method = "scale(FFF)V", cancellable = true)
|
||||
private void returnAfterNegate(float x, float y, float z, CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
}
|
||||
|
@ -30,8 +29,7 @@ public class FixNormalScalingMixin {
|
|||
* that would invert all normals. Additionally, Minecraft's fastInverseCbrt method
|
||||
* does not work for negative numbers.
|
||||
*/
|
||||
@ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;fastInverseCbrt(F)F"), method = "scale(FFF)V")
|
||||
// at fastInvCubeRoot(F)F, method: fastInvCubeRoot(F)F
|
||||
@ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;fastInvCubeRoot(F)F"), method = "scale(FFF)V")
|
||||
private float absInvCbrtInput(float input) {
|
||||
return Math.abs(input);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class HeavyBootsOnPlayerMixin extends AbstractClientPlayerEntity
|
|||
super(p_i50991_1_, p_i50991_2_);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "canSwim", cancellable = true) // isUnderWater()Z
|
||||
@Inject(at = @At("HEAD"), method = "isUnderWater", cancellable = true)
|
||||
public void noSwimmingWithHeavyBootsOn(CallbackInfoReturnable<Boolean> cir) {
|
||||
CompoundNBT persistentData = getPersistentData();
|
||||
if (persistentData.contains("HeavyBoots"))
|
||||
|
|
|
@ -18,11 +18,11 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
@Mixin(Minecraft.class)
|
||||
public class WindowResizeMixin {
|
||||
|
||||
@Shadow @Final private MainWindow mainWindow;
|
||||
@Shadow @Final private MainWindow window;
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "updateWindowSize") // resizeDisplay()V
|
||||
@Inject(at = @At("TAIL"), method = "resizeDisplay")
|
||||
private void updateWindowSize(CallbackInfo ci) {
|
||||
UIRenderHelper.updateWindowSize(mainWindow);
|
||||
UIRenderHelper.updateWindowSize(window);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue