generated from Fallen-Breath/fabric-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added rule "fixedTickMemoriesEntityAI"
- Loading branch information
1 parent
ac734fb
commit 32b3784
Showing
7 changed files
with
100 additions
and
7 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
61 changes: 61 additions & 0 deletions
61
src/main/java/com/vulpeus/vulpeus_carpet/mixins/fixedTickMemoriesEntityAI/MixinMemory.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,61 @@ | ||
/* | ||
* This file is part of the VulpeusCarpet project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 VulpeusServer and contributors | ||
* | ||
* VulpeusCarpet is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* VulpeusCarpet is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with VulpeusCarpet. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.vulpeus.vulpeus_carpet.mixins.fixedTickMemoriesEntityAI; | ||
|
||
import com.vulpeus.vulpeus_carpet.VulpeusCarpetSettings; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Condition; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Restriction; | ||
import net.minecraft.entity.ai.brain.Memory; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Restriction(require = @Condition(value = "minecraft", versionPredicates = "<=1.20.1")) | ||
@Mixin(Memory.class) | ||
public abstract class MixinMemory { | ||
|
||
@Unique | ||
private boolean tickFlag = false; | ||
|
||
@Shadow | ||
public abstract void tick(); | ||
|
||
@Inject(method = "isExpired", at = @At(value = "HEAD", target = "Lnet/minecraft/entity/ai/brain/Brain;tickMemories()V")) | ||
public void isExpired(CallbackInfoReturnable<Boolean> cir) { | ||
if (VulpeusCarpetSettings.fixedTickMemoriesEntityAI) { | ||
this.tickFlag = true; | ||
tick(); | ||
} | ||
} | ||
|
||
@Inject(method = "tick", at = @At(value = "HEAD", target = "Lnet/minecraft/entity/ai/brain/Brain;tickMemories()V"), cancellable = true) | ||
public void tick(CallbackInfo ci) { | ||
if (VulpeusCarpetSettings.fixedTickMemoriesEntityAI && this.tickFlag) { | ||
this.tickFlag = false; | ||
ci.cancel(); | ||
} | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/vulpeus/vulpeus_carpet/utils/DummyClass.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,24 @@ | ||
/* | ||
* This file is part of the VulpeusCarpet project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 VulpeusServer and contributors | ||
* | ||
* VulpeusCarpet is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* VulpeusCarpet is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with VulpeusCarpet. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.vulpeus.vulpeus_carpet.utils; | ||
|
||
public class DummyClass { | ||
} |
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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# Fabric Properties | ||
# check these on https://fallen-breath.github.io/fabric-versions/?&version=1.20.1 | ||
minecraft_version=1.20.1 | ||
yarn_mappings=1.20.1+build.10 | ||
yarn_mappings=1.20.1+build.2 | ||
|
||
# Fabric Mod Metadata | ||
minecraft_dependency=>=1.20.1 | ||
minecraft_dependency=>=1.20 | ||
|
||
# Build Information | ||
# The target mc versions for the mod during mod publishing, separated with \n | ||
game_versions=1.20\n1.20.1 | ||
|
||
# Dependencies | ||
fabric_api_version=0.92.2+1.20.1 | ||
carpet_version=1.20.2-1.4.118+v230921 | ||
carpet_version=1.20-1.4.112+v230608 |