-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Rule:
hopperUpdateFix
, petsBreakLeadsDuringReloadFix
, `slee…
…pingDelaysFallDamageFix`
- Loading branch information
Showing
6 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/carpetfixes/mixins/blockUpdates/HopperBlock_MissingUpdateMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package carpetfixes.mixins.blockUpdates; | ||
|
||
import carpetfixes.CarpetFixesSettings; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.HopperBlock; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
|
||
@Mixin(HopperBlock.class) | ||
public class HopperBlock_MissingUpdateMixin extends Block { | ||
|
||
public HopperBlock_MissingUpdateMixin(Settings settings) {super(settings);} | ||
|
||
@ModifyArg(method = "updateEnabled(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"), index = 2) | ||
protected int hopperUpdate(int value) { return CarpetFixesSettings.hopperUpdateFix ? 5 : 4; } | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/carpetfixes/mixins/entityFixes/LivingEntity_sleepingKillsMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package carpetfixes.mixins.entityFixes; | ||
|
||
import carpetfixes.CarpetFixesSettings; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(LivingEntity.class) | ||
public abstract class LivingEntity_sleepingKillsMixin extends Entity { | ||
|
||
public LivingEntity_sleepingKillsMixin(EntityType<?> type, World world) { super(type, world); } | ||
|
||
@Inject(method= "setPositionInBed(Lnet/minecraft/util/math/BlockPos;)V",at=@At("HEAD")) | ||
private void saferSleep(BlockPos pos, CallbackInfo ci) { | ||
if (CarpetFixesSettings.sleepingDelaysFallDamageFix) { | ||
this.fallDistance = 0.0F; | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/carpetfixes/mixins/entityFixes/MobEntity_leashUpdateOrderMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package carpetfixes.mixins.entityFixes; | ||
|
||
import carpetfixes.CarpetFixesSettings; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.mob.MobEntity; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(MobEntity.class) | ||
public abstract class MobEntity_leashUpdateOrderMixin extends LivingEntity { | ||
|
||
protected MobEntity_leashUpdateOrderMixin(EntityType<? extends LivingEntity> entityType, World world) { super(entityType, world); } | ||
|
||
@Shadow protected void updateLeash() {} | ||
|
||
@Inject(method= "tick()V",at=@At("HEAD"),cancellable = true) | ||
public void dontTickEarly(CallbackInfo ci) { | ||
if (CarpetFixesSettings.petsBreakLeadsDuringReloadFix && !this.world.isClient) { | ||
this.updateLeash(); | ||
} | ||
} | ||
|
||
@Redirect(method= "tick()V",at=@At(value="INVOKE",target="Lnet/minecraft/entity/mob/MobEntity;updateLeash()V")) | ||
public void weAlreadyUpdatedLeash(MobEntity mobEntity) { | ||
if (!CarpetFixesSettings.petsBreakLeadsDuringReloadFix) { | ||
this.updateLeash(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters