Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So I've been looking around for tutorials on custom particles and I can't find any up-to-date tutorials or anything on the forge doc. So far from what I can tell, spawning custom particles is different from vanilla since the spawnParticle method relies on the actual EnumParticleTypeClass. 

 

Basically, what I want to do is, when I place down a block, that block starts to slowly emit a purple particle effect. I already have the particle class, I just don't know how to get the block's position (which I think is impossible) or how to set the particles to start spawning from the block

 

ParticleManu.java:

Spoiler

package com.ninja3659.explorationexpansion.client.particle;

import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleBubble;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

public class ParticleManu extends ParticleBubble{

	
	public ParticleManu(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn,
			double ySpeedIn, double zSpeedIn) {
		super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
        this.setParticleTextureIndex(32);
        this.setRBGColorF(0x8A, 0x2B, 0xE2);
	}	
	

}

 

 

Edited by GooberGunter

8 minutes ago, GooberGunter said:

Basically, what I want to do is, when I place down a block, that block starts to slowly emit a purple particle effect. I already have the particle class, I just don't know how to get the block's position (which I think is impossible) or how to set the particles to start spawning from the block

See how BlockFurnace does this.

Custom particles are a thing that is not easily done afaik. You either need to add an enum constant to the EnumParticleType using EnumHelper and register your particle factory for the particleID you specify in your enum constant or you need to build your own particle system from the ground.

  • Author

So I looked at the furnace class and adapted the idea to Jabelar's tutorial on particles. All I need to figure out now is how to use my own texture

  • Author

From the looks of it, the textureAtlasSprite class, which is what loads the texture for particles, has a built in forge method that allows for custom textures. if I'm looking at this right, it's promising.

Spoiler

TextureAtlasSprite.class



    /*===================================== FORGE START =====================================*/
    /**
     * The result of this function determines is the below 'load' function is called, and the
     * default vanilla loading code is bypassed completely.
     * @param manager Main resource manager
     * @param location File resource location
     * @return True to use your own custom load code and bypass vanilla loading.
     */
    public boolean hasCustomLoader(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location)
    {
        return false;
    }

    /**
     * Load the specified resource as this sprite's data.
     * Returning false from this function will prevent this icon from being stitched onto the master texture.
     * @param manager Main resource manager
     * @param location File resource location
     * @param textureGetter accessor for dependencies. All of them will be loaded before this one
     * @return False to prevent this Icon from being stitched
     */
    public boolean load(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location, java.util.function.Function<ResourceLocation, TextureAtlasSprite> textureGetter)
    {
        return true;
    }

    /**
     * @return all textures that should be loaded before this texture.
     */
    public java.util.Collection<ResourceLocation> getDependencies() {
        return com.google.common.collect.ImmutableList.of();
    }

    /*===================================== FORGE END ======================================*/
}

 

EDIT: It looks like I need a resource manager AND resource location. Sadly, I don't know how to do resource managers

Edited by GooberGunter

  • Author

I've gotten as far as the resource manager, but I don't know how to set up the resource manager.

Spoiler

public ParticleManu(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn,
			double ySpeedIn, double zSpeedIn) {
		super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
        this.setParticleTextureIndex(32);
        this.particleRed = 1;
        this.particleBlue = 1;
        this.particleGreen = 0;
        this.particleMaxAge = 100000;
		this.particleTexture.hasCustomLoader(manager, particleTex);//figure out the Resource Manager
	}	

 

 

3 minutes ago, GooberGunter said:

I've gotten as far as the resource manager, but I don't know how to set up the resource manager.

I'm not sure if you need to create your own IResourceManager for this(I don't really think you do, but I may be mistaken), but you can get a IResourceManager instance like so.

Minecraft.getMinecraft().getResourceManager();

 

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.

  • Author

I tried that and it gave me the following null exception:

Spoiler

[13:16:59] [main/FATAL]: Unreported exception thrown!
java.lang.NullPointerException: null
    at com.ninja3659.explorationexpansion.client.particle.ParticleManu.<init>(ParticleManu.java:27) ~[ParticleManu.class:?]
    at com.ninja3659.explorationexpansion.proxy.ClientProxy.generateManuPart(ClientProxy.java:88) ~[ClientProxy.class:?]
    at com.ninja3659.explorationexpansion.blocks.BlockManuCogBlockH.randomDisplayTick(BlockManuCogBlockH.java:38) ~[BlockManuCogBlockH.class:?]
    at net.minecraft.client.multiplayer.WorldClient.showBarrierParticles(WorldClient.java:386) ~[WorldClient.class:?]
    at net.minecraft.client.multiplayer.WorldClient.doVoidFogParticles(WorldClient.java:374) ~[WorldClient.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2002) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1171) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
    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_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:26) [start/:?]
