Skip to content

Commit

Permalink
Added Rule: hopperUpdateFix, petsBreakLeadsDuringReloadFix, `slee…
Browse files Browse the repository at this point in the history
…pingDelaysFallDamageFix`
  • Loading branch information
FxMorin committed Jun 7, 2021
1 parent e75dca7 commit 159361e
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ Makes it so that sponges give block updates when absorbing water
* Categories: `CARPETFIXES`,`BUGFIX`
* Fixes: [MC-220636](https://bugs.mojang.com/browse/MC-220636)

## hopperUpdateFix
Makes it so that hoppers give block updates when placed while powered
* Type: `boolean`
* Default value: `false`
* Required options: `false`,`true`
* Categories: `CARPETFIXES`,`BUGFIX`
* Fixes: [2No2Name's video](https://www.youtube.com/watch?v=QVOONJ1OY44)

## worldgenIncorrectOrderFix
Fixes World Modifying tasks to be before decorations
* Type: `boolean`
Expand Down Expand Up @@ -112,6 +120,14 @@ Fixes cats sometimes breaking there leads after giving a gift
* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL`
* Fixes: [MC-202607](https://bugs.mojang.com/browse/MC-202607)

## petsBreakLeadsDuringReloadFix
Fixes Leashed pets teleporting to the player when reloaded
* Type: `boolean`
* Default value: `false`
* Required options: `false`,`true`
* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL`
* Fixes: [MC-173303](https://bugs.mojang.com/browse/MC-173303)

## endermanDontUpdateOnPlaceFix
Fixes enderman not updating the block they place correctly
* Type: `boolean`
Expand Down Expand Up @@ -162,6 +178,14 @@ Fixes getting kicked for flying too long when jumping and riding an entity
* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL`
* Fixes: [MC-98727](https://bugs.mojang.com/browse/MC-98727)

## sleepingDelaysFallDamageFix
Fixes fall damage being delayed by sleeping, fall damage will be removed instead
* Type: `boolean`
* Default value: `false`
* Required options: `false`,`true`
* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL`
* Fixes: [MC-19830](https://bugs.mojang.com/browse/MC-19830)

## tntCantUseNetherPortalsFix
Fixes TNT Entity not being able to go through nether portals
* Type: `boolean`
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/carpetfixes/CarpetFixesSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ public enum PresetSettings {
)
public static boolean spongeUpdateFix = false;

//By FX - PR0CESS
@Rule(
desc = "Makes it so that hoppers give block updates when placed while powered",
extra = "Fixes https://www.youtube.com/watch?v=QVOONJ1OY44",
category = {CARPETFIXES,BUGFIX}
)
public static boolean hopperUpdateFix = false;

//By FX - PR0CESS
/*
To Be Implemented
Expand Down Expand Up @@ -158,6 +166,14 @@ public enum PresetSettings {
)
public static boolean catsBreakLeadsDuringGiftFix = false;

//by FX - PR0CESS
@Rule(
desc = "Fixes Leashed pets teleporting to the player when reloaded",
extra = "Fixes [MC-173303](https://bugs.mojang.com/browse/MC-173303)",
category = {CARPETFIXES,BUGFIX,EXPERIMENTAL}
)
public static boolean petsBreakLeadsDuringReloadFix = false;

//by FX - PR0CESS
@Rule(
desc = "Fixes enderman not updating the block they place correctly",
Expand Down Expand Up @@ -206,6 +222,14 @@ public enum PresetSettings {
)
public static boolean mountingFlyingTooLongFix = false;

//by FX - PR0CESS
@Rule(
desc = "Fixes fall damage being delayed by sleeping, fall damage will be removed instead",
extra = "Fixes [MC-19830](https://bugs.mojang.com/browse/MC-19830)",
category = {CARPETFIXES,BUGFIX}
)
public static boolean sleepingDelaysFallDamageFix = false;

//by FX - PR0CESS
@Rule(
desc = "Fixes TNT Entity not being able to go through nether portals",
Expand Down
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; }
}
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;
}
}
}
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();
}
}
}
3 changes: 3 additions & 0 deletions src/main/resources/carpetfixes.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"blockUpdates.AbstractRailBlock_invalidUpdateMixin",
"blockUpdates.AbstractRailBlock_missingUpdateAfterPushMixin",
"blockUpdates.AbstractRailBlock_missingUpdateOnPushMixin",
"blockUpdates.HopperBlock_MissingUpdateMixin",
"blockUpdates.SpongeBlock_MissingUpdateMixin",
"blockUpdates.World_blockUpdateOrderMixin",
"coreSystemFixes.Biome_featureOrderMixin",
Expand All @@ -34,7 +35,9 @@
"entityFixes.EntityAccessorMixin",
"entityFixes.FallingBlockEntity_netherPortalMixin",
"entityFixes.ItemEntity_shulkerDroppingMixin",
"entityFixes.LivingEntity_sleepingKillsMixin",
"entityFixes.LivingEntity_VisibilityCheckMixin",
"entityFixes.MobEntity_leashUpdateOrderMixin",
"entityFixes.ShulkerEntity_CustomDataMixin",
"entityFixes.TntEntity_netherPortalMixin",
"itemFixes.ItemStack_repairCostMixin",
Expand Down

0 comments on commit 159361e

Please sign in to comment.