[add] Magic Tourch
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
// 1.21.1 2026-10-16T12:48:59.62422735 Item Models: ichori
|
||||
// 1.21.1 2026-10-16T15:55:28.827063419 Item Models: ichori
|
||||
be44db6dcd5cd06217ef4e7a8025a21185ac48ac assets/ichori/models/item/test_spawn_light.json
|
||||
be44db6dcd5cd06217ef4e7a8025a21185ac48ac assets/ichori/models/item/test_spawn_magic_tourch.json
|
||||
|
||||
@@ -3,9 +3,13 @@ package ovh.glitchlabs.ichori.Block;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredBlock;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import ovh.glitchlabs.ichori.Block.custom.MagicTourch;
|
||||
import ovh.glitchlabs.ichori.Ichori;
|
||||
import ovh.glitchlabs.ichori.Item.ModItems;
|
||||
|
||||
@@ -15,6 +19,16 @@ public class ModBlocks {
|
||||
public static final DeferredRegister.Blocks BLOCKS =
|
||||
DeferredRegister.createBlocks(Ichori.MODID);
|
||||
|
||||
public static final DeferredBlock<Block> MAGIC_TOURCH = registerBlock("magic_tourch",
|
||||
() -> new MagicTourch(BlockBehaviour.Properties.of()
|
||||
.noCollission()
|
||||
.noOcclusion()
|
||||
.instabreak()
|
||||
.sound(SoundType.WOOD)
|
||||
.pushReaction(PushReaction.DESTROY)));
|
||||
|
||||
|
||||
|
||||
private static <T extends Block>DeferredBlock<T> registerBlock(String name, Supplier<T> block) {
|
||||
DeferredBlock<T> toReturn = BLOCKS.register(name, block);
|
||||
registerBlockItem(name, toReturn);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package ovh.glitchlabs.ichori.Block.custom;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import ovh.glitchlabs.ichori.Ichori;
|
||||
import ovh.glitchlabs.ichori.event.CustomPartical;
|
||||
|
||||
public class MagicTourch extends Block {
|
||||
CustomPartical partical = new CustomPartical();
|
||||
private static final VoxelShape SHAPE = Block.box(6.0, 0.0, 6.0, 10.0, 16.0, 10.0);
|
||||
|
||||
@Override
|
||||
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext ctx) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
public MagicTourch(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) {
|
||||
Vec3 spawnPos = new Vec3(pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5);
|
||||
partical.spawnParticleOnPosition(spawnPos, ResourceLocation.fromNamespaceAndPath(Ichori.MODID, "magic_tourch"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.neoforged.neoforge.registries.DeferredItem;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import ovh.glitchlabs.ichori.Ichori;
|
||||
import ovh.glitchlabs.ichori.Item.custom.test_spawn_light;
|
||||
import ovh.glitchlabs.ichori.Item.custom.test_spawn_magic_tourch;
|
||||
|
||||
public class ModItems {
|
||||
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(Ichori.MODID);
|
||||
@@ -13,6 +14,9 @@ public class ModItems {
|
||||
public static final DeferredItem<Item> TEST_Spawn_LIGHT = ITEMS.register("test_spawn_light",
|
||||
() -> new test_spawn_light(new Item.Properties()));
|
||||
|
||||
public static final DeferredItem<Item> TEST_Spawn_MAGIC_TOURCH = ITEMS.register("test_spawn_magic_tourch",
|
||||
() -> new test_spawn_magic_tourch(new Item.Properties()));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package ovh.glitchlabs.ichori.Item.custom;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import ovh.glitchlabs.ichori.Ichori;
|
||||
import ovh.glitchlabs.ichori.event.CustomPartical;
|
||||
|
||||
public class test_spawn_magic_tourch extends Item {
|
||||
CustomPartical partical = new CustomPartical();
|
||||
|
||||
public test_spawn_magic_tourch(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult useOn(UseOnContext context) {
|
||||
Level level = context.getLevel();
|
||||
Vec3 pos = context.getClickLocation();
|
||||
partical.spawnParticleOnPosition(pos, ResourceLocation.fromNamespaceAndPath(Ichori.MODID, "magic_tourch"));
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.data.PackOutput;
|
||||
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.registries.DeferredBlock;
|
||||
import ovh.glitchlabs.ichori.Block.ModBlocks;
|
||||
import ovh.glitchlabs.ichori.Ichori;
|
||||
|
||||
public class ModBlockStateProvider extends BlockStateProvider {
|
||||
|
||||
@@ -17,6 +17,7 @@ public class ModItemModelProvider extends ItemModelProvider {
|
||||
protected void registerModels() {
|
||||
|
||||
withExistingParent(ModItems.TEST_Spawn_LIGHT.getId().getPath(), mcLoc("item/stick"));
|
||||
withExistingParent(ModItems.TEST_Spawn_MAGIC_TOURCH.getId().getPath(), mcLoc("item/stick"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package ovh.glitchlabs.ichori.event;
|
||||
|
||||
import foundry.veil.api.client.render.VeilRenderSystem;
|
||||
import foundry.veil.api.quasar.particle.ParticleEmitter;
|
||||
import foundry.veil.api.quasar.particle.ParticleSystemManager;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class CustomPartical {
|
||||
|
||||
public static void spawnParticleOnPosition(Vec3 position, ResourceLocation id){
|
||||
try {
|
||||
ParticleSystemManager manager = VeilRenderSystem.renderer().getParticleManager();
|
||||
ParticleEmitter emitter = manager.createEmitter(id);
|
||||
emitter.setPosition(position);
|
||||
manager.addParticleSystem(emitter);
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"variants": {
|
||||
"": { "model": "ichori:block/magic_tourch" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:block/fence_post",
|
||||
"textures": {
|
||||
"texture": "minecraft:block/dark_oak_planks"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "ichori:block/magic_tourch"
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"count": 1,
|
||||
"emitter_settings": {
|
||||
"shape": {
|
||||
"shape": "veil:point",
|
||||
"dimensions": [
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"rotation": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"from_surface": true
|
||||
},
|
||||
"particle_settings": {
|
||||
"initial_rotation_variation": [
|
||||
150.0,
|
||||
200.0,
|
||||
150.0
|
||||
],
|
||||
"random_speed": true,
|
||||
"random_size": true,
|
||||
"random_lifetime": true,
|
||||
"random_initial_direction": true,
|
||||
"initial_direction_variation": [
|
||||
0.3,
|
||||
1.0,
|
||||
0.3
|
||||
],
|
||||
"random_initial_rotation": true,
|
||||
"particle_size_variation": 0.020000003,
|
||||
"particle_lifetime": 30,
|
||||
"particle_lifetime_variation": 30.0,
|
||||
"initial_direction": [
|
||||
0.0,
|
||||
1.0,
|
||||
0.0
|
||||
],
|
||||
"particle_speed": 0.005,
|
||||
"particle_speed_variation": 0.015,
|
||||
"base_particle_size": 0.08
|
||||
}
|
||||
},
|
||||
"particle_data": {
|
||||
"modules": [
|
||||
{
|
||||
"block": 8,
|
||||
"sky": 15,
|
||||
"module": "veil:lightmap"
|
||||
},
|
||||
{
|
||||
"gradient": {
|
||||
"color": -106349847
|
||||
},
|
||||
"brightness": 0.6,
|
||||
"radius": 3.5,
|
||||
"module": "veil:light"
|
||||
}
|
||||
],
|
||||
"sprite_data": {
|
||||
"sprite": "minecraft:textures/block/purple_stained_glass.png"
|
||||
},
|
||||
"additive": true,
|
||||
"render_style": "veil:cube"
|
||||
},
|
||||
"max_lifetime": 1,
|
||||
"loop": false,
|
||||
"rate": 2
|
||||
}
|
||||
Reference in New Issue
Block a user