Jump to content

TominoCZ

Members
  • Posts

    117
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Czech republic
  • Personal Text
    I am bored.

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TominoCZ's Achievements

Creeper Killer

Creeper Killer (4/8)

0

Reputation

  1. This is how I render my cube: worldRendererIn.setTranslation(f5, f6, f7); for (int vertex = 0; vertex < 24; vertex++) { worldRendererIn.pos(rotatedCubeVectors[vertex][0], rotatedCubeVectors[vertex][1], rotatedCubeVectors[vertex][2]) .tex(params[vertex][0], params[vertex][1]) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); } worldRendererIn.setTranslation(0, 0, 0); I basically draw the vanilla digging particle with my own rotation 6 times (so it's a cube). As you know, the vanilla digging particles have no shading or smooth lighting, it's just true color. so how can I add this shading to a VertexBuffer quad? Somebody told me that I can use VertexBuffer.normal(), but no matter what numbers I pass it, it makes the particles dance around (like if it was doing VertexBuffer.setTranslation()). There's also some kind of black ray flashing in the game... EDIT: Here you have an example of what I'm trying to achieve(the particle texture is darkening on the sides of the cube):
  2. http://www.reactiongifs.com/wp-content/gallery/popcorn-gifs/tumblr_ljh0puClWT1qfkt17.gif[/img] Ey, this is Ernio's job http://www.reactiongifs.com/wp-content/gallery/popcorn-gifs/tumblr_ljh0puClWT1qfkt17.gif[/img]
  3. Well that's what I'm trying to fucking do
  4. omfg f5, f6, f7 is x, y, z position of the particle And read the very first question.
  5. Alright, today I finished some little details and it works perfectly. Now we can finally begin discussing the rotation.. /** * Renders the particle */ public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { float f = ((float) this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F; float f1 = f + 0.015609375F; float f2 = ((float) this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F; float f3 = f2 + 0.015609375F; float f4 = 0.1F * this.particleScale; if (this.particleTexture != null) { f = this.particleTexture.getInterpolatedU((double) (this.particleTextureJitterX / 4.0F * 16.0F)); f1 = this.particleTexture.getInterpolatedU((double) ((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F)); f2 = this.particleTexture.getInterpolatedV((double) (this.particleTextureJitterY / 4.0F * 16.0F)); f3 = this.particleTexture.getInterpolatedV((double) ((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F)); } float f5 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX); float f6 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY); float f7 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ); int i = this.getBrightnessForRender(partialTicks); int j = i >> 16 & 65535; int k = i & 65535; if (Minecraft.isFancyGraphicsEnabled() == true) { this.particleRed = this.particleGreen = this.particleBlue * 1.4F; System.out.println("Fancy enabled, drawin cubes."); // front worldRendererIn.pos(f5, f6, f7).tex((double) f1, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5, f6 + f4, f7).tex((double) f1, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6 + f4, f7).tex((double) f, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6, f7).tex((double) f, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); // back worldRendererIn.pos(f5 + f4, f6, f7 + f4).tex((double) f, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6 + f4, f7 + f4).tex((double) f, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5, f6 + f4, f7 + f4).tex((double) f1, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5, f6, f7 + f4).tex((double) f1, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); // left worldRendererIn.pos(f5, f6, f7 + f4).tex((double) f1, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5, f6 + f4, f7 + f4).tex((double) f, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5, f6 + f4, f7).tex((double) f, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5, f6, f7).tex((double) f1, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); // right worldRendererIn.pos(f5 + f4, f6, f7).tex((double) f, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6 + f4, f7).tex((double) f1, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6 + f4, f7 + f4).tex((double) f1, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6, f7 + f4).tex((double) f, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); // top worldRendererIn.pos(f5, f6 + f4, f7).tex((double) f1, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5, f6 + f4, f7 + f4).tex((double) f1, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6 + f4, f7 + f4).tex((double) f, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6 + f4, f7).tex((double) f, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); // bottom worldRendererIn.pos(f5, f6, f7 + f4).tex((double) f, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5, f6, f7).tex((double) f, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6, f7).tex((double) f1, (double) f3) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); worldRendererIn.pos(f5 + f4, f6, f7 + f4).tex((double) f1, (double) f2) .color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k) .endVertex(); } else { worldRendererIn .pos((f5 - rotationX * f4 - rotationXY * f4), (double) (f6 - rotationZ * f4), (double) (f7 - rotationYZ * f4 - rotationXZ * f4)) .tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F) .lightmap(j, k).endVertex(); worldRendererIn .pos((double) (f5 - rotationX * f4 + rotationXY * f4), (double) (f6 + rotationZ * f4), (double) (f7 - rotationYZ * f4 + rotationXZ * f4)) .tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F) .lightmap(j, k).endVertex(); worldRendererIn .pos((double) (f5 + rotationX * f4 + rotationXY * f4), (double) (f6 + rotationZ * f4), (double) (f7 + rotationYZ * f4 + rotationXZ * f4)) .tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F) .lightmap(j, k).endVertex(); worldRendererIn .pos((double) (f5 + rotationX * f4 - rotationXY * f4), (double) (f6 - rotationZ * f4), (double) (f7 + rotationYZ * f4 - rotationXZ * f4)) .tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F) .lightmap(j, k).endVertex(); } } f4 is the particle scale..
  6. Now the last thing... The particles are spawning at the point that I gave it.... I mean it just spawns at that spot instead of spawning at the cursor when digging.. EDIT: DONE! FBPParticleEmitter.class(FBP - Fancy Block Particles): package com.TominoCZ.FBP; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Iterator; import java.util.Queue; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.ParticleDigging; import net.minecraft.client.particle.ParticleEmitter; import net.minecraft.client.particle.ParticleManager; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; public class FBPParticleEmitter extends ParticleEmitter { Field PosX; Field PosY; Field PosZ; Field SourceState; Queue<Particle> queue; IBlockState prevSourceState; public FBPParticleEmitter(Queue<Particle> q) { super(Minecraft.getMinecraft().theWorld, new EntityItem(Minecraft.getMinecraft().theWorld), EnumParticleTypes.SNOWBALL); queue = q; } @Override public void setRBGColorF(float particleRedIn, float particleGreenIn, float particleBlueIn) { } @Override public void setAlphaF(float alpha) { } @Override public void setMaxAge(int p_187114_1_) { } @Override public void onUpdate() { try { if (queue != null) { if (queue.isEmpty() == false) { ArrayList<Particle> newParticles = new ArrayList<Particle>(); Iterator<Particle> it = queue.iterator(); while (it.hasNext()) { Object c = it.next(); if (c instanceof ParticleDigging) { if (Main.isDev() == true) { PosX = c.getClass().forName("net.minecraft.client.particle.Particle").getDeclaredField("posX"); PosY = c.getClass().forName("net.minecraft.client.particle.Particle").getDeclaredField("posY"); PosZ = c.getClass().forName("net.minecraft.client.particle.Particle").getDeclaredField("posZ"); SourceState = c.getClass().getDeclaredField("sourceState"); } else { PosX = c.getClass().forName("net.minecraft.client.particle.Particle").getDeclaredField("field_187126_f"); PosY = c.getClass().forName("net.minecraft.client.particle.Particle").getDeclaredField("field_187127_g"); PosZ = c.getClass().forName("net.minecraft.client.particle.Particle").getDeclaredField("field_187128_h"); SourceState = c.getClass().getDeclaredField("field_174847_a"); } PosX.setAccessible(true); PosY.setAccessible(true); PosZ.setAccessible(true); SourceState.setAccessible(true); prevSourceState = (IBlockState)SourceState.get(c); it.remove(); newParticles.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, (double)PosX.get(c), (double)PosY.get(c), (double)PosZ.get(c), motionX, motionY, motionZ, prevSourceState)); } } queue.addAll(newParticles); } } } catch (Exception x) { System.out.println("[" + Main.name + "]: An error occured at onUpdate(int p_187114_1_):"); x.printStackTrace(); } } @Override public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { } @Override public void setParticleTexture(TextureAtlasSprite texture) { } @Override public void setParticleTextureIndex(int particleTextureIndex) { } @Override public void nextTextureIndexX() { } @Override public void setExpired() { } @Override protected void setSize(float p_187115_1_, float p_187115_2_) { } @Override public void setPosition(double p_187109_1_, double p_187109_3_, double p_187109_5_) { } @Override public void moveEntity(double x, double y, double z) { } @Override protected void resetPositionToBB() { } @Override public void setEntityBoundingBox(AxisAlignedBB p_187108_1_) { } } FBPParticleDigging.class: package com.TominoCZ.FBP; import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class FBPParticleDigging extends Particle { private final IBlockState sourceState; protected FBPParticleDigging(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); this.sourceState = state; this.setParticleTexture(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state)); this.particleGravity = state.getBlock().blockParticleGravity; this.particleRed = 0.6F; this.particleGreen = 0.6F; this.particleBlue = 0.6F; if (Minecraft.isFancyGraphicsEnabled() == true) { this.particleScale /= 1.25F; this.particleMaxAge *= 3.0F; } else { this.particleScale /= 2.0F; this.particleMaxAge = (int)(4.0F / (this.rand.nextFloat() * 0.9F + 0.1F));; } } protected void multiplyColor(@Nullable BlockPos p_187154_1_) { int i = Minecraft.getMinecraft().getBlockColors().colorMultiplier(this.sourceState, this.worldObj, p_187154_1_, 0); this.particleRed *= (float) (i >> 16 & 255) / 255.0F; this.particleGreen *= (float) (i >> 8 & 255) / 255.0F; this.particleBlue *= (float) (i & 255) / 255.0F; } public int getFXLayer() { return 1; } /** * Renders the particle */ public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { float f = ((float) this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F; float f1 = f + 0.015609375F; float f2 = ((float) this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F; float f3 = f2 + 0.015609375F; float f4 = 0.1F * this.particleScale; if (this.particleTexture != null) { f = this.particleTexture.getInterpolatedU((double) (this.particleTextureJitterX / 4.0F * 16.0F)); f1 = this.particleTexture.getInterpolatedU((double) ((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F)); f2 = this.particleTexture.getInterpolatedV((double) (this.particleTextureJitterY / 4.0F * 16.0F)); f3 = this.particleTexture.getInterpolatedV((double) ((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F)); } float f5 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX); float f6 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY); float f7 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ); int i = this.getBrightnessForRender(partialTicks); int j = i >> 16 & 65535; int k = i & 65535; if (Minecraft.isFancyGraphicsEnabled() == true) { this.particleRed = this.particleGreen = this.particleBlue * 1.4F; System.out.println("Fancy enabled, drawin cubes."); // front worldRendererIn .pos(f5, f6, f7).tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5, f6 + f4, f7).tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6 + f4, f7).tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6, f7).tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); // back worldRendererIn .pos(f5 + f4, f6, f7 + f4).tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6 + f4, f7 + f4).tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5, f6 + f4, f7 + f4).tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5, f6, f7 + f4).tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); // left worldRendererIn .pos(f5, f6, f7 + f4).tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5, f6 + f4, f7 + f4).tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5, f6 + f4, f7).tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5, f6, f7).tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); // right worldRendererIn .pos(f5 + f4, f6, f7).tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6 + f4, f7).tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6 + f4, f7 + f4).tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6, f7 + f4).tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); // top worldRendererIn .pos(f5, f6 + f4, f7).tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5, f6 + f4, f7 + f4).tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6 + f4, f7 + f4).tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6 + f4, f7).tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); // bottom worldRendererIn .pos(f5, f6, f7 + f4).tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5, f6, f7).tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6, f7).tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); worldRendererIn .pos(f5 + f4, f6, f7 + f4).tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) .lightmap(j, k).endVertex(); } else { worldRendererIn .pos((f5 - rotationX * f4 - rotationXY * f4), (double) (f6 - rotationZ * f4), (double) (f7 - rotationYZ * f4 - rotationXZ * f4)) .tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F) .lightmap(j, k).endVertex(); worldRendererIn .pos((double) (f5 - rotationX * f4 + rotationXY * f4), (double) (f6 + rotationZ * f4), (double) (f7 - rotationYZ * f4 + rotationXZ * f4)) .tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F) .lightmap(j, k).endVertex(); worldRendererIn .pos((double) (f5 + rotationX * f4 + rotationXY * f4), (double) (f6 + rotationZ * f4), (double) (f7 + rotationYZ * f4 + rotationXZ * f4)) .tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F) .lightmap(j, k).endVertex(); worldRendererIn .pos((double) (f5 + rotationX * f4 - rotationXY * f4), (double) (f6 - rotationZ * f4), (double) (f7 + rotationYZ * f4 - rotationXZ * f4)) .tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F) .lightmap(j, k).endVertex(); } } public int getBrightnessForRender(float p_189214_1_) { int i = super.getBrightnessForRender(p_189214_1_); int j = 0; if (this.worldObj.isBlockLoaded(new BlockPos(posX, posY, posZ))) { j = this.worldObj.getCombinedLight(new BlockPos(posX, posY, posZ), 0); } return i == 0 ? j : i; } }
  7. just FYI: public class FBPParticleEmitter extends ParticleEmitter { Field SourcePos; Field SourceState; Queue<Particle> queue; BlockPos prevSourcePos; IBlockState prevSourceState; public FBPParticleEmitter(Queue<Particle> q) {...
  8. Alright, got it working, i'm now spawning the 3D particles, but the only problem is, that they go only one direction.. and spawning in the block actually under the block.... because when I call this: new FBPParticleDigging(Minecraft.getMinecraft().theWorld, prevSourcePos.getX(), prevSourcePos.getY(), prevSourcePos.getZ(), 1, 1, 1, prevSourceState) The parameters 1, 1, 1 are the X, Y and Z speed of the particle... so all the particles go sideways... pretty odd.. what it does.. I'll upload a video.. here's the link: -pointless- EDIT: well that was pointless... fixed that....
  9. well you can post some code too It just looks like there's no way to get the fields there... public void onUpdate() { try { if (queue != null) // Exception being thrown at this line { if (queue.isEmpty() == false) { Iterator itr = queue.iterator(); ArrayList<Particle> newParticles = new ArrayList<Particle>(); while (itr.hasNext()) { Object c = itr.next(); if (c.toString().contains("ParticleDigging")) { Field sourcePos; Field sourceState; if (Main.isDev() == true) { sourcePos = c.getClass().getDeclaredField("sourcePos"); sourceState = c.getClass().getDeclaredField("sourceState"); } else { sourcePos = c.getClass().getDeclaredField("field_181019_az"); sourceState = c.getClass().getDeclaredField("field_174847_a"); } sourcePos.setAccessible(true); sourceState.setAccessible(true); BlockPos prevSourcePos = (BlockPos)sourcePos.get(c); IBlockState prevSourceState = (IBlockState)sourceState.get(c); itr.remove(); newParticles.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, prevSourcePos.getX(), prevSourcePos.getY(), prevSourcePos.getZ(), motionX, motionY, motionZ, prevSourceState)); } } queue.addAll(newParticles); } } } catch (Exception x) { System.out.println("[" + Main.name + "]: An error occured at onUpdate(int p_187114_1_):"); x.printStackTrace(); } }
  10. If you mean itr.next().getClass(), then no. I tried that. I tried itr.next().getClass().newInstance() aswell.
  11. I don't know how you'd read private final fields without making a new instance of the previous particle class.. show me what it should look like. public void onUpdate() { try { if (queue != null) // Exception being thrown at this line { if (queue.isEmpty() == false) { Iterator itr = queue.iterator(); ArrayList<Particle> newParticles = new ArrayList<Particle>(); while (itr.hasNext()) { if (itr.next().getClass() == ParticleDigging.class) { Class c = itr.next().getClass(); Field sourcePos; Field sourceState; if (Main.isDev() == true) { sourcePos = c.getDeclaredField("sourcePos"); sourceState = c.getDeclaredField("sourceState"); } else { sourcePos = c.getDeclaredField("field_181019_az"); sourceState = c.getDeclaredField("field_174847_a"); } sourcePos.setAccessible(true); sourceState.setAccessible(true); BlockPos prevSourcePos = (BlockPos)sourcePos.get(/*HERE YOU WOULD HAVE TO DO SOMETHING LIKE THIS: new PreviousParticle()*/); IBlockState prevSourceState = (IBlockState)sourceState.get(/*SAME STUFF HERE*/); itr.remove(); newParticles.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, prevSourcePos.getX(), prevSourcePos.getY(), prevSourcePos.getZ(), motionX, motionY, motionZ, prevSourceState)); } } queue.addAll(newParticles); /* ParticleManager particleManager = new ParticleManager(Minecraft.getMinecraft().theWorld, null); Class<?> c = particleManager.getClass(); Field field; if (Main.isDev() == true) field = c.getDeclaredField("queueEntityFX"); else field = c.getDeclaredField("field_187241_h"); field.setAccessible(true); Queue<Particle> q = (Queue<Particle>) field.get(particleManager); q = queue; */ } } } catch (Exception x) { System.out.println("[" + Main.name + "]: An error occured at onUpdate(int p_187114_1_):"); x.printStackTrace(); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.