[13:16:59] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:630]: ---- Minecraft Crash Report ----
// On the bright side, I bought you a teddy bear!

Time: 7/21/17 1:16 PM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at com.ninja3659.explorationexpansion.client.particle.ParticleManu.<init>(ParticleManu.java:27)
    at com.ninja3659.explorationexpansion.proxy.ClientProxy.generateManuPart(ClientProxy.java:88)
    at com.ninja3659.explorationexpansion.blocks.BlockManuCogBlockH.randomDisplayTick(BlockManuCogBlockH.java:38)
    at net.minecraft.client.multiplayer.WorldClient.showBarrierParticles(WorldClient.java:386)
    at net.minecraft.client.multiplayer.WorldClient.doVoidFogParticles(WorldClient.java:374)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2002)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1171)
    at net.minecraft.client.Minecraft.run(Minecraft.java:436)
    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 com.ninja3659.explorationexpansion.client.particle.ParticleManu.<init>(ParticleManu.java:27)
    at com.ninja3659.explorationexpansion.proxy.ClientProxy.generateManuPart(ClientProxy.java:88)
    at com.ninja3659.explorationexpansion.blocks.BlockManuCogBlockH.randomDisplayTick(BlockManuCogBlockH.java:38)
    at net.minecraft.client.multiplayer.WorldClient.showBarrierParticles(WorldClient.java:386)
    at net.minecraft.client.multiplayer.WorldClient.doVoidFogParticles(WorldClient.java:374)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['Player593'/79, l='MpServer', x=1515.43, y=64.00, z=1510.11]]
    Chunk stats: MultiplayerChunkCache: 656, 656
    Level seed: 0
    Level generator: ID 01 - flat, ver 0. Features enabled: false
    Level generator options: 
    Level spawn location: World: (1480,4,1316), Chunk: (at 8,0,4 in 92,82; contains blocks 1472,0,1312 to 1487,255,1327), Region: (2,2; contains chunks 64,64 to 95,95, blocks 1024,0,1024 to 1535,255,1535)
    Level time: 9746 game time, 9746 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: 79 total; [EntityPlayerSP['Player593'/79, l='MpServer', x=1515.43, y=64.00, z=1510.11], EntityItem['item.item.seeds'/138, l='MpServer', x=1512.98, y=64.00, z=1556.99], EntityCreeper['Creeper'/139, l='MpServer', x=1548.50, y=25.00, z=1525.18], EntityBat['Bat'/140, l='MpServer', x=1535.90, y=31.10, z=1536.37], EntityCreeper['Creeper'/150, l='MpServer', x=1472.50, y=64.00, z=1507.50], EntityCreeper['Creeper'/27, l='MpServer', x=1467.70, y=64.00, z=1495.70], EntitySkeleton['Skeleton'/28, l='MpServer', x=1460.72, y=64.00, z=1495.50], EntitySkeleton['Skeleton'/29, l='MpServer', x=1463.96, y=64.00, z=1490.96], EntityZombie['Zombie'/30, l='MpServer', x=1461.30, y=64.00, z=1510.70], EntityBat['Bat'/33, l='MpServer', x=1480.47, y=54.51, z=1441.43], EntityBat['Bat'/34, l='MpServer', x=1480.55, y=54.90, z=1442.80], EntityZombie['Zombie'/35, l='MpServer', x=1475.70, y=64.00, z=1488.30], EntityBat['Bat'/41, l='MpServer', x=1503.57, y=49.10, z=1487.29], EntityBat['Bat'/42, l='MpServer', x=1503.39, y=49.05, z=1489.31], EntityCreeper['Creeper'/43, l='MpServer', x=1497.50, y=64.00, z=1503.50], EntityCreeper['Creeper'/44, l='MpServer', x=1495.50, y=64.00, z=1504.50], EntitySpider['Spider'/174, l='MpServer', x=1570.70, y=31.00, z=1557.21], EntityItem['item.item.string'/175, l='MpServer', x=1572.88, y=31.00, z=1566.57], EntityBat['Bat'/48, l='MpServer', x=1508.95, y=47.13, z=1483.89], EntitySpider['Spider'/176, l='MpServer', x=1573.50, y=31.00, z=1560.50], EntityZombie['Zombie'/49, l='MpServer', x=1507.44, y=48.00, z=1489.72], EntitySpider['Spider'/177, l='MpServer', x=1571.50, y=31.00, z=1562.50], EntityMinecartChest['Minecart with Chest'/50, l='MpServer', x=1559.50, y=29.06, z=1515.50], EntitySkeleton['Skeleton'/178, l='MpServer', x=1572.50, y=31.00, z=1563.50], EntityCreeper['Creeper'/51, l='MpServer', x=1561.50, y=26.00, z=1516.50], EntitySkeleton['Skeleton'/179, l='MpServer', x=1573.50, y=31.00, z=1563.50], EntitySkeleton['Skeleton'/52, l='MpServer', x=1569.50, y=28.00, z=1496.50], EntitySkeleton['Skeleton'/180, l='MpServer', x=1576.50, y=31.00, z=1556.50], EntityCreeper['Creeper'/53, l='MpServer', x=1568.50, y=26.00, z=1516.50], EntityCreeper['Creeper'/181, l='MpServer', x=1577.50, y=31.00, z=1557.50], EntityCreeper['Creeper'/54, l='MpServer', x=1583.77, y=30.00, z=1506.48], EntityCreeper['Creeper'/182, l='MpServer', x=1573.80, y=31.00, z=1562.43], EntitySkeleton['Skeleton'/183, l='MpServer', x=1575.50, y=31.00, z=1563.50], EntitySkeleton['Skeleton'/184, l='MpServer', x=1575.50, y=32.00, z=1566.50], EntitySquid['Squid'/185, l='MpServer', x=1572.14, y=62.18, z=1566.76], EntityMinecartChest['Minecart with Chest'/186, l='MpServer', x=1560.50, y=32.06, z=1581.50], EntityBat['Bat'/187, l='MpServer', x=1566.75, y=33.10, z=1579.25], EntityCreeper['Creeper'/188, l='MpServer', x=1587.50, y=30.00, z=1536.50], EntityZombie['Zombie'/193, l='MpServer', x=1591.50, y=34.00, z=1550.50], EntityZombie['Zombie'/195, l='MpServer', x=1593.50, y=34.00, z=1549.50], EntitySkeleton['Skeleton'/197, l='MpServer', x=1593.50, y=33.00, z=1529.50], EntityBat['Bat'/201, l='MpServer', x=1588.25, y=35.10, z=1558.88], EntityBat['Bat'/202, l='MpServer', x=1589.02, y=34.00, z=1553.27], EntityMinecartChest['Minecart with Chest'/203, l='MpServer', x=1569.51, y=33.06, z=1580.50], EntitySpider['Spider'/204, l='MpServer', x=1578.32, y=34.50, z=1579.70], EntityMinecartChest['Minecart with Chest'/211, l='MpServer', x=1559.50, y=29.06, z=1520.50], EntityMinecartChest['Minecart with Chest'/212, l='MpServer', x=1554.50, y=29.06, z=1525.50], EntityBat['Bat'/213, l='MpServer', x=1557.13, y=25.10, z=1529.41], EntitySkeleton['Skeleton'/214, l='MpServer', x=1563.53, y=24.00, z=1531.28], EntityCreeper['Creeper'/215, l='MpServer', x=1565.50, y=30.00, z=1529.50], EntityZombie['Zombie'/216, l='MpServer', x=1563.50, y=30.00, z=1527.50], EntityCreeper['Creeper'/217, l='MpServer', x=1561.50, y=24.00, z=1530.50], EntityMinecartChest['Minecart with Chest'/218, l='MpServer', x=1579.50, y=31.06, z=1547.50], EntityBat['Bat'/219, l='MpServer', x=1575.75, y=31.10, z=1538.93], EntitySkeleton['Skeleton'/220, l='MpServer', x=1573.47, y=30.00, z=1537.91], EntitySkeleton['Skeleton'/221, l='MpServer', x=1572.50, y=30.00, z=1536.50], EntitySkeleton['Skeleton'/222, l='MpServer', x=1574.50, y=30.00, z=1541.24], EntityCreeper['Creeper'/223, l='MpServer', x=1560.81, y=35.00, z=1559.51], EntityMinecartChest['Minecart with Chest'/224, l='MpServer', x=1577.50, y=30.06, z=1525.50], EntityZombie['Zombie'/225, l='MpServer', x=1573.30, y=30.00, z=1530.95], EntitySkeleton['Skeleton'/226, l='MpServer', x=1582.30, y=30.00, z=1534.70], EntityZombie['Zombie'/227, l='MpServer', x=1582.89, y=30.00, z=1534.70], EntitySheep['Sheep'/100, l='MpServer', x=1464.22, y=64.00, z=1583.76], EntityZombie['Zombie'/228, l='MpServer', x=1573.50, y=30.00, z=1524.50], EntityZombie['Zombie'/229, l='MpServer', x=1573.50, y=30.00, z=1524.50], EntityZombie['Zombie'/230, l='MpServer', x=1569.43, y=30.00, z=1528.98], EntitySkeleton['Skeleton'/231, l='MpServer', x=1575.50, y=30.00, z=1524.50], EntityZombie['Zombie'/232, l='MpServer', x=1576.65, y=33.00, z=1527.21], EntitySkeleton['Skeleton'/233, l='MpServer', x=1577.48, y=33.00, z=1525.69], EntityBat['Bat'/236, l='MpServer', x=1591.15, y=35.07, z=1570.29], EntitySkeleton['Skeleton'/237, l='MpServer', x=1591.50, y=34.00, z=1582.50], EntitySkeleton['Skeleton'/238, l='MpServer', x=1580.95, y=33.00, z=1589.39], EntitySpider['Spider'/240, l='MpServer', x=1570.50, y=34.00, z=1588.50], EntitySkeleton['Skeleton'/241, l='MpServer', x=1578.50, y=33.00, z=1585.50], EntityZombie['Zombie'/245, l='MpServer', x=1595.30, y=32.00, z=1586.30], EntitySkeleton['Skeleton'/247, l='MpServer', x=1593.50, y=34.00, z=1584.50], EntityCreeper['Creeper'/248, l='MpServer', x=1589.50, y=33.00, z=1588.50], EntityCreeper['Creeper'/249, l='MpServer', x=1590.30, y=34.00, z=1586.30], EntitySkeleton['Skeleton'/250, l='MpServer', x=1592.70, y=34.00, z=1586.70]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:456)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2868)
    at net.minecraft.client.Minecraft.run(Minecraft.java:465)
    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.12
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_131, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 581193416 bytes (554 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.40 Powered by Forge 14.21.1.2415 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCHIJAAAA    minecraft{1.12} [Minecraft] (minecraft.jar) 
    UCHIJAAAA    mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
    UCHIJAAAA    FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.12-14.21.1.2415.jar) 
    UCHIJAAAA    forge{14.21.1.2415} [Minecraft Forge] (forgeSrc-1.12-14.21.1.2415.jar) 
    UCHIJAAAA    neem{1.0-alpha} [Exploration Expansion] (bin) 
    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'Intel' Version: '4.4.0 - Build 21.20.16.4550' Renderer: 'Intel(R) HD Graphics 520'
    Launched Version: 1.12
    LWJGL: 2.9.4
    OpenGL: Intel(R) HD Graphics 520 GL version 4.4.0 - Build 21.20.16.4550, Intel
    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) i7-6500U CPU @ 2.50GHz
