Jump to content

[1.10]Spawn a rotated cube particle


TominoCZ

Recommended Posts

Now it crashes in the cust particle class... It must be because of the parameters I passed it when I created a new instance of it..

 

this is the piece of code where I replace the particle:

queue.forEach(particle -> {
		queue.remove(particle);
		queue.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, interpPosX, interpPosY, interpPosZ, motionX, motionY, motionZ, bs));
	});

 

I'm not sure why it's crashing, but it looks like it it because of the world instance.. or the BlockState..

Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

Looks like it's because of the world instance. It says it's null. I hope I'm right..

 

[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: java.util.ConcurrentModificationException
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at java.util.ArrayDeque$DeqIterator.next(Unknown Source)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at java.lang.Iterable.forEach(Unknown Source)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at com.TominoCZ.FBP.FBPParticleEmitter.onUpdate(FBPParticleEmitter.java:51)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at net.minecraft.client.particle.ParticleManager.updateEffects(ParticleManager.java:171)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1939)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at net.minecraft.client.Minecraft.run(Minecraft.java:406)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at net.minecraft.client.main.Main.main(Main.java:118)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at java.lang.reflect.Method.invoke(Unknown Source)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at java.lang.reflect.Method.invoke(Unknown Source)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
[15:49:02] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:61]: 	at GradleStart.main(GradleStart.java:26)
[15:49:04] [Client thread/FATAL]: Reported exception thrown!
net.minecraft.util.ReportedException: Rendering Particle
at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:335) ~[ParticleManager.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1408) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1282) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.world.World.isBlockLoaded(World.java:276) ~[World.class:?]
at net.minecraft.world.World.isBlockLoaded(World.java:271) ~[World.class:?]
at com.TominoCZ.FBP.FBPParticleDigging.getBrightnessForRender(FBPParticleDigging.java:269) ~[FBPParticleDigging.class:?]
at com.TominoCZ.FBP.FBPParticleDigging.renderParticle(FBPParticleDigging.java:103) ~[FBPParticleDigging.class:?]
at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:315) ~[ParticleManager.class:?]
... 18 more
[15:49:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ----
// But it works on my machine.

Time: 14.8.16 15:49
Description: Rendering Particle

java.lang.NullPointerException: Rendering Particle
at net.minecraft.world.World.isBlockLoaded(World.java:276)
at net.minecraft.world.World.isBlockLoaded(World.java:271)
at com.TominoCZ.FBP.FBPParticleDigging.getBrightnessForRender(FBPParticleDigging.java:269)
at com.TominoCZ.FBP.FBPParticleDigging.renderParticle(FBPParticleDigging.java:103)
at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:315)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1408)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1282)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139)
at net.minecraft.client.Minecraft.run(Minecraft.java:406)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.world.World.isBlockLoaded(World.java:276)
at net.minecraft.world.World.isBlockLoaded(World.java:271)
at com.TominoCZ.FBP.FBPParticleDigging.getBrightnessForRender(FBPParticleDigging.java:269)
at com.TominoCZ.FBP.FBPParticleDigging.renderParticle(FBPParticleDigging.java:103)

