Skip to content

Commit

Permalink
Update to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
UnRealDinnerbone committed Dec 31, 2023
1 parent 6b4f51d commit 56dca86
Show file tree
Hide file tree
Showing 30 changed files with 363 additions and 130 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ eclipse
run

Fabric/run_client/

neo/runs/
50 changes: 35 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import dev.nanite.mlp.tasks.SingleOutputJar

plugins {
id("dev.nanite.mlp") version("0.0.3")
id("java")
id "me.modmuss50.mod-publish-plugin" version "0.3.0"

id("fabric-loom") version("1.3.9") apply(false)
id("net.minecraftforge.gradle") version("6.0.+") apply(false)
id("dev.nanite.mlp") version("0.1.1-SNAPSHOT")
id("java-library")
id("maven-publish")
id("me.modmuss50.mod-publish-plugin") version "0.3.0"
}


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

multiLoader.root() {
minecraftVersion.set(project.property("minecraft_version"))
modID.set(project.property("mod_id"))
splitSources.set(true)
convertAccessWidener.set(true)
accessWidenerFile.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
}

Expand All @@ -23,17 +21,20 @@ allprojects {
version = "${mod_version}+mc${minecraft_version}${isSnapshot ? '-SNAPSHOT' : ''}"
setArchivesBaseName("${mod_name}-${project.name}".toLowerCase())
group = "com.unrealdinnerbone"
}


}