[13:16:59] [Server thread/INFO] [FML]: Applying holder lookups
[13:16:59] [Server thread/INFO] [FML]: Holder lookups applied
[13:16:59] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:630]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\JEHan\Desktop\Exploration Expanded\run\.\crash-reports\crash-2017-07-21_13.16.59-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
 

 

3 minutes ago, GooberGunter said:

I tried that and it gave me the following null exception:

Where are you initializing ParticleManu?

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.

  • Author

In the client proxy class:

Spoiler

package com.ninja3659.explorationexpansion.proxy;

import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.lwjgl.opengl.GL11;

import com.ninja3659.explorationexpansion.Reference;
import com.ninja3659.explorationexpansion.blocks.BlockManuCogBlockH;
import com.ninja3659.explorationexpansion.init.ModBlocks;
import com.ninja3659.explorationexpansion.init.ModEntities;
import com.ninja3659.explorationexpansion.init.ModItems;
import com.ninja3659.explorationexpansion.init.ModTools;
import com.ninja3659.explorationexpansion.client.entities.EntityBeelzebook;
import com.ninja3659.explorationexpansion.client.entities.EntityChimera;
import com.ninja3659.explorationexpansion.client.entities.EntityMindFlayer;
import com.ninja3659.explorationexpansion.client.model.ModelChimera;
import com.ninja3659.explorationexpansion.client.particle.ParticleManu;
import com.ninja3659.explorationexpansion.client.renders.RenderBeelzebook;
import com.ninja3659.explorationexpansion.client.renders.RenderChimera;
import com.ninja3659.explorationexpansion.client.renders.RenderFlayer;
import com.ninja3659.explorationexpansion.util.Utils;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelCow;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.chunk.IRenderChunkFactory;
import net.minecraft.client.renderer.chunk.RenderChunk;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderFallingBlock;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import scala.collection.parallel.ParIterableLike.Min;

