diff options
Diffstat (limited to 'src')
15 files changed, 333 insertions, 58 deletions
diff --git a/src/main/java/com/dulkirmod/DulkirMod.java b/src/main/java/com/dulkirmod/DulkirMod.java deleted file mode 100644 index 937031f..0000000 --- a/src/main/java/com/dulkirmod/DulkirMod.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.dulkirmod; - -import com.dulkirmod.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; - -import javax.swing.text.JTextComponent; - -@Mod(modid = "dulkirmod", version = "1.0.0") -public class DulkirMod { - 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/dulkirmod/Settings.java b/src/main/java/com/dulkirmod/Settings.java deleted file mode 100644 index 316aa2f..0000000 --- a/src/main/java/com/dulkirmod/Settings.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.dulkirmod; - -public class Settings { - public static boolean EnchantRune = true; - public static boolean HealerFairy = true; -} diff --git a/src/main/java/com/dulkirmod/mixin/MixinRendererManager.java b/src/main/java/dulkirmod/mixins/MixinRendererManager.java index 359b67e..b545107 100644 --- a/src/main/java/com/dulkirmod/mixin/MixinRendererManager.java +++ b/src/main/java/dulkirmod/mixins/MixinRendererManager.java @@ -1,6 +1,5 @@ -package com.dulkirmod.mixin; +package dulkirmod.mixins; -import com.dulkirmod.Settings; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; @@ -11,6 +10,7 @@ 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; +import dulkirmod.DulkirMod; @Mixin(RenderManager.class) public class MixinRendererManager { @@ -26,7 +26,7 @@ public class MixinRendererManager { boolean p_147939_10_, CallbackInfoReturnable<Boolean> cir ) { - if(!Settings.HealerFairy) return; + if(!DulkirMod.Companion.getConfig().getHideHealerFairy()) return; if (entity instanceof EntityArmorStand) { if (((EntityArmorStand) entity).getHeldItem() != null && ((EntityArmorStand) entity).getHeldItem().getItem() == Items.skull) { ItemStack stack = ((EntityArmorStand) entity).getHeldItem(); diff --git a/src/main/java/com/dulkirmod/mixin/MixinWorld.java b/src/main/java/dulkirmod/mixins/MixinWorld.java index 8ae76cd..97133e1 100644 --- a/src/main/java/com/dulkirmod/mixin/MixinWorld.java +++ b/src/main/java/dulkirmod/mixins/MixinWorld.java @@ -1,11 +1,11 @@ -package com.dulkirmod.mixin; +package dulkirmod.mixins; 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.dulkirmod.Settings; +import dulkirmod.DulkirMod; @Mixin(World.class) public class MixinWorld { @@ -13,7 +13,10 @@ 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) { + if (particleID == 25 && DulkirMod.Companion.getConfig().getHideEnchantRune()) { + ci.cancel(); + } + else if (particleID == 34 && DulkirMod.Companion.getConfig().getHideHeartParticles()) { ci.cancel(); } } diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt new file mode 100644 index 0000000..6217b38 --- /dev/null +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -0,0 +1,92 @@ +package dulkirmod + +import dulkirmod.command.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.GuiScreen +import net.minecraft.client.settings.KeyBinding +import net.minecraftforge.common.MinecraftForge +import net.minecraftforge.fml.client.registry.ClientRegistry +import net.minecraftforge.fml.common.Mod +import net.minecraftforge.fml.common.event.FMLInitializationEvent +import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent +import net.minecraftforge.fml.common.gameevent.TickEvent +import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent +import org.lwjgl.input.Keyboard +import dulkirmod.config.Config +import net.minecraftforge.client.ClientCommandHandler +import java.io.File +import kotlin.coroutines.EmptyCoroutineContext + +@Mod( + modid = DulkirMod.MOD_ID, + name = DulkirMod.MOD_NAME, + version = DulkirMod.MOD_VERSION, + clientSideOnly = true +) +class DulkirMod { + + @Mod.EventHandler + fun preInit(event: FMLPreInitializationEvent) { + val directory = File(event.modConfigurationDirectory, "dulkirmod") + directory.mkdirs() + + // REGISTER COMMANDS HERE // Help Commands + ClientCommandHandler.instance.registerCommand(HelpCommand()) + + // General + ClientCommandHandler.instance.registerCommand(EnchantRuneCommand()) + ClientCommandHandler.instance.registerCommand(FairyCommand()) + ClientCommandHandler.instance.registerCommand(SettingsCommand()) + } + + @Mod.EventHandler + fun onInit(event: FMLInitializationEvent) { + config.init() + + + listOf( + this, + ).forEach(MinecraftForge.EVENT_BUS::register) + + keyBinds.forEach(ClientRegistry::registerKeyBinding) + } + + @Mod.EventHandler + fun postInit(event: FMLLoadCompleteEvent) = scope.launch(Dispatchers.IO) { + + } + + @SubscribeEvent + fun onTick(event: ClientTickEvent) { + if (event.phase != TickEvent.Phase.START || display == null) return + mc.displayGuiScreen(display) + display = null + } + + @SubscribeEvent + fun onKey(event: KeyInputEvent) { + if (keyBinds[0].isPressed) display = config.gui() + } + + companion object { + const val MOD_ID = "dulkirmod" + const val MOD_NAME = "Dulkir Mod" + const val MOD_VERSION = "0.0.0" + const val CHAT_PREFIX = "§b§l<§fDulkirMod§b§l>§r" + + val mc: Minecraft = Minecraft.getMinecraft() + var config = Config + var display: GuiScreen? = null + val scope = CoroutineScope(EmptyCoroutineContext) + + val keyBinds = arrayOf( + KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"), + ) + } +} diff --git a/src/main/kotlin/dulkirmod/command/ClientCommandBase.kt b/src/main/kotlin/dulkirmod/command/ClientCommandBase.kt new file mode 100644 index 0000000..73a4fea --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/ClientCommandBase.kt @@ -0,0 +1,18 @@ +package dulkirmod.command + +import net.minecraft.command.CommandBase +import net.minecraft.command.ICommandSender + +abstract class ClientCommandBase protected constructor(private val name: String) : CommandBase() { + override fun getCommandName(): String { + return name + } + + override fun getCommandUsage(sender: ICommandSender): String { + return "/$name" + } + + override fun canCommandSenderUseCommand(sender: ICommandSender): Boolean { + return true + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/EnchantRuneCommand.kt b/src/main/kotlin/dulkirmod/command/EnchantRuneCommand.kt new file mode 100644 index 0000000..40cdc6c --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/EnchantRuneCommand.kt @@ -0,0 +1,24 @@ +package dulkirmod.command + +import dulkirmod.DulkirMod.Companion.config +import dulkirmod.DulkirMod.Companion.mc +import net.minecraft.command.CommandException +import net.minecraft.command.ICommandSender +import net.minecraft.util.ChatComponentText +import net.minecraft.util.EnumChatFormatting + +class EnchantRuneCommand : ClientCommandBase("enchantrune") { + @Throws(CommandException::class) + override fun processCommand(sender: ICommandSender, args: Array<String>) { + mc.thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.BLUE.toString() + "" + "Enchant rune hider toggled - now: " + + EnumChatFormatting.GREEN + !config.hideEnchantRune + ) + ) + config.hideEnchantRune = !config.hideEnchantRune + + config.markDirty() + config.writeData() + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/FairyCommand.kt b/src/main/kotlin/dulkirmod/command/FairyCommand.kt new file mode 100644 index 0000000..ba7a74b --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/FairyCommand.kt @@ -0,0 +1,24 @@ +package dulkirmod.command + +import dulkirmod.DulkirMod.Companion.config +import dulkirmod.DulkirMod.Companion.mc +import net.minecraft.command.CommandException +import net.minecraft.command.ICommandSender +import net.minecraft.util.ChatComponentText +import net.minecraft.util.EnumChatFormatting + +class FairyCommand : ClientCommandBase("fairy") { + @Throws(CommandException::class) + override fun processCommand(sender: ICommandSender, args: Array<String>) { + mc.thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.BLUE.toString() + "Healer fairy hider toggled - now: " + + EnumChatFormatting.GREEN + !config.hideHealerFairy + ) + ) + config.hideHealerFairy = !config.hideHealerFairy + + config.markDirty() + config.writeData() + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/HelpCommand.kt b/src/main/kotlin/dulkirmod/command/HelpCommand.kt new file mode 100644 index 0000000..804cb5c --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/HelpCommand.kt @@ -0,0 +1,28 @@ +package dulkirmod.command + +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 + +class HelpCommand : ClientCommandBase("dulkirhelp") { + @Throws(CommandException::class) + override fun processCommand(sender: ICommandSender, args: Array<String>) { + Minecraft.getMinecraft().thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.GOLD.toString() + "" + EnumChatFormatting.BOLD + " HI THIS IS DULKIRMOD!" + ) + ) + Minecraft.getMinecraft().thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.GRAY.toString() + "/enchantrune - toggles enchant rune visibility." + ) + ) + Minecraft.getMinecraft().thePlayer.addChatMessage( + ChatComponentText( + EnumChatFormatting.GRAY.toString() + "/fairy - toggles healer fairy visibility." + ) + ) + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/SettingsCommand.kt b/src/main/kotlin/dulkirmod/command/SettingsCommand.kt new file mode 100644 index 0000000..5f16652 --- /dev/null +++ b/src/main/kotlin/dulkirmod/command/SettingsCommand.kt @@ -0,0 +1,10 @@ +package dulkirmod.command + +import dulkirmod.DulkirMod +import net.minecraft.command.ICommandSender + +class SettingsCommand : ClientCommandBase("dulkir") { + override fun processCommand(sender: ICommandSender?, args: Array<out String>?) { + DulkirMod.display = DulkirMod.config.gui() + } +}
\ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt new file mode 100644 index 0000000..859fd9d --- /dev/null +++ b/src/main/kotlin/dulkirmod/config/Config.kt @@ -0,0 +1,43 @@ +package dulkirmod.config + +import gg.essential.vigilance.Vigilant +import gg.essential.vigilance.data.Category +import gg.essential.vigilance.data.Property +import gg.essential.vigilance.data.PropertyType +import gg.essential.vigilance.data.SortingBehavior +import dulkirmod.DulkirMod.Companion.display +import java.awt.Color +import java.io.File +import java.util.function.Consumer + +object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod") { + + @Property( + type = PropertyType.SWITCH, + name = "Hide Enchant Rune Particles", + description = "ugly ass", + category = "General" + ) + var hideEnchantRune = false + + @Property( + type = PropertyType.SWITCH, + name = "Hide Healer fairy", + description = "Probably disable when not in dungeons for now. Will fix later.", + category = "General" + ) + var hideHealerFairy = false + + @Property( + type = PropertyType.SWITCH, + name = "Hide Heart Particles", + description = "Useful for hyperion and healer bullshit", + category = "General" + ) + var hideHeartParticles = false + + fun init() { + initialize() + } + +} diff --git a/src/main/kotlin/dulkirmod/events/Events.kt b/src/main/kotlin/dulkirmod/events/Events.kt new file mode 100644 index 0000000..bc4654d --- /dev/null +++ b/src/main/kotlin/dulkirmod/events/Events.kt @@ -0,0 +1,43 @@ +package dulkirmod.events + +import net.minecraft.client.gui.inventory.GuiContainer +import net.minecraft.client.model.ModelBase +import net.minecraft.entity.EntityLivingBase +import net.minecraft.inventory.Container +import net.minecraft.inventory.Slot +import net.minecraft.network.Packet +import net.minecraftforge.fml.common.eventhandler.Cancelable +import net.minecraftforge.fml.common.eventhandler.Event + +open class ClickEvent : Event() { + @Cancelable + class LeftClickEvent : ClickEvent() + + @Cancelable + class RightClickEvent : ClickEvent() +} + +open class GuiContainerEvent(val container: Container, val gui: GuiContainer) : Event() { + @Cancelable + class DrawSlotEvent(container: Container, gui: GuiContainer, var slot: Slot) : + GuiContainerEvent(container, gui) + + @Cancelable + class SlotClickEvent(container: Container, gui: GuiContainer, var slot: Slot?, var slotId: Int) : + GuiContainerEvent(container, gui) +} + +@Cancelable +class ReceivePacketEvent(val packet: Packet<*>) : Event() + +@Cancelable +class RenderLivingEntityEvent( + var entity: EntityLivingBase, + var p_77036_2_: Float, + var p_77036_3_: Float, + var p_77036_4_: Float, + var p_77036_5_: Float, + var p_77036_6_: Float, + var scaleFactor: Float, + var modelBase: ModelBase +) : Event() diff --git a/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt b/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt new file mode 100644 index 0000000..ee21437 --- /dev/null +++ b/src/main/kotlin/dulkirmod/forge/FMLLoadingPlugin.kt @@ -0,0 +1,28 @@ +package dulkirmod.forge + +import net.minecraftforge.common.ForgeVersion +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion +import org.spongepowered.asm.launch.MixinBootstrap +import org.spongepowered.asm.mixin.MixinEnvironment +import org.spongepowered.asm.mixin.Mixins + +@MCVersion(ForgeVersion.mcVersion) +class FMLLoadingPlugin : IFMLLoadingPlugin { + + override fun getASMTransformerClass(): Array<String> = emptyArray() + + override fun getModContainerClass(): String? = null + + override fun getSetupClass(): String? = null + + override fun injectData(data: Map<String, Any>) {} + + override fun getAccessTransformerClass(): String? = null + + init { + MixinBootstrap.init() + Mixins.addConfiguration("mixins.dulkirmod.json") + MixinEnvironment.getCurrentEnvironment().obfuscationContext = "searge" + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 074b24c..f735008 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,18 +1,12 @@ [ { - "modid": "dulkirmod", - "name": "Dulkir Mod", - "description": "I steal nopo's code", - "version": "1.0.0", - "mcversion": "1.8.9", - "url": "https://github.com/romangraef/Forge1.8.9Template/", - "updateUrl": "", - "authorList": [ - "Dulkir", "Nopo" - ], - "credits": "", - "logoFile": "", - "screenshots": [], - "dependencies": [] + "modid": "dulkirmod", + "name": "Dulkir Mod", + "description": "The worst skyblock mod.", + "version": "${version}", + "mcversion": "${mcversion}", + "authorList": [ + "Dulkir", "Nopo" + ] } ] diff --git a/src/main/resources/mixins.dulkirmod.json b/src/main/resources/mixins.dulkirmod.json index 54215e8..bff8106 100644 --- a/src/main/resources/mixins.dulkirmod.json +++ b/src/main/resources/mixins.dulkirmod.json @@ -1,12 +1,12 @@ { - "package": "com.dulkirmod.mixin", - "refmap": "mixins.dulkirmod.refmap.json", - "minVersion": "0.7", + "minVersion": "0.6", "compatibilityLevel": "JAVA_8", - "mixins": [ - "MixinWorld" - ], + "package": "dulkirmod.mixins", + "refmap": "mixins.skyblockclient.refmap.json", "client": [ "MixinRendererManager" + ], + "mixins": [ + "MixinWorld" ] } |