Finish Colored Flames
@@ -1,5 +1,6 @@
|
||||
package me.hypherionmc.hyperlighting.client.particles;
|
||||
|
||||
import me.hypherionmc.hyperlighting.common.init.FlameParticles;
|
||||
import me.hypherionmc.hyperlighting.common.init.HLParticles;
|
||||
import net.minecraft.client.particle.ParticleEngine;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
@@ -8,7 +9,9 @@ import net.minecraft.core.particles.ParticleType;
|
||||
public class ParticleRegistryHandler {
|
||||
|
||||
public static void registerParticles(ParticleStrategy strategy) {
|
||||
strategy.register(HLParticles.COLORED_FLAME.get(), ColoredFlameParticle.Factory::new);
|
||||
for (FlameParticles value : FlameParticles.values()) {
|
||||
strategy.register(value.getParticle().get(), ColoredFlameParticle.Factory::new);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ParticleStrategy {
|
||||
|
@@ -8,6 +8,7 @@ import me.hypherionmc.craterlib.util.BlockStateUtils;
|
||||
import me.hypherionmc.craterlib.util.RenderUtils;
|
||||
import me.hypherionmc.hyperlighting.api.LightableBlock;
|
||||
import me.hypherionmc.hyperlighting.common.init.CommonRegistration;
|
||||
import me.hypherionmc.hyperlighting.common.init.FlameParticles;
|
||||
import me.hypherionmc.hyperlighting.common.init.HLItems;
|
||||
import me.hypherionmc.hyperlighting.common.init.HLSounds;
|
||||
import me.hypherionmc.hyperlighting.util.StackUtil;
|
||||
@@ -63,14 +64,11 @@ public class AdvancedTorchBlock extends HorizontalDirectionalBlock implements Dy
|
||||
Direction.UP, Block.box(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D)
|
||||
));
|
||||
|
||||
private final Supplier<SimpleParticleType> particleType;
|
||||
|
||||
private DyeColor color;
|
||||
|
||||
public AdvancedTorchBlock(String name, DyeColor color, CreativeModeTab tab, Supplier<SimpleParticleType> type) {
|
||||
public AdvancedTorchBlock(String name, DyeColor color, CreativeModeTab tab) {
|
||||
super(Properties.of(Material.WOOD).noCollission().instabreak().lightLevel(BlockStateUtils.createLightLevelFromLitBlockState(15)));
|
||||
this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.NORTH).setValue(LIT, CommonRegistration.config.torchConfig.litByDefault).setValue(COLOR, color));
|
||||
this.particleType = type;
|
||||
this.color = color;
|
||||
|
||||
HLItems.register(name, () -> new BlockItemDyable(this, new Item.Properties().tab(tab)));
|
||||
@@ -191,7 +189,7 @@ public class AdvancedTorchBlock extends HorizontalDirectionalBlock implements Dy
|
||||
double d1 = (double) pos.getY() + 0.7D;
|
||||
double d2 = (double) pos.getZ() + 0.5D;
|
||||
levelIn.addParticle(ParticleTypes.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
levelIn.addParticle(particleType.get(), d0, d1, d2, 0D, 0D, 0D);
|
||||
levelIn.addParticle(FlameParticles.getParticleByColor(color).get(), d0, d1, d2, 0D, 0D, 0D);
|
||||
} else {
|
||||
Direction direction = stateIn.getValue(FACING);
|
||||
double d0 = (double) pos.getX() + 0.5D;
|
||||
@@ -199,7 +197,7 @@ public class AdvancedTorchBlock extends HorizontalDirectionalBlock implements Dy
|
||||
double d2 = (double) pos.getZ() + 0.5D;
|
||||
Direction direction1 = direction.getOpposite();
|
||||
levelIn.addParticle(ParticleTypes.SMOKE, d0 + 0.37D * (double) direction1.getStepX(), d1 + 0.15D, d2 + 0.37D * (double) direction1.getStepZ(), 0.0D, 0.0D, 0.0D);
|
||||
levelIn.addParticle(particleType.get(), d0 + 0.37D * (double) direction1.getStepX(), d1 + 0.15D, d2 + 0.37D * (double) direction1.getStepZ(), 0D, 0D, 0D);
|
||||
levelIn.addParticle(FlameParticles.getParticleByColor(color).get(), d0 + 0.37D * (double) direction1.getStepX(), d1 + 0.15D, d2 + 0.37D * (double) direction1.getStepZ(), 0D, 0D, 0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,57 @@
|
||||
package me.hypherionmc.hyperlighting.common.init;
|
||||
|
||||
import me.hypherionmc.craterlib.common.particles.WrappedSimpleParticleType;
|
||||
import me.hypherionmc.craterlib.systems.reg.RegistrationProvider;
|
||||
import me.hypherionmc.craterlib.systems.reg.RegistryObject;
|
||||
import me.hypherionmc.hyperlighting.Constants;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static me.hypherionmc.hyperlighting.common.init.HLParticles.register;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
* @date 05/08/2022
|
||||
*/
|
||||
public enum FlameParticles {
|
||||
WHITE(DyeColor.WHITE),
|
||||
ORANGE(DyeColor.ORANGE),
|
||||
MAGENTA(DyeColor.MAGENTA),
|
||||
LIGHT_BLUE(DyeColor.LIGHT_BLUE),
|
||||
YELLOW(DyeColor.YELLOW),
|
||||
LIME(DyeColor.LIME),
|
||||
PINK(DyeColor.PINK),
|
||||
GRAY(DyeColor.GRAY),
|
||||
LIGHT_GRAY(DyeColor.LIGHT_GRAY),
|
||||
CYAN(DyeColor.CYAN),
|
||||
PURPLE(DyeColor.PURPLE),
|
||||
BLUE(DyeColor.BLUE),
|
||||
BROWN(DyeColor.BROWN),
|
||||
GREEN(DyeColor.GREEN),
|
||||
RED(DyeColor.RED),
|
||||
BLACK(DyeColor.BLACK);
|
||||
|
||||
private final RegistryObject<SimpleParticleType> PARTICLE;
|
||||
private final DyeColor color;
|
||||
|
||||
private FlameParticles(DyeColor color) {
|
||||
PARTICLE = register("flame_" + color.getName().toLowerCase(), () -> new WrappedSimpleParticleType(false));
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public RegistryObject<SimpleParticleType> getParticle() {
|
||||
return PARTICLE;
|
||||
}
|
||||
|
||||
public static RegistryObject<SimpleParticleType> getParticleByColor(DyeColor color) {
|
||||
return Arrays.stream(FlameParticles.values()).filter(p -> p.color == color).findFirst().get().getParticle();
|
||||
}
|
||||
|
||||
public static void loadAll() {}
|
||||
}
|
@@ -16,7 +16,7 @@ public class HLBlocks {
|
||||
public static RegistrationProvider<Block> BLOCKS = RegistrationProvider.get(Registry.BLOCK_REGISTRY, Constants.MOD_ID);
|
||||
|
||||
/* Torches */
|
||||
public static BlockRegistryObject<Block> ADVANCED_TORCH = register("advanced_torch", () -> new AdvancedTorchBlock("advanced_torch", DyeColor.ORANGE, CommonRegistration.LIGHTS_TAB, HLParticles.COLORED_FLAME));
|
||||
public static BlockRegistryObject<Block> ADVANCED_TORCH = register("advanced_torch", () -> new AdvancedTorchBlock("advanced_torch", DyeColor.ORANGE, CommonRegistration.LIGHTS_TAB));
|
||||
|
||||
public static void loadAll() {}
|
||||
|
||||
|
@@ -14,12 +14,12 @@ public class HLParticles {
|
||||
|
||||
public static final RegistrationProvider<ParticleType<?>> PARTICLES = RegistrationProvider.get(Registry.PARTICLE_TYPE_REGISTRY, Constants.MOD_ID);
|
||||
|
||||
public static RegistryObject<SimpleParticleType> COLORED_FLAME = register("colored_flame", () -> new WrappedSimpleParticleType(false));
|
||||
|
||||
public static <T extends ParticleType<?>> RegistryObject<T> register(String name, Supplier<T> particle) {
|
||||
return PARTICLES.register(name, particle);
|
||||
}
|
||||
|
||||
public static void loadAll() {}
|
||||
public static void loadAll() {
|
||||
FlameParticles.loadAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,6 +3,8 @@
|
||||
|
||||
"subtitles.torch_ignite": "Torch Ignite Sound",
|
||||
|
||||
"entity.hyperlighting.firefly": "Neon Fly",
|
||||
|
||||
"cl.hyperlightingconfig.title": "Hyper Lighting Config",
|
||||
"cl.torchconfig.litbydefault": "Lit when Placed",
|
||||
"cl.torchconfig.requirestool": "Requires Torch Lighter"
|
||||
|
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/colored_flame_red"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_black"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_blue"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_brown"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_cyan"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_gray"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_green"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_light_blue"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_light_gray"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_lime"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_magenta"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_orange"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_pink"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_purple"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_red"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_white"
|
||||
]
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:flames/flame_yellow"
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 541 B |
After Width: | Height: | Size: 592 B |
After Width: | Height: | Size: 584 B |
After Width: | Height: | Size: 592 B |
After Width: | Height: | Size: 596 B |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 592 B |
After Width: | Height: | Size: 596 B |
After Width: | Height: | Size: 590 B |
After Width: | Height: | Size: 599 B |
After Width: | Height: | Size: 596 B |
After Width: | Height: | Size: 594 B |
After Width: | Height: | Size: 594 B |
After Width: | Height: | Size: 594 B |
After Width: | Height: | Size: 586 B |
After Width: | Height: | Size: 626 B |