Search in sources :

Example 1 with ParticleType

use of net.minecraft.particle.ParticleType in project Biome-Makeover by Lemonszz.

the class NetworkUtil method doEntityParticle.

public static void doEntityParticle(World world, ParticleEffect effect, Entity e, int count, float offset) {
    if (world.isClient)
        return;
    PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
    buf.writeInt(e.getEntityId());
    buf.writeInt(Registry.PARTICLE_TYPE.getRawId((ParticleType<?>) effect));
    buf.writeInt(count);
    buf.writeFloat(offset);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    serverSendTracking(world, e.getBlockPos(), BMNetwork.ENTITY_PARTICLE, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf) ParticleType(net.minecraft.particle.ParticleType)

Example 2 with ParticleType

use of net.minecraft.particle.ParticleType in project Terracraft by SimplyCmd.

the class BlockRegistry method torch.

private static Torch torch(String prefix, ParticleType<?> particle, JIngredient resource) {
    final String torch = prefix + "_torch";
    final String wallTorch = prefix + "_wall_torch";
    final SimpleBlock block1 = new SimpleBlock(ID(torch), new CustomTorchBlock(FabricBlockSettings.of(Material.DECORATION).noCollision().breakInstantly().luminance((state) -> 10).sounds(BlockSoundGroup.WOOD), ParticleTypes.SOUL_FIRE_FLAME));
    final SimpleBlock block2 = new SimpleBlock(ID(wallTorch), new CustomWallTorchBlock(FabricBlockSettings.of(Material.DECORATION).noCollision().breakInstantly().luminance((state) -> 10).sounds(BlockSoundGroup.WOOD), ParticleTypes.SOUL_FIRE_FLAME));
    final SimpleItem item1 = new SimpleItem(ID(torch), new WallStandingBlockItem(block1.getBlock(), block2.getBlock(), new FabricItemSettings().group(ItemGroup.DECORATIONS))).blockItemModel(block1.getBlock());
    // Delay this until after said items are registered
    Resources.RESOURCE_PACK.addRecipe(ID(torch), JRecipe.shaped(JPattern.pattern("X", "#", "S"), JKeys.keys().key("X", JIngredient.ingredient().item(Items.COAL).item(Items.CHARCOAL)).key("#", JIngredient.ingredient().item(Items.STICK)).key("S", resource), JResult.itemStack(item1.getItem(), 4)));
    return new Torch(block1, block2, item1);
}
Also used : SimpleBlock(com.simplycmd.featherlib.registry.SimpleBlock) io.github.simplycmd.terracraft.blocks(io.github.simplycmd.terracraft.blocks) JRecipe(net.devtech.arrp.json.recipe.JRecipe) Getter(lombok.Getter) ParticleType(net.minecraft.particle.ParticleType) FabricBlockSettings(net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings) LifeCrystalBlockItem(io.github.simplycmd.terracraft.blocks.items.LifeCrystalBlockItem) SimpleBlock(com.simplycmd.featherlib.registry.SimpleBlock) JIngredient(net.devtech.arrp.json.recipe.JIngredient) net.minecraft.item(net.minecraft.item) JKeys(net.devtech.arrp.json.recipe.JKeys) FabricItemSettings(net.fabricmc.fabric.api.item.v1.FabricItemSettings) net.minecraft.block(net.minecraft.block) ParticleTypes(net.minecraft.particle.ParticleTypes) ItemModel(com.simplycmd.featherlib.registry.SimpleBlock.ItemModel) Resources(com.simplycmd.featherlib.registry.Resources) Identifier(net.minecraft.util.Identifier) JResult(net.devtech.arrp.json.recipe.JResult) SimpleItem(com.simplycmd.featherlib.registry.SimpleItem) JPattern(net.devtech.arrp.json.recipe.JPattern) Main(io.github.simplycmd.terracraft.Main) BlockSoundGroup(net.minecraft.sound.BlockSoundGroup) FabricItemSettings(net.fabricmc.fabric.api.item.v1.FabricItemSettings) SimpleItem(com.simplycmd.featherlib.registry.SimpleItem)

Example 3 with ParticleType

use of net.minecraft.particle.ParticleType in project meteor-client by MeteorDevelopment.

the class ParticleTypeListSetting method parseImpl.

@Override
protected List<ParticleType<?>> parseImpl(String str) {
    String[] values = str.split(",");
    List<ParticleType<?>> particleTypes = new ArrayList<>(values.length);
    try {
        for (String value : values) {
            ParticleType<?> particleType = parseId(Registry.PARTICLE_TYPE, value);
            if (particleType instanceof ParticleEffect)
                particleTypes.add(particleType);
        }
    } catch (Exception ignored) {
    }
    return particleTypes;
}
Also used : ParticleEffect(net.minecraft.particle.ParticleEffect) ArrayList(java.util.ArrayList) ParticleType(net.minecraft.particle.ParticleType) NbtString(net.minecraft.nbt.NbtString)

Example 4 with ParticleType

use of net.minecraft.particle.ParticleType in project Biome-Makeover by Lemonszz.

the class NetworkUtil method doCenteredEntityParticle.

public static void doCenteredEntityParticle(World world, ParticleEffect effect, Entity e, int count, boolean varyY) {
    if (world.isClient)
        return;
    PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
    buf.writeInt(e.getEntityId());
    buf.writeInt(Registry.PARTICLE_TYPE.getRawId((ParticleType<?>) effect));
    buf.writeInt(count);
    buf.writeBoolean(varyY);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    serverSendTracking(world, e.getBlockPos(), BMNetwork.ENTITY_PARTICLE_CENTERED, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf) ParticleType(net.minecraft.particle.ParticleType)

Example 5 with ParticleType

use of net.minecraft.particle.ParticleType in project Client by MatHax.

the class ParticleTypeListSetting method parseImpl.

@Override
protected List<ParticleType<?>> parseImpl(String str) {
    String[] values = str.split(",");
    List<ParticleType<?>> particleTypes = new ArrayList<>(values.length);
    try {
        for (String value : values) {
            ParticleType<?> particleType = parseId(Registry.PARTICLE_TYPE, value);
            if (particleType instanceof ParticleEffect)
                particleTypes.add(particleType);
        }
    } catch (Exception ignored) {
    }
    return particleTypes;
}
Also used : ParticleEffect(net.minecraft.particle.ParticleEffect) ArrayList(java.util.ArrayList) ParticleType(net.minecraft.particle.ParticleType) NbtString(net.minecraft.nbt.NbtString)

Aggregations

ParticleType (net.minecraft.particle.ParticleType)5 ArrayList (java.util.ArrayList)2 NbtString (net.minecraft.nbt.NbtString)2 PacketByteBuf (net.minecraft.network.PacketByteBuf)2 ParticleEffect (net.minecraft.particle.ParticleEffect)2 Resources (com.simplycmd.featherlib.registry.Resources)1 SimpleBlock (com.simplycmd.featherlib.registry.SimpleBlock)1 ItemModel (com.simplycmd.featherlib.registry.SimpleBlock.ItemModel)1 SimpleItem (com.simplycmd.featherlib.registry.SimpleItem)1 Main (io.github.simplycmd.terracraft.Main)1 io.github.simplycmd.terracraft.blocks (io.github.simplycmd.terracraft.blocks)1 LifeCrystalBlockItem (io.github.simplycmd.terracraft.blocks.items.LifeCrystalBlockItem)1 Getter (lombok.Getter)1 JIngredient (net.devtech.arrp.json.recipe.JIngredient)1 JKeys (net.devtech.arrp.json.recipe.JKeys)1 JPattern (net.devtech.arrp.json.recipe.JPattern)1 JRecipe (net.devtech.arrp.json.recipe.JRecipe)1 JResult (net.devtech.arrp.json.recipe.JResult)1 FabricItemSettings (net.fabricmc.fabric.api.item.v1.FabricItemSettings)1 FabricBlockSettings (net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings)1