Skip to content

Commit

Permalink
fix: minor things for the port
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Sep 25, 2024
1 parent 8baa09f commit 196615a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Kube Utils Changelog

## [20.4.0]
## [21.1.0]

### Changed

- Updated to 1.20.4
- Updated to 1.21.1 thanks to [@Saereth](https://github.com/Saereth)
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ repositories {

maven {
name = "Kubejs"
url "https://maven.saps.dev/minecraft"
url "https://maven.latvian.dev/releases"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.latvian.apps"
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/pro/mikey/kubeutils/KubeUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package pro.mikey.kubeutils;

import net.minecraft.resources.ResourceLocation;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;
import org.apache.logging.log4j.LogManager;
Expand All @@ -19,4 +20,8 @@ public KubeUtils() {
public static String getId() {
return MOD_ID;
}

public static ResourceLocation id(String path) {
return ResourceLocation.fromNamespaceAndPath(MOD_ID, path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.function.Predicate;

public class LevelKu {
private static final ResourceLocation UNKNOWN = ResourceLocation.tryParse(KubeUtils.getId() + ":unknown");
private static final ResourceLocation UNKNOWN = KubeUtils.id("unknown");
private final ServerLevel level;

public LevelKu(ServerLevel level) {
Expand All @@ -40,6 +40,9 @@ public LevelKu(ServerLevel level) {
*/
public void spawnStructure(String structureFile, BlockPos spawnLocation) {
ResourceLocation structureLocation = ResourceLocation.tryParse(structureFile);
if (structureLocation == null) {
return;
}

Optional<StructureTemplate> structureTemplate = level.getServer().getStructureManager().get(structureLocation);
structureTemplate.ifPresent(e -> e.placeInWorld(level, spawnLocation, spawnLocation, new StructurePlaceSettings(), level.random, Block.UPDATE_ALL));
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/pro/mikey/kubeutils/kubejs/modules/PlayerKu.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package pro.mikey.kubeutils.kubejs.modules;

import dev.latvian.mods.kubejs.color.Color;
import dev.latvian.mods.kubejs.core.ComponentKJS;
import dev.latvian.mods.kubejs.core.EntityKJS;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.neoforged.neoforge.client.event.RenderTooltipEvent;
import pro.mikey.kubeutils.kubejs.events.PlayerStarterItems;


Expand Down Expand Up @@ -47,20 +47,18 @@ public void showActionBarComponent(Component component) {
public void showActionBar(String text) {
this.player.displayClientMessage(Component.literal(text), true);
}
//TODO: Fix showActionBar functions to work with new KubeJS API
/*
public void showActionBar(String text, RenderTooltipEvent.Color color, boolean bold, boolean italic) {
this.player.displayClientMessage(((ComponentKJS) ((((ComponentKJS) ((ComponentKJS) Component.literal(text)).kjs$color((KubeColor) color)).kjs$bold(bold)))).kjs$italic(italic), true);

public void showActionBar(String text, Color color, boolean bold, boolean italic) {
this.player.displayClientMessage(((ComponentKJS) ((((ComponentKJS) ((ComponentKJS) Component.literal(text)).kjs$color(color)).kjs$bold(bold)))).kjs$italic(italic), true);
}

public void showActionBar(String text, RenderTooltipEvent.Color color) {
public void showActionBar(String text, Color color) {
this.showActionBar(text, color, false, false);
}

public void showActionBar(String text, RenderTooltipEvent.Color color, boolean bold) {
public void showActionBar(String text, Color color, boolean bold) {
this.showActionBar(text, color, bold, false);
}
*/
//#endregion

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pro/mikey/kubeutils/kubejs/modules/UtilsKu.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import net.minecraft.world.level.material.Fluids;

public class UtilsKu {
private static final ResourceLocation EMPTY_LOCATION = ResourceLocation.tryParse("minecraft:empty");
private static final ResourceLocation AIR_LOCATION = ResourceLocation.tryParse("minecraft:air");
private static final ResourceLocation EMPTY_LOCATION = ResourceLocation.withDefaultNamespace("empty");
private static final ResourceLocation AIR_LOCATION = ResourceLocation.withDefaultNamespace("air");

public UtilsKu() {
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Provides extra methods and tools to the standard KubeJS mod
[[dependencies.kubeutils]]
modId = "neoforge"
required = true
versionRange = "[${neo_version_range}"
versionRange = "[${neoforge_base_two},)"
ordering = "NONE"
side = "BOTH"

Expand Down

0 comments on commit 196615a

Please sign in to comment.