public class ClientProxy extends CommonProxy {
	
	@Override
	public void registerRenders() {
		RenderingRegistry.registerEntityRenderingHandler(EntityChimera.class, new IRenderFactory<EntityChimera>() {

			@Override
			public Render<? super EntityChimera> createRenderFor(RenderManager manager) {
				return new RenderChimera(manager);
			}
		
		});
		RenderingRegistry.registerEntityRenderingHandler(EntityMindFlayer.class, new IRenderFactory<EntityMindFlayer>() {
			
			@Override
			public Render<? super EntityMindFlayer> createRenderFor(RenderManager manager) {
				return new RenderFlayer(manager);
			}
		});
		RenderingRegistry.registerEntityRenderingHandler(EntityBeelzebook.class, new IRenderFactory<EntityBeelzebook>() {

			@Override
			public Render<? super EntityBeelzebook> createRenderFor(RenderManager manager) {
				// TODO Auto-generated method stub
				return new RenderBeelzebook(manager);
			}
			
		});
		Utils.getLogger().info("Rendered Chimera");
	}

	@Override
	public void registerModelBakeryGoods() {
		//meta data thing
		ModelBakery.registerItemVariants(ModItems.diamondilium, new ResourceLocation(Reference.MOD_ID, "diamondilium_normal"), new ResourceLocation(Reference.MOD_ID, "diamondilium_corrupted"));
	}
	
