Jump to content

model no loading


xelatercero

Recommended Posts

hello i am trying different ways to create items. With this way i dont get any error but the texture dont load:

 

ModiItems:

 

public class ModItems {

public static Item orbeMedio;

public static void init() {
	orbeMedio = new OrbeMedio();
}

public static void register() {
	GameRegistry.register(orbeMedio);
}

public static void registerRenders() {
	registerRender(orbeMedio);
}

private static void registerRender(Item item) {
	ModelResourceLocation itemResourceLocation = new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory");
	ModelLoader.setCustomModelResourceLocation(item, 0, itemResourceLocation);
}

}

 

 

Item:

 

public class OrbeMedio extends Item {
public OrbeMedio() {
	this.setUnlocalizedName("orbeMedio");
	this.setRegistryName("OrbeMedio");
	this.setMaxStackSize(1);
	this.setCreativeTab(CreativeTabs.MISC);
}



}

 

ClientProxy

 

public class ClientProxy extends CommonProxy{

public void preInit() {
	super.preInit();
	ModItems.registerRenders();
}

public void Init() {
	super.Init();


}

public void postInit() {
	super.postInit();
}

@Override
public boolean isDedicatedServer() {

	return false;
}

}

 

 

CommonProxy

 

public abstract class CommonProxy {

public void preInit() {
	ModItems.init();

}

public void Init() {

}

public void postInit() {


}

 public abstract boolean isDedicatedServer();

}

Link to comment
Share on other sites

ModelResourceLocation itemResourceLocation = new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory");

 

Step 1: use getRegistryName() instead of this unlocalized name substring bullshit.

Step 2: your unlocalized name does not contain your modID and should.

Step 3: this code will crash a dedicated server because you are using client side code in a common location. It does not matter that you only call this method from your client proxy, it's mere existence will crash the server.

Step 4: post your item model json.

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

Step 2: your unlocalized name does not contain your modID and should.

i never added modid in my ulocalized name.

 

this code will crash a dedicated server because you are using client side code in a common location. It does not matter that you only call this method from your client proxy, it's mere existence will crash the server.

 

what is the correct way to do it?

 

 

and my item.json is no needed , because works i mean i am using objects from another mod that i have maded and works fine, you helped me with my item json so it cant be  wrong, right?

Link to comment
Share on other sites

Step 2: your unlocalized name does not contain your modID and should.

i never added modid in my ulocalized name.

 

it should

 

If another mod adds an item that has the same unlocalized name, then the two language entries will conflict and whichever mod loads last will win.

 

this code will crash a dedicated server because you are using client side code in a common location. It does not matter that you only call this method from your client proxy, it's mere existence will crash the server.

 

what is the correct way to do it?

 

Put client side only code in the client proxy.

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

Step 3: this code will crash a dedicated server because you are using client side code in a common location. It does not matter that you only call this method from your client proxy, it's mere existence will crash the server.

 

I disagree with this. I have set up my mod also more or less like this and it doesn't crash. It doesn't crash because it is never called on the server side. How i know this for sure? Because i tested this myself on a server (yes i rent a server) and it does not crash. The server runs smooth without any problems.

Link to comment
Share on other sites

he is searching in wrong place why?

 

