mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 03:15:35 -04:00
rendering: add clear chunk combination, send debug chat message
This commit is contained in:
parent
f3da647ebf
commit
c4c762951b
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.config.config.game.controls
|
package de.bixilon.minosoft.config.config.game.controls
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames.DEBUG_CLEAR_CHUNK_CACHE
|
||||||
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames.DEBUG_MOUSE_CATCH
|
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames.DEBUG_MOUSE_CATCH
|
||||||
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames.DEBUG_POLYGEN
|
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames.DEBUG_POLYGEN
|
||||||
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames.DEBUG_SCREEN
|
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames.DEBUG_SCREEN
|
||||||
@ -108,6 +109,13 @@ data class KeyBindingsGameConfig(
|
|||||||
),
|
),
|
||||||
mutableSetOf(mutableSetOf(WHEN_IN_GAME))
|
mutableSetOf(mutableSetOf(WHEN_IN_GAME))
|
||||||
),
|
),
|
||||||
|
DEBUG_CLEAR_CHUNK_CACHE to KeyBinding(
|
||||||
|
mutableMapOf(
|
||||||
|
KeyAction.MODIFIER to mutableSetOf(KeyCodes.KEY_F3),
|
||||||
|
KeyAction.RELEASE to mutableSetOf(KeyCodes.KEY_A)
|
||||||
|
),
|
||||||
|
mutableSetOf(mutableSetOf(WHEN_IN_GAME))
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -125,6 +133,7 @@ object KeyBindingsNames {
|
|||||||
val QUIT_RENDERING = ResourceLocation("minosoft:quit_rendering")
|
val QUIT_RENDERING = ResourceLocation("minosoft:quit_rendering")
|
||||||
|
|
||||||
val DEBUG_SCREEN = ResourceLocation("minosoft:debug_screen")
|
val DEBUG_SCREEN = ResourceLocation("minosoft:debug_screen")
|
||||||
|
val DEBUG_CLEAR_CHUNK_CACHE = ResourceLocation("minosoft:debug_clear_chunk_cache")
|
||||||
val DEBUG_POLYGEN = ResourceLocation("minosoft:debug_polygen")
|
val DEBUG_POLYGEN = ResourceLocation("minosoft:debug_polygen")
|
||||||
val DEBUG_MOUSE_CATCH = ResourceLocation("minosoft:debug_mouse_catch")
|
val DEBUG_MOUSE_CATCH = ResourceLocation("minosoft:debug_mouse_catch")
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ public enum StatisticCategories {
|
|||||||
KILLED(new ChangeableResourceLocation("minecraft.killed"), 6),
|
KILLED(new ChangeableResourceLocation("minecraft.killed"), 6),
|
||||||
KILLED_BY(new ChangeableResourceLocation("minecraft.killed_by"), 7),
|
KILLED_BY(new ChangeableResourceLocation("minecraft.killed_by"), 7),
|
||||||
CUSTOM(new ChangeableResourceLocation("minecraft.custom"), 8);
|
CUSTOM(new ChangeableResourceLocation("minecraft.custom"), 8);
|
||||||
|
|
||||||
|
|
||||||
private final ChangeableResourceLocation changeableResourceLocation;
|
private final ChangeableResourceLocation changeableResourceLocation;
|
||||||
private final int id;
|
private final int id;
|
||||||
|
|
||||||
|
@ -266,6 +266,7 @@ class RenderWindow(private val connection: Connection, val rendering: Rendering)
|
|||||||
} else {
|
} else {
|
||||||
GL_FILL
|
GL_FILL
|
||||||
})
|
})
|
||||||
|
connection.sender.sendFakeChatMessage("§f[§e§lDEBUG§f] §9Toggled polygen mode!")
|
||||||
}
|
}
|
||||||
registerKeyCallback(KeyBindingsNames.DEBUG_MOUSE_CATCH) { _: KeyCodes, _: KeyAction ->
|
registerKeyCallback(KeyBindingsNames.DEBUG_MOUSE_CATCH) { _: KeyCodes, _: KeyAction ->
|
||||||
mouseCatch = !mouseCatch
|
mouseCatch = !mouseCatch
|
||||||
@ -274,6 +275,7 @@ class RenderWindow(private val connection: Connection, val rendering: Rendering)
|
|||||||
} else {
|
} else {
|
||||||
glfwSetInputMode(windowId, GLFW_CURSOR, GLFW_CURSOR_NORMAL)
|
glfwSetInputMode(windowId, GLFW_CURSOR, GLFW_CURSOR_NORMAL)
|
||||||
}
|
}
|
||||||
|
connection.sender.sendFakeChatMessage("§f[§e§lDEBUG§f] §9Toggled mouse catch!")
|
||||||
}
|
}
|
||||||
registerKeyCallback(KeyBindingsNames.QUIT_RENDERING) { _: KeyCodes, _: KeyAction ->
|
registerKeyCallback(KeyBindingsNames.QUIT_RENDERING) { _: KeyCodes, _: KeyAction ->
|
||||||
glfwSetWindowShouldClose(windowId, true)
|
glfwSetWindowShouldClose(windowId, true)
|
||||||
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.gui.rendering.chunk
|
|||||||
|
|
||||||
import de.bixilon.minosoft.Minosoft
|
import de.bixilon.minosoft.Minosoft
|
||||||
import de.bixilon.minosoft.config.StaticConfiguration
|
import de.bixilon.minosoft.config.StaticConfiguration
|
||||||
|
import de.bixilon.minosoft.config.config.game.controls.KeyBindingsNames
|
||||||
import de.bixilon.minosoft.data.Directions
|
import de.bixilon.minosoft.data.Directions
|
||||||
import de.bixilon.minosoft.data.mappings.blocks.BlockState
|
import de.bixilon.minosoft.data.mappings.blocks.BlockState
|
||||||
import de.bixilon.minosoft.data.text.RGBColor
|
import de.bixilon.minosoft.data.text.RGBColor
|
||||||
@ -123,6 +124,12 @@ class WorldRenderer(private val connection: Connection, private val world: World
|
|||||||
chunkShader = Shader("chunk_vertex.glsl", "chunk_fragment.glsl")
|
chunkShader = Shader("chunk_vertex.glsl", "chunk_fragment.glsl")
|
||||||
chunkShader.load()
|
chunkShader.load()
|
||||||
|
|
||||||
|
// register keybindings
|
||||||
|
renderWindow.registerKeyCallback(KeyBindingsNames.DEBUG_CLEAR_CHUNK_CACHE) { _, _ ->
|
||||||
|
clearChunkCache()
|
||||||
|
connection.sender.sendFakeChatMessage("§f[§e§lDEBUG§f] §9Cleared chunk cache!")
|
||||||
|
prepareWorld(world)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun postInit() {
|
override fun postInit() {
|
||||||
|
@ -32,7 +32,7 @@ class TextureArray(val textures: List<Texture>, val maxWidth: Int, val maxHeight
|
|||||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT)
|
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT)
|
||||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT)
|
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT)
|
||||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
|
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
|
||||||
// glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR) // ToDo: This breaks transparency again
|
// glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST) // ToDo: This breaks transparency again
|
||||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
|
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
|
||||||
|
|
||||||
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, maxWidth, maxHeight, textures.size, 0, GL_RGBA, GL_UNSIGNED_BYTE, null as ByteBuffer?)
|
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, maxWidth, maxHeight, textures.size, 0, GL_RGBA, GL_UNSIGNED_BYTE, null as ByteBuffer?)
|
||||||
|
@ -13,10 +13,13 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.protocol.protocol;
|
package de.bixilon.minosoft.protocol.protocol;
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.data.ChatTextPositions;
|
||||||
import de.bixilon.minosoft.data.entities.EntityRotation;
|
import de.bixilon.minosoft.data.entities.EntityRotation;
|
||||||
import de.bixilon.minosoft.data.entities.Position;
|
import de.bixilon.minosoft.data.entities.Position;
|
||||||
import de.bixilon.minosoft.data.mappings.ResourceLocation;
|
import de.bixilon.minosoft.data.mappings.ResourceLocation;
|
||||||
import de.bixilon.minosoft.data.player.Hands;
|
import de.bixilon.minosoft.data.player.Hands;
|
||||||
|
import de.bixilon.minosoft.data.text.ChatComponent;
|
||||||
|
import de.bixilon.minosoft.modding.event.events.ChatMessageReceivingEvent;
|
||||||
import de.bixilon.minosoft.modding.event.events.ChatMessageSendingEvent;
|
import de.bixilon.minosoft.modding.event.events.ChatMessageSendingEvent;
|
||||||
import de.bixilon.minosoft.modding.event.events.CloseWindowEvent;
|
import de.bixilon.minosoft.modding.event.events.CloseWindowEvent;
|
||||||
import de.bixilon.minosoft.protocol.network.Connection;
|
import de.bixilon.minosoft.protocol.network.Connection;
|
||||||
@ -126,4 +129,12 @@ public class PacketSender {
|
|||||||
this.connection.getPlayer().getEntity().setLocation(position);
|
this.connection.getPlayer().getEntity().setLocation(position);
|
||||||
this.connection.getPlayer().getEntity().setRotation(rotation);
|
this.connection.getPlayer().getEntity().setRotation(rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendFakeChatMessage(ChatComponent message, ChatTextPositions position) {
|
||||||
|
this.connection.fireEvent(new ChatMessageReceivingEvent(this.connection, message, position, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendFakeChatMessage(String message) {
|
||||||
|
sendFakeChatMessage(ChatComponent.valueOf(message), ChatTextPositions.CHAT_BOX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user