Update to 1.19

This commit is contained in:
shedaniel
2022-06-08 21:35:41 +08:00
parent 551edceb82
commit c77f040c21
33 changed files with 635 additions and 451 deletions

View File

@@ -253,9 +253,9 @@ public class DebugEvents {
e.printStackTrace();
}
});
ClientChatEvent.PROCESS.register((type, message, sender) -> {
TestMod.SINK.accept("Client chat sent: " + message + " of type " + type.chat());
return CompoundEventResult.pass();
ClientChatEvent.PROCESS.register((message) -> {
TestMod.SINK.accept("Client chat sent: " + message.getMessage());
return EventResult.pass();
});
ClientChatEvent.RECEIVED.register((type, message, sender) -> {
TestMod.SINK.accept("Client chat received: " + message.getString());

View File

@@ -20,23 +20,13 @@
package dev.architectury.test.recipes;
import com.google.gson.JsonObject;
import dev.architectury.core.RegistryEntry;
import dev.architectury.platform.Platform;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.CustomRecipe;
import net.minecraft.world.item.crafting.FireworkRocketRecipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import java.util.Objects;
public class TestRecipeSerializer extends RegistryEntry<RecipeSerializer<?>> implements RecipeSerializer<CustomRecipe> {
public TestRecipeSerializer() {
if (Platform.isForge() && !Objects.equals(getRegistryType(), RecipeSerializer.class)) {
throw new IllegalStateException("getRegistryType() must be of type " + RecipeSerializer.class.getName());
}
}
public class TestRecipeSerializer implements RecipeSerializer<CustomRecipe> {
@Override
public CustomRecipe fromJson(ResourceLocation id, JsonObject json) {
return new FireworkRocketRecipe(id);

View File

@@ -19,7 +19,6 @@
package dev.architectury.test.registry;
import dev.architectury.core.RegistryEntry;
import dev.architectury.core.fluid.ArchitecturyFluidAttributes;
import dev.architectury.core.fluid.SimpleArchitecturyFluidAttributes;
import dev.architectury.core.item.ArchitecturySpawnEggItem;
@@ -66,7 +65,7 @@ import java.util.function.Supplier;
import static dev.architectury.test.TestMod.SINK;
public class TestRegistries {
public static final class TestInt extends RegistryEntry<TestInt> {
public static final class TestInt {
public final int value;
public TestInt(int value) {
@@ -122,7 +121,8 @@ public class TestRegistries {
return (Item) Class.forName(!Platform.isForge() ? "dev.architectury.core.item.ArchitecturyBucketItem" : "dev.architectury.core.item.forge.imitator.ArchitecturyBucketItem")
.getDeclaredConstructor(Supplier.class, Item.Properties.class)
.newInstance(TestRegistries.TEST_FLUID, new Item.Properties().tab(TestCreativeTabs.TEST_TAB));
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
IllegalAccessException e) {
throw new RuntimeException(e);
}
});
@@ -144,7 +144,8 @@ public class TestRegistries {
return (LiquidBlock) Class.forName(!Platform.isForge() ? "dev.architectury.core.block.ArchitecturyLiquidBlock" : "dev.architectury.core.block.forge.imitator.ArchitecturyLiquidBlock")
.getDeclaredConstructor(Supplier.class, BlockBehaviour.Properties.class)
.newInstance(TestRegistries.TEST_FLUID, BlockBehaviour.Properties.copy(Blocks.WATER).noCollission().strength(100.0F).noLootTable());
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
IllegalAccessException e) {
throw new RuntimeException(e);
}
});
@@ -155,7 +156,8 @@ public class TestRegistries {
return (FlowingFluid) Class.forName(!Platform.isForge() ? "dev.architectury.core.fluid.ArchitecturyFlowingFluid$Source" : "dev.architectury.core.fluid.forge.imitator.ArchitecturyFlowingFluid$Source")
.getDeclaredConstructor(ArchitecturyFluidAttributes.class)
.newInstance(TestRegistries.TEST_FLUID_ATTRIBUTES);
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
IllegalAccessException e) {
throw new RuntimeException(e);
}
});
@@ -166,7 +168,8 @@ public class TestRegistries {
return (FlowingFluid) Class.forName(!Platform.isForge() ? "dev.architectury.core.fluid.ArchitecturyFlowingFluid$Flowing" : "dev.architectury.core.fluid.forge.imitator.ArchitecturyFlowingFluid$Flowing")
.getDeclaredConstructor(ArchitecturyFluidAttributes.class)
.newInstance(TestRegistries.TEST_FLUID_ATTRIBUTES);
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
} catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
IllegalAccessException e) {
throw new RuntimeException(e);
}
});