mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 13:43:42 +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 {
|
public class BreakProgressMixin {
|
||||||
@Shadow
|
@Shadow
|
||||||
@Final
|
@Final
|
||||||
private WorldRenderer worldRenderer; // levelRenderer
|
private WorldRenderer levelRenderer; // levelRenderer
|
||||||
private final ClientWorld self = (ClientWorld) (Object) this;
|
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) {
|
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
|
@Final
|
||||||
@Shadow
|
@Shadow
|
||||||
protected Random rand; // levelRenderer
|
protected Random random;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private float nextStepDistance; // levelRenderer
|
private float nextStep;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
protected abstract float determineNextStepDistance(); // nextStep()F
|
protected abstract float nextStep();
|
||||||
|
|
||||||
@Shadow
|
@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() {
|
private Set<AbstractContraptionEntity> getIntersectingContraptions() {
|
||||||
Set<AbstractContraptionEntity> contraptions = ContraptionHandler.loadedContraptions.get(self.level)
|
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)`
|
@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) {
|
private void movementMixin(MoverType mover, Vector3d movement, CallbackInfo ci) {
|
||||||
Vector3d worldPos = self.position()
|
Vector3d worldPos = self.position()
|
||||||
.add(0, -0.2, 0);
|
.add(0, -0.2, 0);
|
||||||
|
@ -101,10 +101,10 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
||||||
});
|
});
|
||||||
|
|
||||||
if (stepped.get())
|
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) {
|
private void createRunningParticlesMixin(CallbackInfo ci) {
|
||||||
Vector3d worldPos = self.position()
|
Vector3d worldPos = self.position()
|
||||||
.add(0, -0.2, 0);
|
.add(0, -0.2, 0);
|
||||||
|
@ -115,14 +115,14 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid
|
||||||
&& blockstate.getRenderShape() != BlockRenderType.INVISIBLE) {
|
&& blockstate.getRenderShape() != BlockRenderType.INVISIBLE) {
|
||||||
Vector3d vec3d = self.getDeltaMovement();
|
Vector3d vec3d = self.getDeltaMovement();
|
||||||
self.level.addParticle(new BlockParticleData(ParticleTypes.BLOCK, blockstate).setPos(pos),
|
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.getX() + ((double) random.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.getZ() + ((double) random.nextFloat() - 0.5D) * (double) self.getBbWidth(), vec3d.x * -4.0D, 1.5D,
|
||||||
vec3d.z * -4.0D);
|
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) {
|
private void playSoundShifted(SoundEvent event, float pitch, float volume, CallbackInfo ci) {
|
||||||
if (this.contraption != null && (!self.isSilent() || self instanceof PlayerEntity)) {
|
if (this.contraption != null && (!self.isSilent() || self instanceof PlayerEntity)) {
|
||||||
double x = self.getX();
|
double x = self.getX();
|
||||||
|
|
|
@ -17,8 +17,7 @@ public class FixNormalScalingMixin {
|
||||||
* applied, which negates the matrix again, resulting in the matrix being the
|
* applied, which negates the matrix again, resulting in the matrix being the
|
||||||
* same as in the beginning.
|
* 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)
|
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/vector/Matrix3f;mul(F)V", shift = Shift.AFTER), method = "scale(FFF)V", cancellable = true)
|
||||||
// At mul(F)V, method: scale(FFF)V
|
|
||||||
private void returnAfterNegate(float x, float y, float z, CallbackInfo ci) {
|
private void returnAfterNegate(float x, float y, float z, CallbackInfo ci) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
@ -30,8 +29,7 @@ public class FixNormalScalingMixin {
|
||||||
* that would invert all normals. Additionally, Minecraft's fastInverseCbrt method
|
* that would invert all normals. Additionally, Minecraft's fastInverseCbrt method
|
||||||
* does not work for negative numbers.
|
* does not work for negative numbers.
|
||||||
*/
|
*/
|
||||||
@ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;fastInverseCbrt(F)F"), method = "scale(FFF)V")
|
@ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;fastInvCubeRoot(F)F"), method = "scale(FFF)V")
|
||||||
// at fastInvCubeRoot(F)F, method: fastInvCubeRoot(F)F
|
|
||||||
private float absInvCbrtInput(float input) {
|
private float absInvCbrtInput(float input) {
|
||||||
return Math.abs(input);
|
return Math.abs(input);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public abstract class HeavyBootsOnPlayerMixin extends AbstractClientPlayerEntity
|
||||||
super(p_i50991_1_, p_i50991_2_);
|
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) {
|
public void noSwimmingWithHeavyBootsOn(CallbackInfoReturnable<Boolean> cir) {
|
||||||
CompoundNBT persistentData = getPersistentData();
|
CompoundNBT persistentData = getPersistentData();
|
||||||
if (persistentData.contains("HeavyBoots"))
|
if (persistentData.contains("HeavyBoots"))
|
||||||
|
|
|
@ -18,11 +18,11 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@Mixin(Minecraft.class)
|
@Mixin(Minecraft.class)
|
||||||
public class WindowResizeMixin {
|
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) {
|
private void updateWindowSize(CallbackInfo ci) {
|
||||||
UIRenderHelper.updateWindowSize(mainWindow);
|
UIRenderHelper.updateWindowSize(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue