Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
b58894e9
Commit
b58894e9
authored
Apr 07, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added click sounds into UI and chat screen's Enter button
parent
c9f32be6
Pipeline
#11961
passed with stage
in 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
ChatScreen.java
src/client/java/com/owlmaddie/ui/ChatScreen.java
+5
-0
ClickHandler.java
src/client/java/com/owlmaddie/ui/ClickHandler.java
+4
-0
No files found.
src/client/java/com/owlmaddie/ui/ChatScreen.java
View file @
b58894e9
package
com
.
owlmaddie
.
ui
;
import
com.owlmaddie.network.ModPackets
;
import
net.minecraft.client.MinecraftClient
;
import
net.minecraft.client.gui.DrawContext
;
import
net.minecraft.client.gui.screen.Screen
;
import
net.minecraft.client.gui.widget.ButtonWidget
;
import
net.minecraft.client.gui.widget.TextFieldWidget
;
import
net.minecraft.entity.Entity
;
import
net.minecraft.sound.SoundEvents
;
import
net.minecraft.text.Text
;
import
org.lwjgl.glfw.GLFW
;
...
...
@@ -77,6 +79,9 @@ public class ChatScreen extends Screen {
public
boolean
keyPressed
(
int
keyCode
,
int
scanCode
,
int
modifiers
)
{
if
(
keyCode
==
GLFW
.
GLFW_KEY_ENTER
||
keyCode
==
GLFW
.
GLFW_KEY_KP_ENTER
)
{
if
(
textField
.
isFocused
())
{
// Play click sound
MinecraftClient
.
getInstance
().
player
.
playSound
(
SoundEvents
.
UI_BUTTON_CLICK
.
value
(),
0.2
F
,
0.8
F
);
// Close window on ENTER key press
sendChatMessage
();
return
true
;
...
...
src/client/java/com/owlmaddie/ui/ClickHandler.java
View file @
b58894e9
...
...
@@ -15,6 +15,7 @@ import net.minecraft.client.render.Camera;
import
net.minecraft.entity.Entity
;
import
net.minecraft.entity.EntityType
;
import
net.minecraft.entity.mob.MobEntity
;
import
net.minecraft.sound.SoundEvents
;
import
net.minecraft.util.math.Box
;
import
net.minecraft.util.math.Vec3d
;
import
net.minecraft.world.World
;
...
...
@@ -189,6 +190,9 @@ public class ClickHandler {
// Look-up conversation
ChatDataManager
.
EntityChatData
chatData
=
ChatDataManager
.
getClientInstance
().
getOrCreateChatData
(
closestEntity
.
getUuidAsString
());
// Play click sound
client
.
player
.
playSound
(
SoundEvents
.
UI_BUTTON_CLICK
.
value
(),
0.2
F
,
0.8
F
);
if
(
chatData
.
status
==
ChatDataManager
.
ChatStatus
.
NONE
)
{
// Start conversation
ModPackets
.
sendGenerateGreeting
(
closestEntity
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment