Skip to content

Commit

Permalink
1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
UnRealDinnerbone committed Apr 24, 2024
1 parent 613dca6 commit 0652b1d
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 40 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### 4.0.1
### 5.0.0

- Fixed Maven Publishing
- Update to 1.20.5
18 changes: 10 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
plugins {
id("dev.nanite.mlp") version("0.1.1")
id("dev.nanite.mlp") version("0.1.6")
id("java-library")
id("maven-publish")
id("me.modmuss50.mod-publish-plugin") version "0.3.0"
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.0'
}


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

multiLoader.root() {
minecraftVersion.set(project.property("minecraft_version"))
Expand All @@ -22,7 +23,12 @@ allprojects {
setArchivesBaseName("${mod_name}-${project.name}".toLowerCase())
group = "com.unrealdinnerbone"


idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
}

subprojects {
Expand All @@ -35,7 +41,7 @@ subprojects {

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

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


base {
Expand All @@ -46,10 +52,6 @@ subprojects {
name = "Creeperhost"
url = uri("https://maven.creeperhost.net/")
}
maven {
name = "UnRealDinnerbone"
url = "https://maven.unreal.codes/releases"
}
}
tasks.withType(ProcessResources).configureEach {
outputs.upToDateWhen { false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ConfigManger {
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();

@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
@ApiStatus.ScheduledForRemoval(inVersion = "6.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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.ServiceLoader;

public class Services {

public static final IPlatformHelper PLATFORM = load(IPlatformHelper.class);

public static <T> T load(Class<T> clazz) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public interface IPlatformHelper {
@Nullable
@ApiStatus.Internal
<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
<T> void registryRegistryObjects(String modId, RegistryObjects<T> registryObjects);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.List;

public interface IRegistry {

List<RegistryObjects<?>> getRegistryObjects();

String getModID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
Expand All @@ -25,9 +29,6 @@ public static <T> RegistryObjects<T> create(ResourceKey<Registry<T>> registry) {
return RegistryObjects.of(registry);
}

public static <T extends CriterionTrigger<?>> T registerCriterion(ResourceLocation name, T criterion) {
return CriteriaTriggers.register(name.toString(), criterion);
}
public static void addItemToCreateTab(ResourceKey<CreativeModeTab> tabResourceKey, Supplier<? extends Item> item) {
Services.PLATFORM.addItemToCreativeTab(tabResourceKey, List.of(item));
}
Expand All @@ -40,4 +41,8 @@ public static <T extends BlockEntity> BlockEntityType<T> createBlockEntityType(B
return BlockEntityType.Builder.of(creator::apply, validBlocks).build(null);
}

public static <T extends AbstractContainerMenu> MenuType<T> createMenuType(BiFunction<Integer, Inventory, T> supplier) {
return new MenuType<>(supplier::apply, FeatureFlagSet.of());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.function.Supplier;

public record RegistryEntry<T>(String name, Supplier<T> entry) implements Supplier<T> {

@Override
public T get() {
return entry.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public record RegistryObjects<T>(ResourceKey<Registry<T>> registryKey, List<Regi
public static <T> RegistryObjects<T> of(ResourceKey<Registry<T>> registryKey) {
return new RegistryObjects<>(registryKey, new ArrayList<>());
}

public <A extends T> RegistryEntry<A> register(String name, Supplier<A> object) {
RegistryEntry<A> entry = new RegistryEntry<>(name, Suppliers.memoize(object::get));
objects.add(entry);
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/trenzalore.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ accessible field net/minecraft/world/item/CreativeModeTabs SPAWN_EGGS Lnet/minec
accessible field net/minecraft/world/item/CreativeModeTabs OP_BLOCKS Lnet/minecraft/resources/ResourceKey;
accessible method net/minecraft/world/level/block/entity/BlockEntityType$Builder of (Lnet/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier;[Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/block/entity/BlockEntityType$Builder;
accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier
accessible method net/minecraft/world/inventory/MenuType <init> (Lnet/minecraft/world/inventory/MenuType$MenuSupplier;Lnet/minecraft/world/flag/FeatureFlagSet;)V
accessible class net/minecraft/world/inventory/MenuType$MenuSupplier

2 changes: 2 additions & 0 deletions forge/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ public net.minecraft.world.item.CreativeModeTabs f_256731_
public net.minecraft.world.item.CreativeModeTabs f_256837_
public net.minecraft.world.level.block.entity.BlockEntityType$Builder m_155273_(Lnet/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier;[Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/block/entity/BlockEntityType$Builder;
public net.minecraft.world.level.block.entity.BlockEntityType$BlockEntitySupplier
public net.minecraft.world.inventory.MenuType <init>(Lnet/minecraft/world/inventory/MenuType$MenuSupplier;Lnet/minecraft/world/flag/FeatureFlagSet;)V
public net.minecraft.world.inventory.MenuType$MenuSupplier
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Project
mod_version=4.0.1
mod_version=5.0.0
maven_group=com.unrealdinnerbone
mod_name=Trenzalore
mod_author=UnRealDinnerbone
mod_id=trenzalore
curse_id=870210

# Common
minecraft_version=1.20.4
minecraft_version=1.20.5

# Forge
forge_version=49.0.13
#//forge_version=49.0.31

neo_version=20.4.70-beta
neo_version=20.5.0-beta
# Fabric
fabric_version=0.91.2+1.20.4
fabric_loader_version=0.15.1
fabric_version=0.97.6+1.20.5
fabric_loader_version=0.15.10

# Gradle
org.gradle.jvmargs=-Xmx3G
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
import com.unrealdinnerbone.trenzalore.platform.NeoPlatformHelper;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.IModBusEvent;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;

@Mod(Trenzalore.MOD_ID)
public class TrenzaloreForge {
public class TrenzaloreNeo {

public TrenzaloreForge(IEventBus modEventBus) {
public TrenzaloreNeo(IEventBus modEventBus) {
Trenzalore.init();
modEventBus.addListener(TrenzaloreForge::onCreativeTab);
modEventBus.addListener(TrenzaloreNeo::onCreativeTab);
}

public static void onCreativeTab(BuildCreativeModeTabContentsEvent event) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.unrealdinnerbone.trenzalore;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.unrealdinnerbone.trenzalore.api.platform.services.IRegistry;
import com.unrealdinnerbone.trenzalore.api.registry.Regeneration;
import com.unrealdinnerbone.trenzalore.api.registry.RegistryEntry;
Expand All @@ -13,9 +14,9 @@
import java.util.List;

public class TrenzaloreNeoRegistry implements IRegistry {
private static final RegistryObjects<Codec<? extends IGlobalLootModifier>> GLOBAL_LOOT_MODIFIERS = Regeneration.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS);
public static final RegistryEntry<Codec<? extends IGlobalLootModifier>> SIMPLE_LOOT_MODIFIER = GLOBAL_LOOT_MODIFIERS.register("replace", () -> ReplaceItemModifier.CODEC);
public static final RegistryEntry<Codec<? extends IGlobalLootModifier>> ADD_ITEM_MODIFIER = GLOBAL_LOOT_MODIFIERS.register("add", () -> AddItemModifier.CODEC);
private static final RegistryObjects<MapCodec<? extends IGlobalLootModifier>> GLOBAL_LOOT_MODIFIERS = Regeneration.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS);
public static final RegistryEntry<MapCodec<? extends IGlobalLootModifier>> SIMPLE_LOOT_MODIFIER = GLOBAL_LOOT_MODIFIERS.register("replace", () -> ReplaceItemModifier.CODEC);
public static final RegistryEntry<MapCodec<? extends IGlobalLootModifier>> ADD_ITEM_MODIFIER = GLOBAL_LOOT_MODIFIERS.register("add", () -> AddItemModifier.CODEC);

@Override
public List<RegistryObjects<?>> getRegistryObjects() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.unrealdinnerbone.trenzalore.events;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.world.item.ItemStack;
Expand All @@ -13,13 +13,12 @@

public class AddItemModifier extends LootModifier {

private final ItemStack stack;
public static final Codec<AddItemModifier> CODEC = RecordCodecBuilder.create((builder) ->
codecStart(builder)
.and(ItemStack.CODEC.fieldOf("stack")
.forGetter((modifier) -> modifier.stack))
.apply(builder, AddItemModifier::new));

public static final MapCodec<AddItemModifier> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(
IGlobalLootModifier.LOOT_CONDITIONS_CODEC.fieldOf("conditions").forGetter(glm -> glm.conditions),
ItemStack.CODEC.fieldOf("table").forGetter(addItemModifier -> addItemModifier.stack)).apply(instance, AddItemModifier::new));

private final ItemStack stack;

public AddItemModifier(LootItemCondition[] conditionsIn, ItemStack itemStack) {
super(conditionsIn);
Expand All @@ -34,7 +33,7 @@ protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generate
}

@Override
public Codec<? extends IGlobalLootModifier> codec() {
public MapCodec<? extends IGlobalLootModifier> codec() {
return CODEC;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.unrealdinnerbone.trenzalore.events;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.world.item.ItemStack;
Expand All @@ -15,7 +16,7 @@ public class ReplaceItemModifier extends LootModifier {

private final Ingredient ingredient;
private final ItemStack stack;
public static final Codec<ReplaceItemModifier> CODEC = RecordCodecBuilder.create(builder ->
public static final MapCodec<ReplaceItemModifier> CODEC = RecordCodecBuilder.mapCodec(builder ->
codecStart(builder)
.and(Ingredient.CODEC_NONEMPTY.fieldOf("item")
.forGetter((modifier) -> modifier.ingredient))
Expand All @@ -42,7 +43,7 @@ protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generate
}

@Override
public Codec<? extends IGlobalLootModifier> codec() {
public MapCodec<? extends IGlobalLootModifier> codec() {
return CODEC;
}
}
2 changes: 2 additions & 0 deletions neo/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ public net.minecraft.world.item.CreativeModeTabs SPAWN_EGGS
public net.minecraft.world.item.CreativeModeTabs OP_BLOCKS
public net.minecraft.world.level.block.entity.BlockEntityType$Builder of(Lnet/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier;[Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/block/entity/BlockEntityType$Builder;
public net.minecraft.world.level.block.entity.BlockEntityType$BlockEntitySupplier
public net.minecraft.world.inventory.MenuType <init>(Lnet/minecraft/world/inventory/MenuType$MenuSupplier;Lnet/minecraft/world/flag/FeatureFlagSet;)V
public net.minecraft.world.inventory.MenuType$MenuSupplier
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ pluginManagement {



include("common", "neo", "fabric", "forge")
include("common", "neo", "fabric")

0 comments on commit 0652b1d

Please sign in to comment.