Drachenbauer Posted April 4, 2020 Posted April 4, 2020 Hello Is there any way to display particles without any shading? To make them "glow" in exact the choosen color? Quote
imacatlolol Posted April 4, 2020 Posted April 4, 2020 If I had to guess, use the PARTICLE_SHEET_LIT type of IParticleRenderType. You could also make your own if it doesn't work in the way you want. Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
imacatlolol Posted April 4, 2020 Posted April 4, 2020 23 minutes ago, Drachenbauer said: How do i use it? Make a custom particle and override getRenderType. Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
Drachenbauer Posted April 4, 2020 Author Posted April 4, 2020 Can i make it extend RedstoneParticleData? Quote
imacatlolol Posted April 4, 2020 Posted April 4, 2020 RedstoneParticleData is not a particle. Extend RedstoneParticle instead. Quote I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
Drachenbauer Posted April 4, 2020 Author Posted April 4, 2020 (edited) I could not extend RedstoneParticle because it´s constructor is pivate. So i copyed it´s whoole code and extend SpriteTexturedParticle, like the vanilla one does. I made my constructor public, removed the random values from the color-calculations and changed the variant of getRenderType How do i now override the vanilla RedstoneParticle with my variant? Do i need to use registerFactory from ParticleManager ? Do i need to create my own version of RedstoneParticleData to access my particle at the Bottom of that code and register it umder the original vanilla registryname? Edited April 5, 2020 by Drachenbauer Quote
Drachenbauer Posted April 5, 2020 Author Posted April 5, 2020 (edited) push More questions in last post Edit: Now i added this: @SubscribeEvent public static void onParticleFactoryRegistration(ParticleFactoryRegisterEvent event) { Minecraft.getInstance().particles.registerFactory(ParticleTypes.DUST, YellowRedstoneParticle.Factory::new); } To the registries-area in my main-class. Now it shows bright yellow particles on all my redstone-components. There are Redstone-Torches on the comperator and the repeater. But in the vanilla-blocks, they don´t glow a bright, as the single redstone-torch. So i decided to fit their look exactly to the single one. Now i make particles appear on theese torches, just like the single redstone torches do. And if minimum one torch on theese components is on, i made them emmit light, just like the single one does, too. This is how my comperators look now. (in the middle a single Redstone.-Torch as reference) I like this new look. Edited April 5, 2020 by Drachenbauer Quote
Drachenbauer Posted April 5, 2020 Author Posted April 5, 2020 (edited) For the repeater i have got a little problem: I can set the particle position by direction. But using the BlockState DELAY for moving the particle position with the torch does not work. My code for this: package drachenbauer32.yellowredstonemod.blocks; import java.util.Random; import drachenbauer32.yellowredstonemod.util.Reference; import net.minecraft.block.BlockState; import net.minecraft.block.RepeaterBlock; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class YellowRepeaterBlock extends RepeaterBlock { private double ParticleX_1; private double ParticleX_2; private double ParticleZ_1; private double ParticleZ_2; public YellowRepeaterBlock(Properties properties) { super(properties); } @Override public int getLightValue(BlockState state) { if(state.get(POWERED)) { return 15; } else { return 0; } } private void setParticlePositions(BlockState state) { double delay = (double)state.get(DELAY) / 8; if (state.get(HORIZONTAL_FACING) == Direction.NORTH) { ParticleX_1 = 0.5; ParticleX_2 = 0.5; ParticleZ_1 = 0.8125; ParticleZ_2 = 0.6875 - delay; } else if (state.get(HORIZONTAL_FACING) == Direction.EAST) { ParticleX_1 = 0.1875; ParticleX_2 = 0.3125 + delay; ParticleZ_1 = 0.5; ParticleZ_2 = 0.5; } else if (state.get(HORIZONTAL_FACING) == Direction.SOUTH) { ParticleX_1 = 0.5; ParticleX_2 = 0.5; ParticleZ_1 = 0.1875; ParticleZ_2 = 0.3125 + delay; } else if (state.get(HORIZONTAL_FACING) == Direction.WEST) { ParticleX_1 = 0.8125; ParticleX_2 = 0.6875 - delay; ParticleZ_1 = 0.5; ParticleZ_2 = 0.5; } } @Override public void animateTick(BlockState state, World world, BlockPos pos, Random rand) { setParticlePositions(state); if (state.get(POWERED)) { double d0 = (double)pos.getX() + ParticleX_1 + (rand.nextDouble() - 0.5D) * 0.2D; double d1 = (double)pos.getY() + 0.375 + (rand.nextDouble() - 0.5D) * 0.2D; double d2 = (double)pos.getZ() + ParticleZ_1 + (rand.nextDouble() - 0.5D) * 0.2D; world.addParticle(Reference.REDSTONE_DUST, d0, d1, d2, 0.0D, 0.0D, 0.0D); if (!(state.get(LOCKED))) { double d3 = (double)pos.getX() + ParticleX_2 + (rand.nextDouble() - 0.5D) * 0.2D; double d4 = (double)pos.getY() + 0.375 + (rand.nextDouble() - 0.5D) * 0.2D; double d5 = (double)pos.getZ() + ParticleZ_2 + (rand.nextDouble() - 0.5D) * 0.2D; world.addParticle(Reference.REDSTONE_DUST, d3, d4, d5, 0.0D, 0.0D, 0.0D); } } } } Edit: Fixed: I forgot a "(double)" in the division at the top of the setParticlePositions method. So it gave an int, and that was "0" Now you can see it in the code here. Now it works. Edited April 5, 2020 by Drachenbauer Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.