Allow most hostile entities to exist in peaceful
- Hostile entities won't be auto-deleted in peaceful mode - Note, this doesn't mean hostile entities can spawn
This commit is contained in:
parent
1b6da05a0c
commit
377c648be6
3 changed files with 17 additions and 1 deletions
|
@ -0,0 +1,15 @@
|
||||||
|
package com.vesui.peasymode.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.entity.mob.HostileEntity;
|
||||||
|
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(HostileEntity.class)
|
||||||
|
public abstract class ModHostileEntity {
|
||||||
|
@Inject(method = "isDisallowedInPeaceful", at = @At("HEAD"), cancellable = true, expect = 1)
|
||||||
|
protected void onIsDisallowedInPeaceful(CallbackInfoReturnable<Boolean> ci) {
|
||||||
|
ci.setReturnValue(false);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
"id": "peasymode",
|
"id": "peasymode",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
|
|
||||||
"name": "Peaceful Easy Mode",
|
"name": "Peasy Mode",
|
||||||
"description": "Hostile mobs will no longer target you in easy mode. Allows you to get hostile mob drops but keep the difficulty of peaceful mode.",
|
"description": "Hostile mobs will no longer target you in easy mode. Allows you to get hostile mob drops but keep the difficulty of peaceful mode.",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Vesui"
|
"Vesui"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"package": "com.vesui.peasymode.mixin",
|
"package": "com.vesui.peasymode.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
"ModHostileEntity",
|
||||||
"ModLivingEntity"
|
"ModLivingEntity"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
|
|
Reference in a new issue