private static void registerRender(Item item) {
	ModelResourceLocation itemResourceLocation = new ModelResourceLocation("xelamod:" + item.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(item, 0, itemResourceLocation);
}

 

error:

 

Caused by: java.io.FileNotFoundException: xelamod:models/item/xelamod:OrbeMedio.json

 

why he search in models/item/xelamod:Orbemedio.json

 

Link to comment
Share on other sites

Ok now io dont get any error but texture dont load:

 

{
    "parent":"item/generated",
    "textures": {
        "layer0":"xelamod:items/orbeMedio"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

 

 

OrbeMedio.json

{
    "parent":"xelamod:item/standartOrbeMedio",
    "textures": {
        "layer0":"xelamod:items/orbeMedio"
    }
}

Link to comment
Share on other sites

Last log

 

[10:59:05] [Client thread/INFO]: Setting user: Player294
[10:59:09] [Client thread/WARN]: Skipping bad option: lastServer:
[10:59:09] [Client thread/INFO]: LWJGL Version: 2.9.4
[10:59:13] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:xelamod
[10:59:15] [sound Library Loader/INFO]: Starting up SoundSystem...
[10:59:16] [Thread-8/INFO]: Initializing LWJGL OpenAL
[10:59:16] [Thread-8/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[10:59:16] [Thread-8/INFO]: OpenAL initialized.
[10:59:16] [sound Library Loader/INFO]: Sound engine started
[10:59:19] [Client thread/INFO]: Created: 16x16 textures-atlas
[10:59:21] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:xelamod
[10:59:23] [Client thread/INFO]: SoundSystem shutting down...
[10:59:24] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[10:59:24] [sound Library Loader/INFO]: Starting up SoundSystem...
[10:59:24] [Thread-10/INFO]: Initializing LWJGL OpenAL
[10:59:24] [Thread-10/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[10:59:24] [Thread-10/INFO]: OpenAL initialized.
[10:59:24] [sound Library Loader/INFO]: Sound engine started
[10:59:27] [Client thread/INFO]: Created: 1024x512 textures-atlas
[10:59:28] [Client thread/WARN]: Skipping bad option: lastServer:
[10:59:29] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id
[10:59:42] [server thread/INFO]: Starting integrated minecraft server version 1.10.2
[10:59:42] [server thread/INFO]: Generating keypair
[10:59:43] [server thread/INFO]: Preparing start region for level 0
[10:59:43] [server thread/INFO]: Changing view distance to 12, from 10
[10:59:45] [server thread/INFO]: Player294[local:E:bbf83733] logged in with entity id 120 at (417.77802192786663, 4.0, 1731.81928791248)
[10:59:45] [server thread/INFO]: Player294 joined the game
[10:59:46] [server thread/INFO]: Saving and pausing game...
[10:59:46] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
[10:59:46] [server thread/INFO]: Saving chunks for level 'New World'/Nether
[10:59:46] [server thread/INFO]: Saving chunks for level 'New World'/The End
[10:59:46] [pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@e406aec[id=132512aa-0146-35c4-8d7a-8445da21ff87,name=Player294,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time
at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:65) ~[YggdrasilAuthenticationService.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:175) [YggdrasilMinecraftSessionService.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:59) [YggdrasilMinecraftSessionService$1.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:56) [YggdrasilMinecraftSessionService$1.class:?]
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) [guava-17.0.jar:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:165) [YggdrasilMinecraftSessionService.class:?]
at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3060) [Minecraft.class:?]
at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:131) [skinManager$3.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_60]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
[10:59:47] [server thread/INFO]: Player294 has just earned the achievement [Taking Inventory]
[10:59:47] [Client thread/INFO]: [CHAT] Player294 has just earned the achievement [Taking Inventory]
[11:01:45] [Client thread/INFO]: Stopping!
[11:01:45] [Client thread/INFO]: SoundSystem shutting down...
[11:01:45] [server thread/INFO]: Stopping server
[11:01:45] [server thread/INFO]: Saving players
[11:01:45] [server thread/INFO]: Saving worlds
[11:01:45] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
[11:01:45] [server thread/INFO]: Saving chunks for level 'New World'/Nether
[11:01:45] [server thread/INFO]: Saving chunks for level 'New World'/The End
[11:01:46] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[11:01:46] [Client Shutdown Thread/INFO]: Stopping server
[11:01:46] [Client Shutdown Thread/INFO]: Saving players
[11:01:46] [Client Shutdown Thread/INFO]: Saving worlds

Link to comment
Share on other sites

Post again in spoilers all the things you have now. Perhaps you have changed some stuff.

Describe what is not working. How does your item look like in game in the inventory and held in your hand?

Does it look like a big black/pink square?

Post these files again plz:

-your main class

-your client proxy

-your ModItems class

 

-the item model

Link to comment
Share on other sites

Does it look like a big black/pink square?

 

Yes.

 

Main

 

 

@Mod(modid=Reference.MOD_ID , name=Reference.MOD_NAME, version=Reference.MOD_VERSION)
public class xelamod {

@SidedProxy(clientSide=Reference.CLIENT_SIDE, serverSide=Reference.SERVER_SIDE)
 public static CommonProxy proxy;
@Instance
public static xelamod instance = new xelamod();


@EventHandler
public void preInit(FMLPreInitializationEvent e) {

	proxy.preInit();
	ModItems.init();
	ModItems.register();

}

@EventHandler
public void init(FMLInitializationEvent e) {

	proxy.Init();
}

@EventHandler
public void postInit(FMLPostInitializationEvent e) {

	proxy.postInit();
}


}

 

 

 

Client

 

 

public class ClientProxy extends CommonProxy{

public void preInit() {
	super.preInit();

}

public void Init() {
	super.Init();
	ModItems.registerRenders();


}

public void postInit() {
	super.postInit();
}

@Override
public boolean isDedicatedServer() {

	return false;
}

}

 

 

 

ModItem class

 

 

public class ModItems {

public static Item orbeMedio;

public static void init() {
	orbeMedio = new OrbeMedio();
}

public static void register() {
	GameRegistry.register(orbeMedio);
}

public static void registerRenders() {
	registerRender(orbeMedio);
}

private static void registerRender(Item item) {
	ModelResourceLocation itemResourceLocation = new ModelResourceLocation(item.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(item, 0, itemResourceLocation);
}

}

 

 

 

 

Item Model:

 

 

 

Parent:

 

{
    "parent":"item/generated",
    "textures": {
        "layer0":"xelamod:items/orbeMedio"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

 

Item :

 

{
    "parent":"xelamod:item/standartOrbeMedio",
    "textures": {
        "layer0":"xelamod:items/orbeMedio"
    }
}

 

 

 

 

Link to comment
Share on other sites

1 - Yes this is the last log

 

2- Yes i am 100% registering the model in the client proxy iun Init

 

3-The model doesnt work

 

number 2 is wrong, you need to do it in the preInit.

So it seems Diesieben07 was right about that:

The only possibilities:

  • That is not the correct log.
  • You are not actually registering your model.
  • Your model works just fine.

 

One of these is true.

Link to comment
Share on other sites

ok if i do it i get this:

 

 

 

Caught exception from xelamod
java.lang.NullPointerException
at com.xelatercero.xelamod.init.ModItems.registerRender(ModItems.java:26) ~[bin/:?]
at com.xelatercero.xelamod.init.ModItems.registerRenders(ModItems.java:22) ~[bin/:?]
at com.xelatercero.xelamod.ClientProxy.preInit(ClientProxy.java:9) ~[bin/:?]
at com.xelatercero.xelamod.xelamod.preInit(xelamod.java:26) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:599) ~[forgeSrc-1.10.2-12.18.2.2099.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239) ~[forgeSrc-1.10.2-12.18.2.2099.jar:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217) ~[forgeSrc-1.10.2-12.18.2.2099.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:609) [Loader.class:?]
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:257) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
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_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
[17:34:34] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ----

 

 

Link to comment
Share on other sites

You're trying to register the renderer for your item before you've created it.

 

		proxy.preInit(); <-- register rendering
	ModItems.init(); <-- create item
	ModItems.register();

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

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

    • I created my own modpack just for mainly entities right now and im having issues with only a handful of the mobs. is there a way someone could help go over my work and check whats wrong? its a file 
    • Hi, I have a problem with my minecraft: I'm in forge 1.20.1 and I have several mods installed, (link to photo below) and after a while, at random, the game freezes, I can't play or move but I can still hear the game in the background, there's just the image that remains, (problematic when I fight a fire dragon :() ) can you help me? my mods:   zmedievalmusic-1.20.1-2.1 treeharvester-1.20.1-8.7 tctcore-1.0-1.20.1 specialmobs-1.20.1-3.1.3 simpleOres2-1.20.1-6.0.0.2 OldCombatMod_1.20x.jar oculus-mc1.20.1-1.7.0 medieval_buildings-forge-1.0.2 matmos-5.2-forge-1.20.1 journeymap-1.20.1-5.9.18-forge jei-1.20.1-forge-15.8.0.11 iceandfire-2.1.13-1.20.1-beta-4 healthindicatortxf-1.20.1-1.2.2-forge geckolib-forge-1.20.1-4.4.7 embeddium-0.3.25+mc1.20.1 dynamiclights-1.20.1-1.2 cupboard-1.20.1-2.7 crust-1.20.1-2.3.3 collective-1.20.1-7.71 citadel-2.4.9-1.20.1 bucketlib-1.20.1-2.3.0.5 born_in_chaos_(Forge)1.20.1_1.3.1 betterfpsdist-4.4   forge 1.20.1 (47.3.5) i fink it's because of ice and fire mod, but i want it thank to help me! i hope you are well Translated with DeepL.com (free version)
    • Long story short, my girlfriend found a mod for Minecraft she wanted but it was for Pocket Edition. So I took it on myself to try and port it over and it has gone fairly well until the point I had to work with particles. Basically, I had it working using animateTick but I was checking if the block name contained a certain value to specify the lantern's color and as such choose which particle to spawn. I was initially trying to do this via the constructor, but this value hasn't been initialized that early and I can't seem to find some event or method to override which ideally happens when the block is loaded/placed. Performing upwards to 16 string comparisons per tick isn't exactly efficient so I want to try and optimize this. By the time animateTick starts executing, the name is properly initialized and I can use that to set my property accordingly. But this is where I'm starting to run into a weird issue. This is my current code; public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource randomSource) { // It's not fully initialized yet... I guess? if (this.getName().toString().contains("air")) return; if (!state.getValue(COLOR_SET)) { // This method doesn't work at all, neither states are updated var blockState = level.getBlockState(pos); blockState.setValue(LANTERNCOLOR, this.getBlockColor()); blockState.setValue(COLOR_SET, true); level.setBlockAndUpdate(pos, blockState); } double d0 = (double)pos.getX() + randomSource.nextDouble(); double d1 = (double)pos.getY() + randomSource.nextDouble(); double d2 = (double)pos.getZ() + randomSource.nextDouble(); // No idea how to better do this without adding 5 000 new files if (level.getBlockState(pos).getValue(LANTERNCOLOR) == DyeColor.WHITE.getId()) level.addParticle(PaperLanterns.LANTERN_GLOW_WHITE.get(), d0, d1, d2, 0.0D, ThreadLocalRandom.current().nextDouble(-0.10D, 0.0D), 0.0D); if (level.getBlockState(pos).getValue(LANTERNCOLOR) == DyeColor.BLUE.getId()) level.addParticle(PaperLanterns.LANTERN_GLOW_BLUE.get(), d0, d1, d2, 0.0D, ThreadLocalRandom.current().nextDouble(-0.10D, 0.0D), 0.0D); } COLOR_SET is a BooleanProperty meant to ensure this is only executed once, for performance reasons. LANTERNCOLOR is currently an IntegerProperty (it used to be an EnumProperty, but been changing stuff around trying to fix the issue) which specified the color. My issue is that I can only set one of these states, for example like this; if (!state.getValue(COLOR_SET)) { // LANTERNCOLOR is set successfully, but not COLORSET level.setBlockAndUpdate(pos, state.setValue(LANTERNCOLOR, this.getBlockColor())); level.setBlockAndUpdate(pos, state.setValue(COLOR_SET, true)); } // OR if (!state.getValue(COLOR_SET)) { // COLOR_SET is set successfully, but not LANTERNCOLOR level.setBlockAndUpdate(pos, state.setValue(COLOR_SET, true)); level.setBlockAndUpdate(pos, state.setValue(LANTERNCOLOR, this.getBlockColor())); } So I can only seemingly set one state at a time, I now know that my issue wasn't in my usage of EnumProperty so once I solve this I will be going back to that and using a switch-case. But I would love some pointers as to why I can only set one of these states. Is it because once you set it and update it, that instance of the block is now considered dirty and as such accepts no more state changes or something? I know the code's a bit all over the place with how I retrieve the states. I'm still learning and have been testing a bunch trying to get this to work, but have now found the issue but no idea how to solve it 😅 If there's a better way of setting this LANTERNCOLOR property and ensuring it's only executed once, that would be even better. The sole purpose of this is to choose which particle to spawn, since the particle colors are hardcoded.
    • Hi, I have a problem with my minecraft: I'm in forge 1.20.1 and I have several mods installed, (link to photo below) and after a while, at random, the game freezes, I can't play or move but I can still hear the game in the background, there's just the image that remains, (problematic when I fight a fire dragon :() ) can you help me? my mods: file:///C:/Users/meria/Pictures/Capture.PNG forge 1.20.1 (47.3.5) i fink it's because of ice and fire mod, but i want it thank to help me! i hope you are well Translated with DeepL.com (free version)
  • Topics

×
×
  • Create New...

Important Information

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