generated from Polyfrost/OneConfigExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
442 additions
and
1,218 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
# gradle.properties file -- CHANGE THE VALUES STARTING WITH `mod.*` AND REMOVE THIS COMMENT. | ||
|
||
# Sets the name of your mod. | ||
mod.name=PolyCrosshair | ||
# Sets the id of your mod that mod loaders use to recognize it. | ||
mod.id=polycrosshair | ||
# Sets the version of your mod. Make sure to update this when you make changes according to semver. | ||
mod.version=1.0.3 | ||
# Sets the name of the jar file that you put in your 'mods' folder. | ||
mod.group=org.polyfrost | ||
|
||
# Gradle Configuration -- DO NOT TOUCH THESE VALUES. | ||
polyfrost.defaults.loom=3 | ||
org.gradle.daemon=true | ||
org.gradle.parallel=true | ||
org.gradle.configureoncommand=true | ||
org.gradle.parallel.threads=4 | ||
org.gradle.jvmargs=-Xmx2G | ||
org.gradle.jvmargs=-Xmx2G | ||
|
||
mod.group=org.polyfrost | ||
mod.id=polycrosshair | ||
mod.name=PolyCrosshair | ||
mod.version=2.0.0 |
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
7 changes: 0 additions & 7 deletions
7
src/dummy/java/cc/polyfrost/oneconfig/internal/assets/Images.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/dummy/java/cc/polyfrost/oneconfig/internal/config/OneConfigConfig.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/dummy/java/club/sk1er/patcher/config/OldPatcherConfig.java
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/main/java/org/polyfrost/crosshair/mixin/EntityRendererMixin.java
This file was deleted.
Oops, something went wrong.
16 changes: 3 additions & 13 deletions
16
src/main/java/org/polyfrost/crosshair/mixin/GuiIngameMixin.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 |
---|---|---|
@@ -1,25 +1,15 @@ | ||
package org.polyfrost.crosshair.mixin; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.GuiIngame; | ||
import org.polyfrost.crosshair.config.PolyCrosshairConfig; | ||
import org.polyfrost.crosshair.config.RenderConfig; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(GuiIngame.class) | ||
public class GuiIngameMixin { | ||
@Inject(method = "showCrosshair", at = @At("HEAD"), cancellable = true) | ||
private void check(CallbackInfoReturnable<Boolean> cir) { | ||
RenderConfig cfg = PolyCrosshairConfig.INSTANCE.getRenderConfig(); | ||
Minecraft mc = Minecraft.getMinecraft(); | ||
if (!PolyCrosshairConfig.INSTANCE.enabled) return; | ||
if ((!cfg.getShowInGuis() && mc.currentScreen != null) || (!cfg.getShowInThirdPerson() && mc.gameSettings.thirdPersonView != 0)) { | ||
cir.setReturnValue(false); | ||
} | ||
if ((cfg.getShowInSpectator() && mc.playerController.isSpectator()) || (cfg.getShowInDebug() && mc.gameSettings.showDebugInfo)) { | ||
cir.setReturnValue(true); | ||
} | ||
cir.setReturnValue(false); | ||
} | ||
} |
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,50 @@ | ||
package org.polyfrost.crosshair | ||
|
||
import org.polyfrost.oneconfig.api.config.v1.annotations.Include | ||
import org.polyfrost.oneconfig.api.config.v1.annotations.Switch | ||
import org.polyfrost.oneconfig.api.hud.v1.Hud | ||
import org.polyfrost.polyui.component.impl.Image | ||
import org.polyfrost.polyui.unit.Vec2 | ||
import org.polyfrost.polyui.utils.getResourceStream | ||
import java.nio.file.Files | ||
import java.nio.file.Paths | ||
|
||
object CrosshairHUD : Hud<Image>() { | ||
@Switch(title = "Show in F3") | ||
private var showInDebug = false | ||
|
||
@Switch(title = "Show in GUIs") | ||
private var showInGUIs = true | ||
|
||
@Switch(title = "Show in Spectator") | ||
private var showInSpectator = true | ||
|
||
@Switch(title = "Show in 3rd Person") | ||
private var showInThirdPerson = true | ||
|
||
@Include | ||
var currentCrosshair: String = "null" | ||
|
||
override fun category() = Category.COMBAT | ||
|
||
override fun create(): Image { | ||
if (currentCrosshair == "null") { | ||
Files.copy(getResourceStream("assets/polycrosshair/default.png"), Paths.get("polycrosshair.png")) | ||
} else { | ||
Files.copy(Paths.get(currentCrosshair), Paths.get("polycrosshair.png")) | ||
} | ||
return Image("polycrosshair.png") | ||
} | ||
|
||
fun reload() { | ||
get().renderer.delete(get().image) | ||
} | ||
|
||
override fun defaultPosition() = Vec2(1920f / 2f - 7f, 1080f / 2f - 7f) | ||
|
||
override fun id() = "polycrosshair.json" | ||
|
||
override fun title() = "PolyCrosshair" | ||
|
||
override fun update() = false | ||
} |
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
Oops, something went wrong.