Преглед на файлове

Add testmod

Added public static modifiers to methods (OOPS)
Leo40Git преди 4 години
родител
ревизия
1ba9ae1a0b

+ 2 - 2
common/src/main/java/me/shedaniel/architectury/registry/ParticleFactories.java

@@ -39,12 +39,12 @@ public final class ParticleFactories {
     }
 
     @ExpectPlatform
-    <T extends ParticleOptions> void register(ParticleType<T> type, ParticleProvider<T> provider) {
+    public static <T extends ParticleOptions> void register(ParticleType<T> type, ParticleProvider<T> provider) {
         throw new AssertionError();
     }
 
     @ExpectPlatform
-    <T extends ParticleOptions> void register(ParticleType<T> type, PendingParticleProvider<T> constructor) {
+    public static <T extends ParticleOptions> void register(ParticleType<T> type, PendingParticleProvider<T> constructor) {
         throw new AssertionError();
     }
 

+ 2 - 0
testmod-common/src/main/java/me/shedaniel/architectury/test/TestMod.java

@@ -27,6 +27,7 @@ import me.shedaniel.architectury.test.debug.client.ClientOverlayMessageSink;
 import me.shedaniel.architectury.test.entity.TestEntity;
 import me.shedaniel.architectury.test.events.DebugEvents;
 import me.shedaniel.architectury.test.gamerule.TestGameRules;
+import me.shedaniel.architectury.test.particle.TestParticles;
 import me.shedaniel.architectury.test.registry.TestRegistries;
 import me.shedaniel.architectury.test.registry.client.TestKeybinds;
 import me.shedaniel.architectury.test.tags.TestTags;
@@ -45,6 +46,7 @@ public class TestMod {
         TestGameRules.init();
         TestTags.initialize();
         TestTrades.init();
+        TestParticles.initialize();
         if (Platform.getEnvironment() == Env.CLIENT) {
             TestKeybinds.initialize();
             EntityRenderers.register(TestEntity.TYPE, MinecartRenderer<TestEntity>::new);

+ 44 - 0
testmod-common/src/main/java/me/shedaniel/architectury/test/particle/TestParticles.java

@@ -0,0 +1,44 @@
+/*
+ * This file is part of architectury.
+ * Copyright (C) 2020, 2021 architectury
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package me.shedaniel.architectury.test.particle;
+
+import me.shedaniel.architectury.platform.Platform;
+import me.shedaniel.architectury.registry.DeferredRegister;
+import me.shedaniel.architectury.registry.ParticleFactories;
+import me.shedaniel.architectury.registry.RegistrySupplier;
+import me.shedaniel.architectury.test.TestMod;
+import me.shedaniel.architectury.utils.Env;
+import net.minecraft.client.particle.HeartParticle;
+import net.minecraft.core.Registry;
+import net.minecraft.core.particles.ParticleType;
+import net.minecraft.core.particles.SimpleParticleType;
+
+public class TestParticles {
+    public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES = DeferredRegister.create(TestMod.MOD_ID, Registry.PARTICLE_TYPE_REGISTRY);
+    
+    public static final RegistrySupplier<SimpleParticleType> TEST_PARTICLE = PARTICLE_TYPES.register("test_particle", () ->
+            new SimpleParticleType(false) { });
+    
+    public static void initialize() {
+        PARTICLE_TYPES.register();
+        if (Platform.getEnvironment() == Env.CLIENT)
+            ParticleFactories.register(TEST_PARTICLE.get(), HeartParticle.Provider::new);
+    }
+}

+ 5 - 0
testmod-common/src/main/resources/assets/architectury-test/particles/test_particle.json

@@ -0,0 +1,5 @@
+{
+  "textures": [
+    "architectury-test:test_particle"
+  ]
+}

BIN
testmod-common/src/main/resources/assets/architectury-test/textures/particle/test_particle.png