-- Particle being rendered --
Details:
Particle: FBPParticleDigging, Pos (-34.72392189856991,96.0,-44.43349553459455), RGBA (0.6,0.6,0.6,1.0), Age 0
Particle Type: TERRAIN_TEXTURE
Stacktrace:
at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:315)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1408)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1282)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Player203'/105, l='MpServer', x=-34,72, y=96,00, z=-44,43]]
Chunk stats: MultiplayerChunkCache: 121, 121
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (-27,64,-64), Chunk: (at 5,4,0 in -2,-4; contains blocks -32,0,-64 to -17,255,-49), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Level time: 26736 game time, 26736 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 30 total; [EntityZombie['Zombie'/64, l='MpServer', x=2,50, y=19,00, z=-102,50], EntitySkeleton['Skeleton'/65, l='MpServer', x=15,78, y=19,00, z=-108,18], EntityCreeper['Creeper'/66, l='MpServer', x=12,30, y=19,00, z=-93,17], EntityZombie['Zombie'/67, l='MpServer', x=14,50, y=19,00, z=-92,50], EntityBat['Bat'/68, l='MpServer', x=5,56, y=38,31, z=16,03], EntityZombie['Zombie'/85, l='MpServer', x=22,86, y=16,00, z=-100,50], EntityCreeper['Creeper'/22, l='MpServer', x=-93,50, y=47,00, z=-76,86], EntityCreeper['Creeper'/86, l='MpServer', x=19,10, y=75,00, z=-82,78], EntityItem['item.item.arrow'/23, l='MpServer', x=-92,27, y=86,00, z=-73,61], EntityCreeper['Creeper'/87, l='MpServer', x=18,12, y=75,00, z=-81,68], EntityZombie['Zombie'/88, l='MpServer', x=28,50, y=47,00, z=-41,50], EntityItem['item.item.bone'/24, l='MpServer', x=-92,54, y=86,00, z=-73,63], EntitySkeleton['Skeleton'/30, l='MpServer', x=-56,71, y=94,00, z=-56,51], EntitySkeleton['Skeleton'/31, l='MpServer', x=-36,44, y=94,00, z=-67,72], EntitySpider['Spider'/32, l='MpServer', x=-34,46, y=94,00, z=-64,98], EntityCreeper['Creeper'/33, l='MpServer', x=-39,83, y=95,00, z=-62,36], EntityItem['item.item.bone'/34, l='MpServer', x=-42,89, y=96,00, z=-45,92], EntitySkeleton['Skeleton'/35, l='MpServer', x=-34,12, y=64,00, z=15,51], EntityPlayerSP['Player203'/105, l='MpServer', x=-34,72, y=96,00, z=-44,43], EntityCreeper['Creeper'/42, l='MpServer', x=-29,50, y=61,00, z=-97,50], EntityZombie['Zombie'/43, l='MpServer', x=-24,50, y=53,00, z=-87,50], EntityBat['Bat'/44, l='MpServer', x=-24,25, y=42,03, z=-52,40], EntityCreeper['Creeper'/45, l='MpServer', x=-27,45, y=95,00, z=-43,10], EntityBat['Bat'/52, l='MpServer', x=-20,84, y=38,35, z=-53,74], EntityZombie['Zombie'/53, l='MpServer', x=-14,00, y=23,00, z=-35,48], EntityCreeper['Creeper'/54, l='MpServer', x=-14,45, y=23,00, z=-37,87], EntityZombie['Zombie'/55, l='MpServer', x=-14,54, y=23,00, z=-33,95], EntityCreeper['Creeper'/56, l='MpServer', x=-8,88, y=23,00, z=-30,61], EntityCreeper['Creeper'/57, l='MpServer', x=-1,50, y=41,00, z=5,40], EntityCreeper['Creeper'/63, l='MpServer', x=5,07, y=19,00, z=-107,57]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:450)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2779)
at net.minecraft.client.Minecraft.run(Minecraft.java:427)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
Minecraft Version: 1.10
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_101, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 684431224 bytes (652 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP 9.32 Powered by Forge 12.18.0.2000 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10-12.18.0.2000-1.10.0.jar) 
UCHIJAAAA	Forge{12.18.0.2000} [Minecraft Forge] (forgeSrc-1.10-12.18.0.2000-1.10.0.jar) 
UCHIJAAAA	FBP{1.2} [Fancy Block Particles] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13447 Compatibility Profile Context 16.300.2311.0' Renderer: 'AMD Radeon R9 200 Series'
Launched Version: 1.10
LWJGL: 2.9.4
OpenGL: AMD Radeon R9 200 Series GL version 4.5.13447 Compatibility Profile Context 16.300.2311.0, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: 
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 4x Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
[15:49:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\*****\Downloads\forge-1.10-12.18.0.2000-1.10.0-mdk\run\.\crash-reports\crash-2016-08-14_15.49.04-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

Link to comment
Share on other sites

now.. it crashes when the method onUpdate is called(because I check if the queue is not empty)...

 

@Override
public void onUpdate() {
	try {
		if (queue.isEmpty() == false) { //Exception being thrown at this line
			IBlockState bs = Block.getStateById(0);

			queue.forEach(particle -> {
				if (particle.getClass() == ParticleDigging.class) {
					queue.remove(particle);
					queue.add(new FBPParticleDigging(worldObj, interpPosX, interpPosY,
							interpPosZ, motionX, motionY, motionZ, bs));
				}
			});

			ParticleManager particleManager = new ParticleManager(Minecraft.getMinecraft().theWorld, null);

			Class<?> c = particleManager.getClass();

			Field f;

			if (Main.isDev() == true)
				f = c.getDeclaredField("queueEntityFX");
			else
				f = c.getDeclaredField("field_187241_h");

			f.setAccessible(true);

			f.set(particleManager, queue);
		}
	} catch (Exception x) {
		System.out.println("[" + Main.name + "]: An error occured at onUpdate(int p_187114_1_):");
		x.printStackTrace();
	}
}

 

 

log:

[15:54:42] [Client thread/INFO] [sTDOUT]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:43]: [Fancy Block Particles]: An error occured at onEvent(EntityJoinWorldEvent e):
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: java.lang.NullPointerException
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at com.TominoCZ.FBP.FBPParticleEmitter.onUpdate(FBPParticleEmitter.java:44)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.client.particle.ParticleEmitter.<init>(ParticleEmitter.java:24)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at com.TominoCZ.FBP.FBPParticleEmitter.<init>(FBPParticleEmitter.java:25)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at com.TominoCZ.FBP.handler.ForgeEventHandler.onEvent(ForgeEventHandler.java:41)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_ForgeEventHandler_onEvent_EntityJoinWorldEvent.invoke(.dynamic)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:68)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:159)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.world.World.spawnEntityInWorld(World.java:1217)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.client.multiplayer.WorldClient.spawnEntityInWorld(WorldClient.java:210)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.client.Minecraft.loadWorld(Minecraft.java:2557)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.client.Minecraft.loadWorld(Minecraft.java:2462)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.client.network.NetHandlerPlayClient.handleJoinGame(NetHandlerPlayClient.java:301)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.network.play.server.SPacketJoinGame.processPacket(SPacketJoinGame.java:89)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.network.play.server.SPacketJoinGame.processPacket(SPacketJoinGame.java:13)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at java.util.concurrent.FutureTask.run(Unknown Source)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.util.Util.runTask(Util.java:25)
[15:54:42] [server thread/INFO]: Saving and pausing game...
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1108)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.client.Minecraft.run(Minecraft.java:406)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.client.main.Main.main(Main.java:118)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at java.lang.reflect.Method.invoke(Unknown Source)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at java.lang.reflect.Method.invoke(Unknown Source)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
[15:54:42] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.handler.ForgeEventHandler:onEvent:44]: 	at GradleStart.main(GradleStart.java:26)

