Skip to content

Commit

Permalink
debug version
Browse files Browse the repository at this point in the history
+ automatic config file creation
  • Loading branch information
Goby56 committed Nov 25, 2023
1 parent 7cbccfb commit a9b21ce
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.2+build.4
loader_version=0.14.24

# Mod Properties
mod_version=0.2.0
mod_version=0.2.1-test-build-1
maven_group=com.goby56.wakes
archives_base_name=wakes

Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/goby56/wakes/WakesClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class WakesClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
LOGGER.info("Registering client specific stuff for " + MOD_ID);
FabricLoader.getInstance().getModContainer(MOD_ID).ifPresent(container -> METADATA = container.getMetadata());

// Mod configs
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/goby56/wakes/config/WakesConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ public static WakesConfig loadConfig() {
try {
File configFile = new File(WakesClient.CONFIG_PATH);
if (!configFile.exists()) {
WakesClient.LOGGER.info(String.format("No config file found for wakes-%s. Edit one or more configs to to create one.", WakesClient.METADATA.getVersion().getFriendlyString()));
// WakesConfig config = new WakesConfig();
// config.saveConfig();
return new WakesConfig();
WakesClient.LOGGER.info(String.format("No config file found for wakes-%s. Creating one...", WakesClient.METADATA.getVersion().getFriendlyString()));
WakesConfig config = new WakesConfig();
config.saveConfig();
return config;
}

JsonObject configJson = jankson.load(configFile);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/goby56/wakes/event/WakeTicker.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.goby56.wakes.event;

import com.goby56.wakes.render.WakeTextureRenderer;
import com.goby56.wakes.utils.WakeHandler;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.client.world.ClientWorld;

public class WakeTicker implements ClientTickEvents.EndWorldTick {
@Override
public void onEndTick(ClientWorld world) {
WakeTextureRenderer.hasPrintedToChat = false;
WakeHandler.getInstance().tick();
}
}
1 change: 0 additions & 1 deletion src/main/java/com/goby56/wakes/mixin/WakeSpawnerMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public float producingHeight() {

@Override
public void setWakeParticle(Particle particle) {
System.out.println(particle);
this.wakeParticle = particle;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

public class WakeTextureRenderer implements WorldRenderEvents.AfterTranslucent {

public static boolean hasPrintedToChat = false;

@Override
public void afterTranslucent(WorldRenderContext context) {
Expand All @@ -46,6 +47,7 @@ public void afterTranslucent(WorldRenderContext context) {

ArrayList<WakeNode> nodes = wakeHandler.getVisible(context.frustum());
Matrix4f matrix = context.matrixStack().peek().getPositionMatrix();
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
RenderSystem.enableBlend();
RenderSystem.disableCull();
context.lightmapTextureManager().enable();
Expand Down Expand Up @@ -103,6 +105,11 @@ public void afterTranslucent(WorldRenderContext context) {
waterCol = BiomeColors.getWaterColor(context.world(), node.blockPos());
light = WorldRenderer.getLightmapCoordinates(context.world(), node.blockPos());

if (!hasPrintedToChat) {
MinecraftClient.getInstance().player.sendMessage(Text.of(String.valueOf(light)));
hasPrintedToChat = true;
}

if (WakesClient.CONFIG_INSTANCE.useWaterBlending) {
r = (float) (waterCol >> 16 & 0xFF) / 255f;
g = (float) (waterCol >> 8 & 0xFF) / 255f;
Expand Down

0 comments on commit a9b21ce

Please sign in to comment.