-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.0.6.1 - Waypoints and Dungeons update
- Loading branch information
Nat3z
committed
Apr 20, 2022
1 parent
5219c07
commit 380fd6a
Showing
35 changed files
with
1,022 additions
and
54 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
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
50 changes: 50 additions & 0 deletions
50
src/main/kotlin/natia/skytweaks/commands/waypoints/WaypointCreateGui.kt
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 natia.skytweaks.commands.waypoints | ||
|
||
import natia.skytweaks.features.waypoints.GlobalWaypoints | ||
import natia.skytweaks.features.waypoints.Waypoint | ||
import net.minecraft.client.gui.GuiButton | ||
import net.minecraft.client.gui.GuiScreen | ||
import net.minecraft.client.gui.GuiTextField | ||
import net.minecraft.client.gui.ScaledResolution | ||
import net.minecraft.util.BlockPos | ||
import net.minecraft.util.Vec3 | ||
import org.lwjgl.input.Keyboard | ||
import java.awt.Color | ||
|
||
class WaypointCreateGui(val pos: BlockPos) : GuiScreen() { | ||
|
||
var waypointName: GuiTextField? = null | ||
override fun initGui() { | ||
super.initGui() | ||
waypointName = GuiTextField(0, fontRendererObj, width / 2 - 80, 50, 200, 15) | ||
waypointName!!.isFocused = true; | ||
} | ||
|
||
override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) { | ||
drawCenteredString(mc.fontRendererObj, "Waypoint Name", width / 2, | ||
20, Color.GRAY.rgb) | ||
waypointName!!.drawTextBox() | ||
super.updateScreen() | ||
super.drawScreen(mouseX, mouseY, partialTicks) | ||
} | ||
|
||
override fun mouseClicked(mouseX: Int, mouseY: Int, mouseButton: Int) { | ||
waypointName!!.mouseClicked(mouseX, mouseY, mouseButton) | ||
super.mouseClicked(mouseX, mouseY, mouseButton) | ||
} | ||
|
||
override fun keyTyped(typedChar: Char, keyCode: Int) { | ||
waypointName!!.textboxKeyTyped(typedChar, keyCode) | ||
super.keyTyped(typedChar, keyCode) | ||
} | ||
|
||
override fun onGuiClosed() { | ||
super.onGuiClosed() | ||
exit() | ||
} | ||
|
||
fun exit() { | ||
GlobalWaypoints.instance.waypoints.add(Waypoint(pos, waypointName!!.text)) | ||
} | ||
|
||
} |
78 changes: 78 additions & 0 deletions
78
src/main/kotlin/natia/skytweaks/commands/waypoints/WaypointSelect.kt
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,78 @@ | ||
package natia.skytweaks.commands.waypoints | ||
|
||
import natia.skytweaks.features.waypoints.GlobalWaypoints | ||
import natia.skytweaks.features.waypoints.Waypoint | ||
import net.minecraft.client.Minecraft | ||
import net.minecraft.client.audio.SoundHandler | ||
import net.minecraft.client.gui.Gui | ||
import net.minecraft.client.gui.GuiButton | ||
import net.minecraft.client.renderer.GlStateManager | ||
import net.minecraft.util.ResourceLocation | ||
import org.lwjgl.input.Mouse | ||
import java.awt.Color | ||
|
||
class WaypointSelect(val buttonID: Int, val x: Int, val y: Int, val waypoint: Waypoint) : GuiButton(buttonID, x, y, 160, 20, "") { | ||
|
||
val mc = Minecraft.getMinecraft() | ||
|
||
override fun drawButton(mc1: Minecraft?, mouseX: Int, mouseY: Int) { | ||
super.drawButton(mc, mouseX, mouseY) | ||
if (!this.visible) return | ||
|
||
GlStateManager.enableAlpha() | ||
Gui.drawRect(x, y, x + this.width, y + this.height, Color(103, 99, 101).rgb) | ||
GlStateManager.disableAlpha() | ||
GlStateManager.color(1f, 1f, 1f) | ||
|
||
mc.fontRendererObj.drawString(waypoint.name, (x + 10).toFloat(), (y + 7).toFloat(), Color.WHITE.rgb, true) | ||
|
||
drawShareButton(mouseX, mouseY) | ||
drawRemoveButton(mouseX, mouseY) | ||
} | ||
|
||
fun drawShareButton(mouseX: Int, mouseY: Int) { | ||
val shareButtonX = x + 120 | ||
val shareButtonY = y + 3 | ||
val shareButtonWidth = 15 | ||
val shareButtonHeight = 15 | ||
|
||
val isShareHovered = | ||
mouseX >= shareButtonX && mouseY >= shareButtonY && mouseX < shareButtonX + shareButtonWidth && mouseY < shareButtonY + shareButtonHeight | ||
|
||
mc.textureManager.bindTexture(ResourceLocation("secretmod", "gui/share.png")) | ||
GlStateManager.enableAlpha() | ||
Gui.drawModalRectWithCustomSizedTexture(shareButtonX, shareButtonY, 0f, 0f, shareButtonWidth, shareButtonHeight, | ||
shareButtonWidth.toFloat(), shareButtonHeight.toFloat() | ||
) | ||
GlStateManager.disableAlpha() | ||
/* Click Event */ | ||
if (!Mouse.getEventButtonState() || !isShareHovered) return | ||
mc.thePlayer.closeScreen() | ||
mc.thePlayer.sendChatMessage(waypoint.toShareable()) | ||
} | ||
|
||
override fun playPressSound(soundHandlerIn: SoundHandler?) { | ||
|
||
} | ||
|
||
fun drawRemoveButton(mouseX: Int, mouseY: Int) { | ||
val removeButtonX = x + 140 | ||
val removeButtonY = y + 3 | ||
val removeButtonWidth = 15 | ||
val removeButtonHeight = 15 | ||
|
||
val isShareHovered = | ||
mouseX >= removeButtonX && mouseY >= removeButtonY && mouseX < removeButtonX + removeButtonWidth && mouseY < removeButtonY + removeButtonHeight | ||
|
||
mc.textureManager.bindTexture(ResourceLocation("secretmod", "gui/trash.png")) | ||
GlStateManager.enableAlpha() | ||
Gui.drawModalRectWithCustomSizedTexture(removeButtonX, removeButtonY, 0f, 0f, removeButtonWidth, removeButtonHeight, | ||
removeButtonWidth.toFloat(), removeButtonHeight.toFloat() | ||
) | ||
GlStateManager.disableAlpha() | ||
/* Click Event */ | ||
if (!Mouse.getEventButtonState() || !isShareHovered) return | ||
mc.thePlayer.closeScreen() | ||
GlobalWaypoints.instance.waypoints.remove(waypoint) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/kotlin/natia/skytweaks/commands/waypoints/WaypointsCommand.kt
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,45 @@ | ||
package natia.skytweaks.commands.waypoints | ||
|
||
import cc.blendingMC.vicious.BlendingConfigGui | ||
import natia.skytweaks.SkyTweaks | ||
import natia.skytweaks.hooks.TickHook | ||
import net.minecraft.command.CommandBase | ||
import net.minecraft.command.CommandException | ||
import net.minecraft.command.ICommandSender | ||
|
||
class WaypointsCommand : CommandBase() { | ||
/** | ||
* Gets the name of the command | ||
*/ | ||
override fun getCommandName(): String { | ||
return "waypoints" | ||
} | ||
|
||
override fun getCommandAliases(): MutableList<String> { | ||
return arrayListOf("wp") | ||
} | ||
|
||
/** | ||
* Gets the usage string for the command. | ||
* | ||
* @param sender | ||
*/ | ||
override fun getCommandUsage(sender: ICommandSender): String { | ||
return "/waypoints" | ||
} | ||
|
||
/** | ||
* Callback when the command is invoked | ||
* | ||
* @param sender | ||
* @param args | ||
*/ | ||
@Throws(CommandException::class) | ||
override fun processCommand(sender: ICommandSender, args: Array<String>) { | ||
TickHook.scheduleGui(WaypointsGui()) | ||
} | ||
|
||
override fun canCommandSenderUseCommand(sender: ICommandSender): Boolean { | ||
return true | ||
} | ||
} |
Oops, something went wrong.