Skip to content

Commit

Permalink
Merge branch '1.21.1' into mc/1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Sep 25, 2024
2 parents e0a21ba + 196615a commit 53975e3
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 74 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)
55 changes: 8 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.142'
id 'net.neoforged.gradle.userdev' version '7.0.145'
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
}

Expand All @@ -18,10 +18,8 @@ base {
archivesName =project.archives_base_name
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

//def MAVEN_URL = "https://maven.saps.dev/${SNAPSHOT ? "snapshots" : "releases"}"
//def MAVEN_VERSION = project.version + (SNAPSHOT ? "-SNAPSHOT" : "")

runs {
configureEach {
Expand Down Expand Up @@ -51,29 +49,8 @@ configurations {
runtimeClasspath.extendsFrom localRuntime
}

//loom {
// silentMojangMappingsLicense()
//
// forge {
// mixinConfigs = [
// "kubeutils.mixins.json"
// ]
//
// dataGen {
// mod project.mod_id
// }
// }
//
// launches {
// data {
// arg "--existing", file("src/main/resources").absolutePath
// }
// }
//}

dependencies {
implementation "net.neoforged:neoforge:${mcBase}.${neoforge_version}"

implementation "net.neoforged:neoforge:${neoforge_full_version}"
implementation "dev.latvian.mods:kubejs-neoforge:${kubejs_version}"
}

Expand All @@ -82,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 All @@ -101,13 +79,15 @@ tasks.withType(ProcessResources).configureEach {
minecraft_version : minecraft_version,
neoforge_base_two : mcBase,
neoforge_loader_version: neoforge_loader_version,
neoforge_full_version: neoforge_full_version,
version : version,
neo_version_range: neo_version_range,
kubejs_version : kubejs_version
]

inputs.properties replaceProperties

filesMatching(['META-INF/mods.toml']) {
filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties
}
}
Expand All @@ -122,25 +102,6 @@ idea {
downloadJavadoc = true
}
}
//
//if (ENV.CURSEFORGE_KEY) {
// curseforge {
// apiKey = ENV.CURSEFORGE_KEY
// project {
// id = project.curseforge_id
// releaseType = "release"
// addGameVersion "Forge"
// addGameVersion "Java 17"
// addGameVersion project.minecraft_version
// mainArtifact(remapJar.archiveFile)
// relations {
// requiredDependency 'kubejs'
// }
// changelog = file("./CHANGELOG.md")
// changelogType = 'markdown'
// }
// }
//}

publishing {
publications {
Expand Down
10 changes: 6 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
org.gradle.jvmargs=-Xmx2G

# The MC version is used to determine the base the version for neo and the mod
minecraft_version=1.20.4
minecraft_version=1.21.1

neoforge_version=237
neoforge_loader_version=2
neoforge_version=55
neoforge_full_version=21.1.55
neoforge_loader_version=4
mod_version=0
neo_version_range=[21.1.0-beta,)

maven_group=pro.mikey.mods
archives_base_name=kube-utils
Expand All @@ -16,4 +18,4 @@ mod_author=ErrorMikey/Mikey
curseforge_id=678815
modrinth_id=JHdL51WR

kubejs_version=2004.7.0-build.24
kubejs_version=2101.7.0-build.131
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ pluginManagement {

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
}
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);
}
}
20 changes: 10 additions & 10 deletions src/main/java/pro/mikey/kubeutils/kubejs/KubeUtilsPlugin.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
package pro.mikey.kubeutils.kubejs;

import dev.latvian.mods.kubejs.KubeJSPlugin;
import dev.latvian.mods.kubejs.script.BindingsEvent;
import dev.latvian.mods.kubejs.event.EventGroupRegistry;
import dev.latvian.mods.kubejs.plugin.ClassFilter;
import dev.latvian.mods.kubejs.plugin.KubeJSPlugin;
import dev.latvian.mods.kubejs.script.BindingRegistry;
import dev.latvian.mods.kubejs.script.ScriptType;
import dev.latvian.mods.kubejs.util.ClassFilter;
import pro.mikey.kubeutils.kubejs.events.KuEventsGroup;
import pro.mikey.kubeutils.utils.Utils;