	@Override
	public void generateManuPart(Block block, BlockPos pos) {
		World world = Minecraft.getMinecraft().world;
		ParticleManu part = new ParticleManu(world, pos.getX() + world.rand.nextFloat(), pos.getY()+1, pos.getZ() + world.rand.nextFloat(), world.rand.nextFloat() * .4f, .7F, world.rand.nextFloat() * .4f);
		
		Minecraft.getMinecraft().effectRenderer.addEffect(part);
		
	}
}

 

At the bottom

  • Author

In the BlockManuCogBlockH class

Spoiler


	@Override
	@SideOnly(Side.CLIENT)
	public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
		ExplorationExpansion.proxy.generateManuPart(this, pos);
	}

 

 

11 minutes ago, GooberGunter said:

In the BlockManuCogBlockH class

Then I believe that your particleTexture field is null when you access it in your constructor.

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.

  • Author

So it can't find the resource location? Or do I need to set the particleTexture first? If so how?

 

Edited by GooberGunter

TextureAtlasSprite has nothing to do with particles. It is simply a 'pointer' to a location of a specific image on a texture sheet(or if we disassemble the name - it is a sprite of a texture atlas(aka map)). Forge just allows custom loading of your sprites with those methods. By default there is only 1 texture map in the game - the blocks+items textures map.

Particles have that field avaliable mostly for block/item crack/break particles, as they need to know what texture to be rendered with. This field is null for other particle types and theirt textureIndex determines their location on their texture map(default vanilla particles.png file).

If you need a custom texture for your particles you can return 1 in your Particle::getFXLayer to use the blocks+items map as your texture and then call Particle::setParticleTexture with a TextureAtlasSprite object that would point to your custom texture on the blocks map. You will need to load that texture yourself using TextureStitchEvent and TextureMap::registerSprite.

1 hour ago, V0idWa1k3r said:

TextureAtlasSprite object that would point to your custom texture on the blocks map. You will need to load that texture yourself using TextureStitchEvent and TextureMap::registerSprite.

TextureMap::registerSprite returns you a TextureAtlasSprite object. This method must be called during TextureStitchEvent.Pre

Edited by V0idWa1k3r

  • Author

So then what do I put in for setParticleTexture. And what about the regular stitch event?

 

Edited by GooberGunter

That TextureAtlasSprite object that you recieve as a result of this method. 

There is no regular stitch event. TextureStitchEvent has 2 sub-events - pre(as the map is being setup) and post(after everything was loaded in).

3 minutes ago, GooberGunter said:

and then using the map.getAtlasSprite

No. registerSprite already returns you the TextureAtlasSprite object you need, there is no need to get it again.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.