aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authoringle <inglettronald@gmail.com>2022-09-23 03:49:56 -0500
committeringle <inglettronald@gmail.com>2022-09-23 03:49:56 -0500
commit033de65a180b64fc645036d142589f57956ea263 (patch)
tree301fcca8a63348313f66193932c60f6c19c95024 /src/main/java/com
parentcfcdcda458b2fe9fbe33bb81759dfd4e4fb3bcc0 (diff)
downloadDulkirMod-033de65a180b64fc645036d142589f57956ea263.tar.gz
DulkirMod-033de65a180b64fc645036d142589f57956ea263.tar.bz2
DulkirMod-033de65a180b64fc645036d142589f57956ea263.zip
Nothing works yet :+1:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/example/ExampleMod.java9
-rw-r--r--src/main/java/com/example/Settings.java5
-rw-r--r--src/main/java/com/example/commands/ClientCommandBase.java27
-rw-r--r--src/main/java/com/example/commands/Commands.java14
-rw-r--r--src/main/java/com/example/commands/EnchantRuneCommand.java23
-rw-r--r--src/main/java/com/example/commands/HelpCommand.java23
-rw-r--r--src/main/java/com/example/mixin/MixinGuiMainMenu.java16
-rw-r--r--src/main/java/com/example/mixin/MixinRendererManager.java49
-rw-r--r--src/main/java/com/example/mixin/MixinWorld.java21
9 files changed, 171 insertions, 16 deletions
diff --git a/src/main/java/com/example/ExampleMod.java b/src/main/java/com/example/ExampleMod.java
index 0e6967a..c43c2c5 100644
--- a/src/main/java/com/example/ExampleMod.java
+++ b/src/main/java/com/example/ExampleMod.java
@@ -1,13 +1,22 @@
package com.example;
+import com.example.commands.Commands;
import net.minecraft.init.Blocks;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
+import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@Mod(modid = "examplemod", version = "1.0.0")
public class ExampleMod {
+ public Commands commands;
+
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
System.out.println("Dirt: " + Blocks.dirt.getUnlocalizedName());
}
+
+ @Mod.EventHandler
+ public void preinit(FMLPreInitializationEvent event) {
+ this.commands = new Commands();
+ }
}
diff --git a/src/main/java/com/example/Settings.java b/src/main/java/com/example/Settings.java
new file mode 100644
index 0000000..e7576f4
--- /dev/null
+++ b/src/main/java/com/example/Settings.java
@@ -0,0 +1,5 @@
+package com.example;
+
+public class Settings {
+ public static boolean EnchantRune = true;
+}
diff --git a/src/main/java/com/example/commands/ClientCommandBase.java b/src/main/java/com/example/commands/ClientCommandBase.java
new file mode 100644
index 0000000..566fb6e
--- /dev/null
+++ b/src/main/java/com/example/commands/ClientCommandBase.java
@@ -0,0 +1,27 @@
+package com.example.commands;
+
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.ICommandSender;
+
+public abstract class ClientCommandBase extends CommandBase {
+ private final String name;
+
+ protected ClientCommandBase(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getCommandName() {
+ return name;
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + name;
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(ICommandSender sender) {
+ return true;
+ }
+}
diff --git a/src/main/java/com/example/commands/Commands.java b/src/main/java/com/example/commands/Commands.java
new file mode 100644
index 0000000..4a3db44
--- /dev/null
+++ b/src/main/java/com/example/commands/Commands.java
@@ -0,0 +1,14 @@
+package com.example.commands;
+
+import com.example.commands.HelpCommand;
+import net.minecraftforge.client.ClientCommandHandler;
+
+public class Commands {
+ public Commands() {
+ // Help Commands
+ ClientCommandHandler.instance.registerCommand(new HelpCommand());
+
+ // General
+ ClientCommandHandler.instance.registerCommand(new EnchantRuneCommand());
+ }
+} \ No newline at end of file
diff --git a/src/main/java/com/example/commands/EnchantRuneCommand.java b/src/main/java/com/example/commands/EnchantRuneCommand.java
new file mode 100644
index 0000000..98296ae
--- /dev/null
+++ b/src/main/java/com/example/commands/EnchantRuneCommand.java
@@ -0,0 +1,23 @@
+package com.example.commands;
+
+import com.example.Settings;
+import com.example.commands.ClientCommandBase;
+import net.minecraft.client.Minecraft;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class EnchantRuneCommand extends ClientCommandBase {
+
+ public EnchantRuneCommand() {
+ super("enchantrune");
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.BLACK+ "" + EnumChatFormatting.BOLD + "TOGGLED."));
+ Settings.EnchantRune = !Settings.EnchantRune;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/com/example/commands/HelpCommand.java b/src/main/java/com/example/commands/HelpCommand.java
new file mode 100644
index 0000000..603fbdc
--- /dev/null
+++ b/src/main/java/com/example/commands/HelpCommand.java
@@ -0,0 +1,23 @@
+package com.example.commands;
+
+import com.example.commands.ClientCommandBase;
+import net.minecraft.client.Minecraft;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class HelpCommand extends ClientCommandBase {
+
+ public HelpCommand() {
+ super("dulkir");
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.GOLD + "HI THIS IS DULKIRMOD"));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.GRAY + "/enchantrune - toggles enchant rune visibility."));
+ }
+} \ No newline at end of file
diff --git a/src/main/java/com/example/mixin/MixinGuiMainMenu.java b/src/main/java/com/example/mixin/MixinGuiMainMenu.java
deleted file mode 100644
index 47eee87..0000000
--- a/src/main/java/com/example/mixin/MixinGuiMainMenu.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.example.mixin;
-
-import net.minecraft.client.gui.GuiMainMenu;
-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(GuiMainMenu.class)
-public class MixinGuiMainMenu {
-
- @Inject(method = "initGui", at = @At("HEAD"))
- public void onInitGui(CallbackInfo ci) {
- System.out.println("Hello from Main Menu!");
- }
-}
diff --git a/src/main/java/com/example/mixin/MixinRendererManager.java b/src/main/java/com/example/mixin/MixinRendererManager.java
new file mode 100644
index 0000000..eae11fa
--- /dev/null
+++ b/src/main/java/com/example/mixin/MixinRendererManager.java
@@ -0,0 +1,49 @@
+package com.example.mixin;
+
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+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(RenderManager.class)
+public class MixinRendererManager {
+
+ @Inject(method = "doRenderEntity", at = @At("HEAD"))
+ public void doRender(
+ Entity entity,
+ double x,
+ double y,
+ double z,
+ float entityYaw,
+ float partialTicks,
+ boolean p_147939_10_,
+ CallbackInfoReturnable<Boolean> cir
+ ) {
+
+ if (entity instanceof EntityArmorStand) {
+ if (((EntityArmorStand) entity).getHeldItem() != null && ((EntityArmorStand) entity).getHeldItem().getItem() == Items.skull) {
+ ItemStack stack = ((EntityArmorStand) entity).getHeldItem();
+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("SkullOwner")) {
+ NBTTagCompound skullOwner = stack.getTagCompound().getCompoundTag("SkullOwner");
+ if (skullOwner.hasKey("Properties")) {
+ NBTTagCompound properties = skullOwner.getCompoundTag("Properties");
+ if (properties.hasKey("textures")) {
+ if ("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjM2UzMWNmYzY2NzMzMjc1YzQyZmNmYjVkOWE0NDM0MmQ2NDNiNTVjZDE0YzljNzdkMjczYTIzNTIifX19"
+ .equals(properties.getTagList("textures", 10).getCompoundTagAt(0).getString("Value")))
+ cir.cancel();
+ }
+
+ }
+
+ }
+
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/com/example/mixin/MixinWorld.java b/src/main/java/com/example/mixin/MixinWorld.java
new file mode 100644
index 0000000..9bacbcd
--- /dev/null
+++ b/src/main/java/com/example/mixin/MixinWorld.java
@@ -0,0 +1,21 @@
+package com.example.mixin;
+
+import net.minecraft.client.gui.GuiMainMenu;
+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;
+import com.example.Settings;
+
+@Mixin(World.class)
+public class MixinWorld {
+
+ @Inject(method = "spawnParticle(IZDDDDDD[I)V", at = @At("HEAD"), cancellable = true)
+ public void onInitGui(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord,
+ double xOffset, double yOffset, double zOffset, int[] p_175720_15_, CallbackInfo ci) {
+ if (particleID == 25 && Settings.EnchantRune) {
+ ci.cancel();
+ }
+ }
+}