summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeuin <[email protected]>2020-12-18 20:52:04 +0800
committerKeuin <[email protected]>2020-12-18 20:52:04 +0800
commitac5bdf4a3ca555fa4638d6fad6b06b9941ad3ba2 (patch)
treec995e65c2619e707260fb9a04500fb5cc25b031c /src
parentdc20a92e15d43bc87a97fc418475870311f300c2 (diff)
First version: implemented disabling fish schooling.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java17
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/DisableFishSchooling.java21
-rw-r--r--src/main/resources/assets/ohmyvanillamc/icon.pngbin0 -> 453 bytes
-rw-r--r--src/main/resources/fabric.mod.json33
-rw-r--r--src/main/resources/ohmyvanillamc.mixins.json12
5 files changed, 83 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java b/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java
new file mode 100644
index 0000000..c1dc4af
--- /dev/null
+++ b/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java
@@ -0,0 +1,17 @@
+package com.keuin.ohmyvanillamc;
+
+import net.fabricmc.api.ModInitializer;
+
+public class OhMyVanillaMinecraft implements ModInitializer {
+
+ public static boolean disableFishSchooling = true;
+
+ @Override
+ public void onInitialize() {
+ // This code runs as soon as Minecraft is in a mod-load-ready state.
+ // However, some things (like resources) may still be uninitialized.
+ // Proceed with mild caution.
+
+ System.out.println("OhMyVanillaMinecraft is loading...");
+ }
+}
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableFishSchooling.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableFishSchooling.java
new file mode 100644
index 0000000..28342c9
--- /dev/null
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableFishSchooling.java
@@ -0,0 +1,21 @@
+package com.keuin.ohmyvanillamc.mixin;
+
+import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft;
+import net.minecraft.entity.passive.SchoolingFishEntity;
+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(SchoolingFishEntity.class)
+public class DisableFishSchooling {
+ /**
+ * @reason To disable SchoolingFish schooling.
+ * @author trueKeuin
+ */
+ @Inject(method = "moveTowardLeader()V", at = @At("HEAD"))
+ protected void moveTowardLeader(CallbackInfo ci) {
+ if (OhMyVanillaMinecraft.disableFishSchooling)
+ ci.cancel();
+ }
+}
diff --git a/src/main/resources/assets/ohmyvanillamc/icon.png b/src/main/resources/assets/ohmyvanillamc/icon.png
new file mode 100644
index 0000000..047b91f
--- /dev/null
+++ b/src/main/resources/assets/ohmyvanillamc/icon.png
Binary files differ
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
new file mode 100644
index 0000000..1ad45f2
--- /dev/null
+++ b/src/main/resources/fabric.mod.json
@@ -0,0 +1,33 @@
+{
+ "schemaVersion": 1,
+ "id": "ohmyvanillamc",
+ "version": "${version}",
+ "name": "Oh My Vanilla Minecraft",
+ "description": "What's wrong with my Minecraft?",
+ "authors": [
+ "trueKeuin"
+ ],
+ "contact": {
+ "homepage": "https://www.keuin.cc",
+ "sources": "https://github.com/keuin/OhMyVanillaMinecraft"
+ },
+ "license": "MIT",
+ "icon": "assets/ohmyvanillamc/icon.png",
+ "environment": "*",
+ "entrypoints": {
+ "main": [
+ "com.keuin.ohmyvanillamc.OhMyVanillaMinecraft"
+ ]
+ },
+ "mixins": [
+ "ohmyvanillamc.mixins.json"
+ ],
+ "depends": {
+ "fabricloader": ">=0.7.4",
+ "fabric": "*",
+ "minecraft": "1.15.x"
+ },
+ "suggests": {
+ "another-mod": "*"
+ }
+}
diff --git a/src/main/resources/ohmyvanillamc.mixins.json b/src/main/resources/ohmyvanillamc.mixins.json
new file mode 100644
index 0000000..c6ef57f
--- /dev/null
+++ b/src/main/resources/ohmyvanillamc.mixins.json
@@ -0,0 +1,12 @@
+{
+ "required": true,
+ "minVersion": "0.8",
+ "package": "com.keuin.ohmyvanillamc.mixin",
+ "compatibilityLevel": "JAVA_8",
+ "mixins": [
+ "DisableFishSchooling"
+ ],
+ "injectors": {
+ "defaultRequire": 1
+ }
+}