-
-
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.
Seems that interface mixins are still buggy, works in the IDE but not in practice! Sadly this makes the fix less compatible for new bucketable mobs currently, so I do want to look into it.
- Loading branch information
Showing
4 changed files
with
71 additions
and
3 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
32 changes: 32 additions & 0 deletions
32
.../carpetfixes/mixins/entityFixes/bucketableLeashDetach/AxolotlEntity_leashDetachMixin.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,32 @@ | ||
package carpetfixes.mixins.entityFixes.bucketableLeashDetach; | ||
|
||
import carpetfixes.CFSettings; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.passive.AnimalEntity; | ||
import net.minecraft.entity.passive.AxolotlEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.Hand; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(AxolotlEntity.class) | ||
public abstract class AxolotlEntity_leashDetachMixin extends AnimalEntity { | ||
|
||
protected AxolotlEntity_leashDetachMixin(EntityType<? extends AnimalEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
|
||
@Inject( | ||
method = "interactMob", | ||
at = @At("RETURN") | ||
) | ||
private void interactMob(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) { | ||
if (CFSettings.bucketableMobsNotDetachingLeashesFix && this.isLeashed() && cir.getReturnValue().isAccepted()) | ||
this.detachLeash(false,true); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ava/carpetfixes/mixins/entityFixes/bucketableLeashDetach/FishEntity_leashDetachMixin.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,34 @@ | ||
package carpetfixes.mixins.entityFixes.bucketableLeashDetach; | ||
|
||
import carpetfixes.CFSettings; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.mob.WaterCreatureEntity; | ||
import net.minecraft.entity.passive.FishEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.Hand; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(FishEntity.class) | ||
public abstract class FishEntity_leashDetachMixin extends WaterCreatureEntity { | ||
|
||
protected FishEntity_leashDetachMixin(EntityType<? extends WaterCreatureEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
// Added to fish in-case some mod makes it possible to leash fish | ||
|
||
|
||
@Inject( | ||
method = "interactMob", | ||
at = @At("RETURN") | ||
) | ||
private void interactMob(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) { | ||
if (CFSettings.bucketableMobsNotDetachingLeashesFix && this.isLeashed() && cir.getReturnValue().isAccepted()) | ||
this.detachLeash(false,true); | ||
} | ||
} |
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