Co-authored-by: Max <maxh2709@gmail.com>
This commit is contained in:
Josiah Glosson
2024-01-09 15:11:07 -06:00
committed by GitHub
parent e986c607c3
commit 3483bc44e3
5 changed files with 40 additions and 3 deletions

View File

@@ -75,9 +75,18 @@ public class TestRegistries {
public TestInt(int value) {
this.value = value;
}
@Override
public String toString() {
return Integer.toString(value);
}
}
public static final Registrar<TestInt> INTS = RegistrarManager.get(TestMod.MOD_ID).<TestInt>builder(new ResourceLocation(TestMod.MOD_ID, "ints"))
public static final Registrar<TestInt> INTS = RegistrarManager.get(TestMod.MOD_ID)
.<TestInt>builderDefaulted(
new ResourceLocation(TestMod.MOD_ID, "ints"),
new ResourceLocation(TestMod.MOD_ID, "test_no_int")
)
.syncToClients()
.build();
public static final DeferredRegister<CreativeModeTab> TABS = DeferredRegister.create(TestMod.MOD_ID, Registries.CREATIVE_MODE_TAB);
@@ -101,6 +110,7 @@ public class TestRegistries {
.bucketItemSupplier(() -> TestRegistries.TEST_FLUID_BUCKET)
.color(0xFF0000);
public static final RegistrySupplier<TestInt> TEST_NO_INT = INTS.register(new ResourceLocation(TestMod.MOD_ID, "test_no_int"), () -> new TestInt(0));
public static final RegistrySupplier<TestInt> TEST_INT = INTS.register(new ResourceLocation(TestMod.MOD_ID, "test_int"), () -> new TestInt(1));
public static final RegistrySupplier<TestInt> TEST_INT_2 = INTS.register(new ResourceLocation(TestMod.MOD_ID, "test_int_2"), () -> new TestInt(2));
@@ -223,5 +233,8 @@ public class TestRegistries {
TEST_RECIPE_TYPE.listen(type -> {
System.out.println("Registered recipe type!");
});
INTS.listen(TEST_INT_2, i -> {
System.out.println("Non-existent int: " + INTS.get(new ResourceLocation("non_existent")));
});
}
}