mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-30 13:05:25 -05:00
Fix fluid testmod, add dummy init method to FluidStack (classloading 😍)
Signed-off-by: Max <maxh2709@gmail.com>
This commit is contained in:
@@ -244,4 +244,8 @@ public final class FluidStack {
|
||||
if (isEmpty()) return this;
|
||||
return new FluidStack(getRawFluidSupplier(), amount, getTag());
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
// classloading my beloved 😍
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ import java.util.function.Supplier;
|
||||
public enum FluidStackImpl implements FluidStack.FluidStackAdapter<FluidStackImpl.Pair> {
|
||||
INSTANCE;
|
||||
|
||||
static {
|
||||
dev.architectury.fluid.FluidStack.init();
|
||||
}
|
||||
|
||||
public static Function<FluidStack, Object> toValue;
|
||||
public static Function<Object, FluidStack> fromValue;
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@ import static dev.architectury.utils.Amount.toInt;
|
||||
public enum FluidStackImpl implements dev.architectury.fluid.FluidStack.FluidStackAdapter<FluidStack> {
|
||||
INSTANCE;
|
||||
|
||||
static {
|
||||
dev.architectury.fluid.FluidStack.init();
|
||||
}
|
||||
|
||||
public static Function<dev.architectury.fluid.FluidStack, Object> toValue;
|
||||
public static Function<Object, dev.architectury.fluid.FluidStack> fromValue;
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static dev.architectury.test.TestMod.SINK;
|
||||
|
||||
@@ -119,7 +120,7 @@ public class TestRegistries {
|
||||
try {
|
||||
// In example mod the forge class isn't being replaced, this is not required in mods depending on architectury
|
||||
return (Item) Class.forName(!Platform.isForge() ? "dev.architectury.core.item.ArchitecturyBucketItem" : "dev.architectury.core.item.forge.imitator.ArchitecturyBucketItem")
|
||||
.getDeclaredConstructor(RegistrySupplier.class, Item.Properties.class)
|
||||
.getDeclaredConstructor(Supplier.class, Item.Properties.class)
|
||||
.newInstance(TestRegistries.TEST_FLUID, new Item.Properties().tab(TestCreativeTabs.TEST_TAB));
|
||||
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -141,7 +142,7 @@ public class TestRegistries {
|
||||
try {
|
||||
// In example mod the forge class isn't being replaced, this is not required in mods depending on architectury
|
||||
return (LiquidBlock) Class.forName(!Platform.isForge() ? "dev.architectury.core.block.ArchitecturyLiquidBlock" : "dev.architectury.core.block.forge.imitator.ArchitecturyLiquidBlock")
|
||||
.getDeclaredConstructor(RegistrySupplier.class, BlockBehaviour.Properties.class)
|
||||
.getDeclaredConstructor(Supplier.class, BlockBehaviour.Properties.class)
|
||||
.newInstance(TestRegistries.TEST_FLUID, BlockBehaviour.Properties.copy(Blocks.WATER).noCollission().strength(100.0F).noDrops());
|
||||
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
Reference in New Issue
Block a user