public class KubeUtilsPlugin extends KubeJSPlugin {
public class KubeUtilsPlugin implements KubeJSPlugin {
@Override
public void registerBindings(BindingsEvent event) {
event.add("Ku", BaseBindings.class);
public void registerBindings(BindingRegistry bindings){
bindings.add("Ku", BaseBindings.class);
}

@Override
public void registerEvents() {
KuEventsGroup.GROUP.register();
public void registerEvents(EventGroupRegistry registry) {
registry.register(KuEventsGroup.GROUP);
}

@Override
public void registerClasses(ScriptType type, ClassFilter filter) {
public void registerWrappers(ScriptType type, ClassFilter filter) {
filter.deny(Utils.class);
filter.deny(BaseBindings.class);
filter.deny(KubeUtilsPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import dev.latvian.mods.kubejs.core.EntityKJS;
import dev.latvian.mods.kubejs.event.EventResult;
import dev.latvian.mods.kubejs.event.KubeEvent;
import dev.latvian.mods.kubejs.item.ItemHandlerUtils;
import dev.latvian.mods.kubejs.player.PlayerEventJS;
import dev.latvian.mods.kubejs.player.KubeJSPlayerEventHandler;
import dev.latvian.mods.rhino.Context;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.Nullable;
import pro.mikey.kubeutils.events.KuEvents;
import pro.mikey.kubeutils.kubejs.modules.PlayerKu;
import pro.mikey.kubeutils.utils.Utils;
Expand All @@ -32,7 +35,7 @@
* </code
*/
@KuEvent(KuEvents.PLAYER_STARTER_ITEMS)
public class PlayerStarterItems extends PlayerEventJS {
public class PlayerStarterItems extends KubeJSPlayerEventHandler implements KubeEvent {
public static final String STARTER_ITEMS_GIVEN_FLAG = Utils.kuIdStorage("sig");

private final Player player;
Expand Down Expand Up @@ -65,7 +68,12 @@ public void addEquipmentItem(String equipmentSlot, ItemStack item) {


@Override
protected void afterPosted(EventResult cancelled) {
public @Nullable Object defaultExitValue(Context cx) {
return KubeEvent.super.defaultExitValue(cx);
}

@Override
public void afterPosted(EventResult cancelled) {
if (cancelled.interruptTrue()) {
return;
}
Expand Down Expand Up @@ -94,7 +102,6 @@ protected void afterPosted(EventResult cancelled) {
}
}

@Override
public Player getEntity() {
return this.player;
}
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/pro/mikey/kubeutils/kubejs/modules/LevelKu.java
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 = new ResourceLocation(KubeUtils.getId(), "unknown");
private static final ResourceLocation UNKNOWN = KubeUtils.id("unknown");
private final ServerLevel level;

public LevelKu(ServerLevel level) {
Expand All @@ -39,7 +39,10 @@ public LevelKu(ServerLevel level) {
* @param spawnLocation the location you wish spawn the structure at
*/
public void spawnStructure(String structureFile, BlockPos spawnLocation) {
ResourceLocation structureLocation = new ResourceLocation(structureFile);
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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 dev.latvian.mods.rhino.mod.util.color.Color;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
Expand All @@ -26,7 +26,7 @@ public PlayerKu(Player player) {
* the {@link Component} class can offer whilst having alternative methods to display simpler text like a string.
*
* @see #showActionBar(String)
* @see #showActionBar(String, Color, boolean, boolean)
*
*
* <b>Example</b>
* <code>
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 = new ResourceLocation("minecraft:empty");
private static final ResourceLocation AIR_LOCATION = new ResourceLocation("minecraft:air");
private static final ResourceLocation EMPTY_LOCATION = ResourceLocation.withDefaultNamespace("empty");
private static final ResourceLocation AIR_LOCATION = ResourceLocation.withDefaultNamespace("air");

public UtilsKu() {
}
Expand Down
File renamed without changes.

0 comments on commit 53975e3

Please sign in to comment.