Skip to content

Commit

Permalink
wip: Update to Minecraft 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Mar 1, 2024
1 parent 67218a7 commit 788cde5
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
package net.blay09.mods.refinedrelocation;

import net.blay09.mods.balm.api.Balm;
import net.blay09.mods.balm.api.DeferredObject;
import net.blay09.mods.balm.common.BalmBlockEntity;
import net.blay09.mods.balm.fabric.provider.FabricBalmProviders;
import net.blay09.mods.refinedrelocation.api.filter.IMultiRootFilter;
import net.blay09.mods.refinedrelocation.api.filter.IRootFilter;
import net.blay09.mods.refinedrelocation.api.grid.ISortingGridMember;
import net.blay09.mods.refinedrelocation.block.entity.ModBlockEntities;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.entity.BlockEntityType;

public class FabricRefinedRelocation implements ModInitializer {
@Override
public void onInitialize() {
Balm.initialize(RefinedRelocation.MOD_ID, RefinedRelocation::initialize);

registerProvider("sorting_grid_member", ISortingGridMember.class, ModBlockEntities.sortingChests.stream().map(DeferredObject::get).toArray(BlockEntityType[]::new));
registerProvider("root_filter", IRootFilter.class, ModBlockEntities.sortingChests.stream().map(DeferredObject::get).toArray(BlockEntityType[]::new));
registerProvider("multi_root_filter", IMultiRootFilter.class, ModBlockEntities.sortingChests.stream().map(DeferredObject::get).toArray(BlockEntityType[]::new));
}

private <T> void registerProvider(String name, Class<T> clazz, BlockEntityType<?>... blockEntities) {
var providers = ((FabricBalmProviders) Balm.getProviders());
ResourceLocation identifier = new ResourceLocation(RefinedRelocation.MOD_ID, name);
providers.registerProvider(identifier, clazz);
registerLookup(identifier, clazz, blockEntities);
}

private <T> void registerLookup(ResourceLocation identifier, Class<T> clazz, BlockEntityType<?>... blockEntities) {
var lookup = BlockApiLookup.get(identifier, clazz, Void.class);
lookup.registerForBlockEntities((blockEntity, context) -> ((BalmBlockEntity) blockEntity).getProvider(clazz), blockEntities);
}
}
15 changes: 7 additions & 8 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"ZerotS"
],
"contact": {
"homepage": "https://blay09.net/mods/refinedrelocation",
"sources": "https://github.com/ModdingForBlockheads/RefinedRelocation2",
"issues": "https://github.com/ModdingForBlockheads/RefinedRelocation2/issues"
"homepage": "https://mods.twelveiterations.com/mc/refined-relocation/",
"sources": "https://github.com/TwelveIterationMods/RefinedRelocation2",
"issues": "https://github.com/TwelveIterationMods/RefinedRelocation2/issues"
},

"license": "All Rights Reserved",
Expand All @@ -34,11 +34,10 @@
"refinedrelocation.mixins.json"
],
"depends": {
"cloth-config2": ">=5.0.34",
"balm-fabric": ">=4.2.0",
"fabricloader": ">=0.14.7",
"balm-fabric": ">=7.0.0",
"fabricloader": ">=0.14.21",
"fabric": "*",
"minecraft": "1.19.x",
"minecraft": ">=1.20",
"java": ">=17"
},
"suggests": {
Expand All @@ -47,7 +46,7 @@
"custom": {
"modmenu": {
"links": {
"modmenu.discord": "https://discord.gg/scGAfXC"
"modmenu.discord": "https://discord.gg/VAfZ2Nau6j"
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions fabric/src/main/resources/refinedrelocation.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"package": "net.blay09.mods.refinedrelocation.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"AbstractContainerMenuAccessor",
"CreativeModeTabAccessor"
"AbstractContainerMenuAccessor"
],
"client": [
"LevelRendererAccessor",
Expand Down
12 changes: 6 additions & 6 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
modLoader="javafml"
loaderVersion="[41,)"
loaderVersion="${forge_loader_version_range}"
license="All rights reserved"
issueTrackerURL="https://github.com/ModdingForBlockheads/RefinedRelocation2/issues"
issueTrackerURL="https://github.com/TwelveIterationMods/RefinedRelocation2/issues"

[[mods]]
modId="refinedrelocation"
version="${file.jarVersion}"
displayName="Refined Relocation"
displayURL="https://blay09.net/mods/refinedrelocation"
displayURL="https://mods.twelveiterations.com/mc/refined-relocation"
logoFile="refinedrelocation-icon.png"
credits="BlayTheNinth"
authors="BlayTheNinth"
Expand All @@ -18,18 +18,18 @@ Adds sorting networks, filter systems, block extenders and more.
[[dependencies.refinedrelocation]]
modId="forge"
mandatory=true
versionRange="[41,)"
versionRange="${forge_version_range}"
ordering="NONE"
side="BOTH"
[[dependencies.refinedrelocation]]
modId="minecraft"
mandatory=true
versionRange="[1.19,1.20)"
versionRange="${minecraft_version_range}"
ordering="NONE"
side="BOTH"
[[dependencies.refinedrelocation]]
modId="balm"
mandatory=true
versionRange="[4.2.0,)"
versionRange="${balm_version_range}"
ordering="NONE"
side="BOTH"
3 changes: 1 addition & 2 deletions forge/src/main/resources/refinedrelocation.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"compatibilityLevel": "JAVA_17",
"refmap": "refinedrelocation.refmap.json",
"mixins": [
"AbstractContainerMenuAccessor",
"CreativeModeTabAccessor"
"AbstractContainerMenuAccessor"
],
"client": [
"LevelRendererAccessor",
Expand Down

0 comments on commit 788cde5

Please sign in to comment.