Link to comment
Share on other sites

Sure. I was about to say this(below), when you answered..

 

Wait... If you think about it... you can't get the particles when you join the world, because there aren't any and also it scans for them once, once you've joined the world... so the Queue<Particle> is empty.. that means we'd have to somehow use TickHandler...

 

*Testing with using a classic for()*

 

EDIT: Well shit that doesn't work either.

Link to comment
Share on other sites

no matter if it's in a loop or not, it says te exact same:

 

[18:15:38] [Client thread/FATAL]: Reported exception thrown!

net.minecraft.util.ReportedException: Rendering Particle

at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:335) ~[ParticleManager.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1408) ~[EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1282) ~[EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091) ~[EntityRenderer.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.lang.NullPointerException

at net.minecraft.world.World.isBlockLoaded(World.java:276) ~[World.class:?]

at net.minecraft.world.World.isBlockLoaded(World.java:271) ~[World.class:?]

at com.TominoCZ.FBP.FBPParticleDigging.getBrightnessForRender(FBPParticleDigging.java:269) ~[FBPParticleDigging.class:?]

at com.TominoCZ.FBP.FBPParticleDigging.renderParticle(FBPParticleDigging.java:103) ~[FBPParticleDigging.class:?]

at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:315) ~[ParticleManager.class:?]

... 18 more

Link to comment
Share on other sites

The emitter class:

