Skip to content

Commit

Permalink
fixes for 0.1.38
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanobass committed Jul 2, 2024
1 parent 9baa073 commit c933e71
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Mod Properties
id = fluxapi
version = 0.7.3
version = 0.7.4
flux_desc = The central modding API for Cosmic Reach Fabric/Quilt

group = dev.crmodders

# Game & Loader
cosmic_reach_version = 0.1.37
cosmic_reach_version = 0.1.38
cosmic_quilt_version = 2.1.1
fabric_loader_version = 0.15.7

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void create() {
errorText
.append("Error while loading Block (Class: ").append(className)
.append(", File: \"").append(fileName)
.append(", Name: \"").append(blockName)
.append("\", Name: \"").append(blockName)
.append("\", Id: \"").append(blockId)
.append("\")\n")
.append("\nError Stacktrace:\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import dev.crmodders.flux.registries.AccessableRegistry;
import dev.crmodders.flux.tags.Identifier;
import dev.crmodders.flux.tags.ResourceLocation;
import finalforeach.cosmicreach.blockentities.BlockEntityCreator;
import finalforeach.cosmicreach.blockevents.BlockEvents;
import finalforeach.cosmicreach.items.loot.Loot;
import org.greenrobot.eventbus.Subscribe;

import java.util.ArrayList;
Expand Down Expand Up @@ -53,6 +55,10 @@ public void onEvent(OnRegisterBlockEvent event) {
@Override
public void doStage() {
super.doStage();

BlockEvents.initBlockEvents();
BlockEntityCreator.registerBlockEntityCreators();

BlockEvents.registerBlockEventAction(OnPlaceTrigger.class);
BlockEvents.registerBlockEventAction(OnBreakTrigger.class);
BlockEvents.registerBlockEventAction(OnInteractTrigger.class);
Expand Down Expand Up @@ -100,6 +106,8 @@ public List<Runnable> getGlTasks() {
tasks.add( blockFinalizers.get(blockStateId) );
}

tasks.add(Loot::loadLoot);

return tasks;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static class State {
public boolean isFluid = false;

public String swapGroupId;
public String dropId;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(BlockModelJson.class)
public class BlockModelJsonMixin {

@Unique
private static final Logger LOGGER = LoggerFactory.getLogger("BlockModelJson");

@Redirect(method = "getInstance", at = @At(value = "INVOKE", target = "Lfinalforeach/cosmicreach/GameAssetLoader;loadAsset(Ljava/lang/String;)Lcom/badlogic/gdx/files/FileHandle;"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void print1(PrintStream instance, String x) {
logger.info("\u001B[36m{}\u001B[37m", x);
}

@Redirect(method = "create", at = @At(value = "INVOKE", target = "Ljava/io/PrintStream;println(Ljava/lang/String;)V"), require = 0)
@Redirect(method = "printGLInfo", at = @At(value = "INVOKE", target = "Ljava/io/PrintStream;println(Ljava/lang/String;)V"), require = 0)
private void print2(PrintStream instance, String x) {
List<String> lines = x.lines().toList();
for(String line : lines) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public class BlockRegisterer {

@Shadow @Final public static Block AIR;

@Shadow @Final public static Block WATER;

@Shadow @Final public static Block DIRT;

/**
* @author nanobass
* @reason is replaced by flux, allows for much more advanced features
Expand All @@ -25,8 +29,8 @@ public class BlockRegisterer {
@Overwrite
public static Block getInstance(String blockName) {
Block block = blocksByName.get(blockName);
if(block == null && AIR != null) {
LOGGER.warn("null-block returned by Block.getInstance, please report", new Exception());
if(block == null && AIR != null && WATER != null && DIRT != null) {
LOGGER.warn("null-block returned by Block.getInstance, please report \"{}\"", blockName, new Exception());
}
return block;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
import finalforeach.cosmicreach.BlockGame;
import finalforeach.cosmicreach.gamestates.GameState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(BlockGame.class)
public class RegistryRegisterer {

@Inject(method = "create", at = @At("TAIL"))
@Shadow public static boolean gameStarted;

@Inject(method = "create", at = @At(value = "INVOKE", target = "Lfinalforeach/cosmicreach/ClientSingletons;create()V", shift = At.Shift.AFTER), cancellable = true)
private void create(CallbackInfo ci) {
GameState.switchToGameState(new GameLoader());
ci.cancel();
gameStarted = true;
}

}

0 comments on commit c933e71

Please sign in to comment.