subprojects {
apply plugin: 'dev.nanite.mlp'


apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'dev.nanite.mlp'


sourceSets.main.resources.srcDir project.file('src/generated/resources')


base {
archivesName = "${project.property("mod_name")}-${project.name}".toLowerCase()
}
Expand Down Expand Up @@ -84,31 +85,50 @@ publishMods {

def fabricOptions = publishOptions {
file = project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "${project.name} Fabric ${mod_version}+mc${minecraft_version}"
displayName = "[FABRIC][${minecraft_version}] ${project.name} ${mod_version}"
modLoaders.add("fabric")
}

def forgeOptions = publishOptions {
file = project.provider { project(":forge").tasks.jarJar }.flatMap { it.archiveFile }
displayName = "${project.name} Forge ${mod_version}+mc${minecraft_version}"
file = project.provider { project(":forge").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "[FORGE][${minecraft_version}] ${project.name} ${mod_version}"
modLoaders.add("forge")
}

def neoForge = publishOptions {
file = project.provider { project(":neoforge").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "[NEOFORGE][${minecraft_version}] ${project.name} ${mod_version}"
modLoaders.add("neoforge")
}

def curseForgeOptions = curseforgeOptions {
accessToken = providers.environmentVariable("CURSE_TOKEN")
projectId = project.property("curse_id")
projectId = "${curseforge_id}"
minecraftVersions.add("${minecraft_version}")
}

curseforge("curseforgeFabric") {
from(curseForgeOptions, fabricOptions)
requires {
slug = "architectury-api"
}
requires {
slug = "fabric-api"
}
}

curseforge("curseforgeForge") {
from(curseForgeOptions, forgeOptions)
requires {
slug = "architectury-api"
}
}

curseforge("curseforgeNeoForge") {
from(curseForgeOptions, neoForge)
requires {
slug = "architectury-api"
}
}

}
Expand Down
9 changes: 0 additions & 9 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,3 @@ multiLoader.common()
publishing.publications.mavenJava.from components.java


dependencies {
api ("com.unrealdinnerbone:UnRealConfig-gson:${unreal_config_version}") {
exclude group: 'com.google.code.gson', module: 'gson'
exclude group: 'org.jetbrains', module: 'annotations'
exclude group: 'org.slf4j', module: 'slf4j-api'

}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.unrealdinnerbone.trenzalore;

import com.unrealdinnerbone.trenzalore.api.platform.services.IRegistry;
import com.unrealdinnerbone.trenzalore.api.registry.RegistryEntry;
import com.unrealdinnerbone.trenzalore.api.registry.RegistryObjects;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.Item;

import java.util.List;

public class TestItems implements IRegistry {

private static final RegistryObjects<Item> ITEMS = RegistryObjects.of(Registries.ITEM);

public static final RegistryEntry<Item> TEST_ITEM = ITEMS.register("test_item", () -> new Item(new Item.Properties()));
@Override
public List<RegistryObjects<?>> getRegistryObjects() {
return List.of(ITEMS);
}

@Override
public String getModID() {
return Trenzalore.MOD_ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.logging.LogUtils;
import com.unrealdinnerbone.config.ConfigManager;
import com.unrealdinnerbone.config.gson.GsonProvider;
import com.unrealdinnerbone.trenzalore.api.platform.Services;
import org.jetbrains.annotations.ApiStatus;
import org.slf4j.Logger;
Expand All @@ -21,7 +19,7 @@ public class ConfigManger {
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();

@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
public static <T> T getOrCreateConfig(String name, Class<T> tClass, Supplier<T> defaultValue) {
Path configPath = Services.PLATFORM.getConfigPath();
Path config = configPath.resolve(name + ".json");
Expand All @@ -42,10 +40,4 @@ public static <T> T getOrCreateConfig(String name, Class<T> tClass, Supplier<T>
}
}

public static ConfigManager createConfigManager(String modid) {
Path configPath = Services.PLATFORM.getConfigPath();
Path config = configPath.resolve(modid + ".json");
return new ConfigManager(new GsonProvider(config, GSON));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
Expand All @@ -30,14 +29,9 @@ public interface IPlatformHelper {

boolean isModLoaded(String modId);

@Nullable
default <T extends Entity> Entity teleport(T entity, ServerLevel level, PortalInfo portalInfo) {
return teleportInternal(entity, level, portalInfo);
}

@Nullable
@ApiStatus.Internal
<T extends Entity> Entity teleportInternal(T entity, ServerLevel level, PortalInfo portalInfo);
<T extends Entity> Entity teleport(T entity, ServerLevel level, PortalInfo portalInfo);
@ApiStatus.Internal
void addItemToCreativeTab(ResourceKey<CreativeModeTab> tabResourceKey, List<Supplier<? extends Item>> item);
@ApiStatus.Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
Expand All @@ -24,16 +25,9 @@ public static <T> RegistryObjects<T> create(ResourceKey<Registry<T>> registry) {
return RegistryObjects.of(registry);
}

public static <T extends CriterionTrigger<?>> T registerCriterion(T criterion) {
return CriteriaTriggers.register(criterion);
public static <T extends CriterionTrigger<?>> T registerCriterion(ResourceLocation name, T criterion) {
return CriteriaTriggers.register(name.toString(), criterion);
}

@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
public static void registerCreativeTabItems(ResourceKey<CreativeModeTab> tabResourceKey, List<Supplier<? extends Item>> item) {
addItemsToCreateTab(tabResourceKey, item);
}

public static void addItemToCreateTab(ResourceKey<CreativeModeTab> tabResourceKey, Supplier<? extends Item> item) {
Services.PLATFORM.addItemToCreativeTab(tabResourceKey, List.of(item));
}
Expand Down

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion common/src/main/resources/trenzalore.accesswidener
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessWidener v1 named
accessible method net/minecraft/advancements/CriteriaTriggers register (Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger;
accessible method net/minecraft/advancements/CriteriaTriggers register (Ljava/lang/String;Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger;
accessible field net/minecraft/world/item/CreativeModeTabs BUILDING_BLOCKS Lnet/minecraft/resources/ResourceKey;
accessible field net/minecraft/world/item/CreativeModeTabs COLORED_BLOCKS Lnet/minecraft/resources/ResourceKey;
accessible field net/minecraft/world/item/CreativeModeTabs NATURAL_BLOCKS Lnet/minecraft/resources/ResourceKey;
Expand Down
6 changes: 0 additions & 6 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ multiLoader.fabric() {

publishing.publications.mavenJava.from components.java


dependencies {
include(api("com.unrealdinnerbone:UnRealConfig-gson:${unreal_config_version}"))
include(implementation("com.unrealdinnerbone:UnRealConfig-core:${unreal_config_version}"))
}

remapJar {
setArchivesBaseName("${project.property("mod_name")}-${project.name}".toLowerCase())
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public <T> void registryRegistryObjects(String modId, RegistryObjects<T> registr

@Override
@Nullable
public <T extends Entity> Entity teleportInternal(T entity, ServerLevel level, PortalInfo portalInfo) {
public <T extends Entity> Entity teleport(T entity, ServerLevel level, PortalInfo portalInfo) {
return FabricDimensions.teleport(entity, level, portalInfo);
}

Expand Down
17 changes: 0 additions & 17 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
plugins {
id("java-library")
}

multiLoader.forge() {
forgeVersion.set("${forge_version}")
}
Expand All @@ -17,19 +13,6 @@ publishing {
}
}


dependencies {
api ("com.unrealdinnerbone:UnRealConfig-gson:${unreal_config_version}")
// minecraftEmbed()
minecraftEmbed("com.unrealdinnerbone:UnRealConfig-gson:[${unreal_config_version}]") {
transitive = false
}
minecraftEmbed("com.unrealdinnerbone:UnRealConfig-core:[${unreal_config_version}]") {
transitive = false
}
}


tasks.jarJar {
finalizedBy("reobfJarJar")
setArchivesBaseName("${project.property("mod_name")}-${project.name}".toLowerCase())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.unrealdinnerbone.trenzalore;

import com.unrealdinnerbone.config.ConfigManager;
import com.unrealdinnerbone.config.config.BooleanConfig;
import com.unrealdinnerbone.trenzalore.platform.ForgePlatformHelper;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.fml.common.Mod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.unrealdinnerbone.trenzalore.lib.CustomCodecs;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.storage.loot.LootContext;
Expand All @@ -19,7 +17,7 @@ public class ReplaceItemModifier extends LootModifier {
private final ItemStack stack;
public static final Codec<ReplaceItemModifier> CODEC = RecordCodecBuilder.create(builder ->
codecStart(builder)
.and(CustomCodecs.INGREDIENT.fieldOf("item")
.and(Ingredient.CODEC.fieldOf("item")
.forGetter((modifier) -> modifier.ingredient))
.and(ItemStack.CODEC.fieldOf("stack")
.forGetter((modifier) -> modifier.stack))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void addItemToCreativeTab(ResourceKey<CreativeModeTab> tabResourceKey, Li
}

@Override
public @Nullable <T extends Entity> Entity teleportInternal(T entity, ServerLevel level, PortalInfo portalInfo) {
public @Nullable <T extends Entity> Entity teleport(T entity, ServerLevel level, PortalInfo portalInfo) {
return entity.changeDimension(level, new SimpleTeleporter(portalInfo));
}
public record SimpleTeleporter(PortalInfo portalInfo) implements ITeleporter {
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public net.minecraft.advancements.CriteriaTriggers m_10595_(Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger;
public net.minecraft.advancements.CriteriaTriggers m_10595_(Ljava/lang/String;Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger;
public net.minecraft.world.item.CreativeModeTabs f_256788_
public net.minecraft.world.item.CreativeModeTabs f_256725_
public net.minecraft.world.item.CreativeModeTabs f_256776_
Expand Down
Loading

0 comments on commit 56dca86

Please sign in to comment.