public class FBPParticleEmitter extends ParticleEmitter {
Queue<Particle> queue;

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) // Exception being thrown at this line
		{
			if (queue.isEmpty() == false) {
				IBlockState bs = Block.getStateById(1);

				Iterator itr = queue.iterator();

				ArrayList<Particle> newParticles = new ArrayList<Particle>();

				while (itr.hasNext()) 
				{
					if (itr.next().getClass() == ParticleDigging.class) 
					{
						itr.remove();
						newParticles.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, interpPosX, interpPosY, interpPosZ, motionX, motionY, motionZ, bs));
					}
				}

				queue.addAll(newParticles); //here it all fucks up

				/*
				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();
	}
}

@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_) {
}
}

 

The custom particle class:

@SideOnly(Side.CLIENT)
public class FBPParticleDigging extends Particle
{
    private final IBlockState sourceState;
    private BlockPos sourcePos;

    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;
        this.particleScale /= 2.0F;
    }

    /**
     * Sets the position of the block that this particle came from. Used for calculating texture and color multiplier.
     */
    public FBPParticleDigging setBlockPos(BlockPos pos)
    {
        this.sourcePos = pos;

        if (this.sourceState.getBlock() == Blocks.GRASS)
        {
            return this;
        }
        else
        {
            this.multiplyColor(pos);
            return this;
        }
    }

    public FBPParticleDigging init()
    {
        this.sourcePos = new BlockPos(this.posX, this.posY, this.posZ);
        Block block = this.sourceState.getBlock();

        if (block == Blocks.GRASS)
        {
            return this;
        }
        else
        {
            this.multiplyColor((BlockPos)null);
            return this;
        }
    }

    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;
        worldRendererIn.pos((double)(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();
        //Here on this line was the fourth vertex
    }

    public int getBrightnessForRender(float p_189214_1_)
    {
        int i = super.getBrightnessForRender(p_189214_1_);
        int j = 0;

        if (this.worldObj.isBlockLoaded(this.sourcePos))
        {
            j = this.worldObj.getCombinedLight(this.sourcePos, 0);
        }

        return i == 0 ? j : i;
    }

    @SideOnly(Side.CLIENT)
    public static class Factory implements IParticleFactory
        {
            public Particle getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
            {
                return (new FBPParticleDigging(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Block.getStateById(p_178902_15_[0]))).init();
            }
        }
}

Link to comment
Share on other sites

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();
	}
}

Link to comment
Share on other sites

No, you got the instance from the Iterator, you used it like 10 lines above.....

 

If you mean itr.next().getClass(), then no. I tried that.

I believe he wants you to create a field of itr.next() and use that instead of calling itr.next()

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

For fuck's sake.

Object o = it.next();

Stop calling

.getClass()

on everything.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

For fuck's sake.

Object o = it.next();

Stop calling

.getClass()

on everything.

 

[00:08:10] [Client thread/INFO] [sTDOUT]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:106]: [Fancy Block Particles]: An error occured at onUpdate(int p_187114_1_):

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: java.util.NoSuchElementException

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at java.util.ArrayDeque$DeqIterator.next(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at com.TominoCZ.FBP.FBPParticleEmitter.onUpdate(FBPParticleEmitter.java:57)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.particle.ParticleManager.updateEffects(ParticleManager.java:171)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.Minecraft.runTick(Minecraft.java:1939)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.Minecraft.run(Minecraft.java:406)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.main.Main.main(Main.java:118)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at java.lang.reflect.Method.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at java.lang.reflect.Method.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at GradleStart.main(GradleStart.java:26)

Link to comment
Share on other sites

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();
	}
}

Link to comment
Share on other sites

Also, don't use Object. I put "

Object

" because I don't know the correct type (nor do I care).  You're supposed to change it to match what you're doing.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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....

Link to comment
Share on other sites

How often do I need to say this for you to listen to me?

You are still accessing prevSourcePos, etc. from
this

, which is completely meaningless here. You need to get them from the particle you remove from the queue.

 

just FYI:

public class FBPParticleEmitter extends ParticleEmitter 
{
Field SourcePos;
Field SourceState;

Queue<Particle> queue;

BlockPos prevSourcePos;
IBlockState prevSourceState;

public FBPParticleEmitter(Queue<Particle> q) {...

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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