LootItemFunctionType now use LootItemFunctionType
This commit is contained in:
@@ -102,7 +102,7 @@ processResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft 'net.minecraftforge:forge:1.18.2-40.0.32'
|
minecraft 'net.minecraftforge:forge:1.18.2-40.1.48'
|
||||||
|
|
||||||
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.4.171:api")
|
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.4.171:api")
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.4.171")
|
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.4.171")
|
||||||
@@ -122,7 +122,7 @@ jar {
|
|||||||
"Specification-Vendor" : "refinedmods",
|
"Specification-Vendor" : "refinedmods",
|
||||||
"Specification-Version" : "1",
|
"Specification-Version" : "1",
|
||||||
"Implementation-Title" : project.name,
|
"Implementation-Title" : project.name,
|
||||||
"Implementation-Version" : "${version}",
|
"Implementation-Version" : project.jar.archiveVersion,
|
||||||
"Implementation-Vendor" : "refinedmods",
|
"Implementation-Vendor" : "refinedmods",
|
||||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||||
])
|
])
|
||||||
|
@@ -48,6 +48,7 @@ public final class RS {
|
|||||||
|
|
||||||
RSBlocks.register();
|
RSBlocks.register();
|
||||||
RSItems.register();
|
RSItems.register();
|
||||||
|
RSLootFunctions.register();
|
||||||
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(CommonSetup::onCommonSetup);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(CommonSetup::onCommonSetup);
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(BlockEntityType.class, CommonSetup::onRegisterBlockEntities);
|
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(BlockEntityType.class, CommonSetup::onRegisterBlockEntities);
|
||||||
|
@@ -5,38 +5,30 @@ import com.refinedmods.refinedstorage.loottable.CrafterLootFunction;
|
|||||||
import com.refinedmods.refinedstorage.loottable.PortableGridBlockLootFunction;
|
import com.refinedmods.refinedstorage.loottable.PortableGridBlockLootFunction;
|
||||||
import com.refinedmods.refinedstorage.loottable.StorageBlockLootFunction;
|
import com.refinedmods.refinedstorage.loottable.StorageBlockLootFunction;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType;
|
import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType;
|
||||||
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
public final class RSLootFunctions {
|
public final class RSLootFunctions {
|
||||||
private static LootItemFunctionType storageBlock;
|
public static final RegistryObject<LootItemFunctionType> STORAGE_BLOCK;
|
||||||
private static LootItemFunctionType portableGrid;
|
public static final RegistryObject<LootItemFunctionType> PORTABLE_GRID;
|
||||||
private static LootItemFunctionType crafter;
|
public static final RegistryObject<LootItemFunctionType> CRAFTER;
|
||||||
private static LootItemFunctionType controller;
|
public static final RegistryObject<LootItemFunctionType> CONTROLLER;
|
||||||
|
|
||||||
|
private static final DeferredRegister<LootItemFunctionType> LOOT_ITEM_FUNCTIONS = DeferredRegister.create(Registry.LOOT_FUNCTION_REGISTRY, RS.ID);
|
||||||
|
|
||||||
|
static {
|
||||||
|
STORAGE_BLOCK = LOOT_ITEM_FUNCTIONS.register("storage_block", () -> new LootItemFunctionType(new StorageBlockLootFunction.Serializer()));
|
||||||
|
PORTABLE_GRID = LOOT_ITEM_FUNCTIONS.register("portable_grid", () -> new LootItemFunctionType(new PortableGridBlockLootFunction.Serializer()));
|
||||||
|
CRAFTER = LOOT_ITEM_FUNCTIONS.register("crafter", () -> new LootItemFunctionType(new CrafterLootFunction.Serializer()));
|
||||||
|
CONTROLLER = LOOT_ITEM_FUNCTIONS.register("controller", () -> new LootItemFunctionType(new ControllerLootFunction.Serializer()));
|
||||||
|
}
|
||||||
|
|
||||||
private RSLootFunctions() {
|
private RSLootFunctions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
storageBlock = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "storage_block"), new LootItemFunctionType(new StorageBlockLootFunction.Serializer()));
|
LOOT_ITEM_FUNCTIONS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||||
portableGrid = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "portable_grid"), new LootItemFunctionType(new PortableGridBlockLootFunction.Serializer()));
|
|
||||||
crafter = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "crafter"), new LootItemFunctionType(new CrafterLootFunction.Serializer()));
|
|
||||||
controller = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "controller"), new LootItemFunctionType(new ControllerLootFunction.Serializer()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LootItemFunctionType getStorageBlock() {
|
|
||||||
return storageBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LootItemFunctionType getPortableGrid() {
|
|
||||||
return portableGrid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LootItemFunctionType getCrafter() {
|
|
||||||
return crafter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LootItemFunctionType getController() {
|
|
||||||
return controller;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@ public class ControllerLootFunction extends LootItemConditionalFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LootItemFunctionType getType() {
|
public LootItemFunctionType getType() {
|
||||||
return RSLootFunctions.getController();
|
return RSLootFunctions.CONTROLLER.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer extends LootItemConditionalFunction.Serializer<ControllerLootFunction> {
|
public static class Serializer extends LootItemConditionalFunction.Serializer<ControllerLootFunction> {
|
||||||
|
@@ -40,7 +40,7 @@ public class CrafterLootFunction extends LootItemConditionalFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LootItemFunctionType getType() {
|
public LootItemFunctionType getType() {
|
||||||
return RSLootFunctions.getCrafter();
|
return RSLootFunctions.CRAFTER.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer extends LootItemConditionalFunction.Serializer<CrafterLootFunction> {
|
public static class Serializer extends LootItemConditionalFunction.Serializer<CrafterLootFunction> {
|
||||||
|
@@ -30,7 +30,7 @@ public class PortableGridBlockLootFunction extends LootItemConditionalFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LootItemFunctionType getType() {
|
public LootItemFunctionType getType() {
|
||||||
return RSLootFunctions.getPortableGrid();
|
return RSLootFunctions.PORTABLE_GRID.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer extends LootItemConditionalFunction.Serializer<PortableGridBlockLootFunction> {
|
public static class Serializer extends LootItemConditionalFunction.Serializer<PortableGridBlockLootFunction> {
|
||||||
|
@@ -51,7 +51,7 @@ public class StorageBlockLootFunction extends LootItemConditionalFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LootItemFunctionType getType() {
|
public LootItemFunctionType getType() {
|
||||||
return RSLootFunctions.getStorageBlock();
|
return RSLootFunctions.STORAGE_BLOCK.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer extends LootItemConditionalFunction.Serializer<StorageBlockLootFunction> {
|
public static class Serializer extends LootItemConditionalFunction.Serializer<StorageBlockLootFunction> {
|
||||||
|
@@ -159,9 +159,6 @@ public final class CommonSetup {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onRegisterBlockEntities(RegistryEvent.Register<BlockEntityType<?>> e) {
|
public static void onRegisterBlockEntities(RegistryEvent.Register<BlockEntityType<?>> e) {
|
||||||
// Register here, there seems to be no specific register event for loot function types.
|
|
||||||
RSLootFunctions.register();
|
|
||||||
|
|
||||||
e.getRegistry().register(registerSynchronizationParameters(BlockEntityType.Builder.of((pos, state) -> new ControllerBlockEntity(NetworkType.NORMAL, pos, state), RSBlocks.CONTROLLER.getBlocks()).build(null).setRegistryName(RS.ID, "controller")));
|
e.getRegistry().register(registerSynchronizationParameters(BlockEntityType.Builder.of((pos, state) -> new ControllerBlockEntity(NetworkType.NORMAL, pos, state), RSBlocks.CONTROLLER.getBlocks()).build(null).setRegistryName(RS.ID, "controller")));
|
||||||
e.getRegistry().register(registerSynchronizationParameters(BlockEntityType.Builder.of((pos, state) -> new ControllerBlockEntity(NetworkType.CREATIVE, pos, state), RSBlocks.CREATIVE_CONTROLLER.getBlocks()).build(null).setRegistryName(RS.ID, "creative_controller")));
|
e.getRegistry().register(registerSynchronizationParameters(BlockEntityType.Builder.of((pos, state) -> new ControllerBlockEntity(NetworkType.CREATIVE, pos, state), RSBlocks.CREATIVE_CONTROLLER.getBlocks()).build(null).setRegistryName(RS.ID, "creative_controller")));
|
||||||
e.getRegistry().register(BlockEntityType.Builder.of(CableBlockEntity::new, RSBlocks.CABLE.get()).build(null).setRegistryName(RS.ID, "cable"));
|
e.getRegistry().register(BlockEntityType.Builder.of(CableBlockEntity::new, RSBlocks.CABLE.get()).build(null).setRegistryName(RS.ID, "cable"));
|
||||||
|
@@ -12,3 +12,9 @@ authors = "Refined Mods"
|
|||||||
description = '''
|
description = '''
|
||||||
An elegant solution to your hoarding problem
|
An elegant solution to your hoarding problem
|
||||||
'''
|
'''
|
||||||
|
[[dependencies.refinedstorage]]
|
||||||
|
modId="forge"
|
||||||
|
mandatory=true
|
||||||
|
versionRange="[40.1,)"
|
||||||
|
ordering="NONE"
|
||||||
|
side="BOTH"
|
Reference in New Issue
Block a user