saxon564
Forge Modder-
Posts
490 -
Joined
-
Last visited
-
Days Won
1
Everything posted by saxon564
-
[1.12] setting lightmaps for entities and blocks [Solved]
saxon564 replied to nil's topic in Modder Support
I have also been trying to figure this out to no avail. I had code that worked back in 1.7.10 but I don't know when it broke because I took a long hiatus from modding with only a few short returns in that time. I hope you can find something that would work for you. I have some code that could work, but is very inefficient and actually breaks lighting within 16 blocks of the entity. -
I am building a utility that will allow me to generate the code for my configs more easily, but I need to figure out how the Note Particle's color is generated as the particle will be a possible option in my configs. The code I have found in the NoteParticle.class (featured below) will only generate gray particles, even though there are numerous colors you can get. When doing the particle command only 1 value controls the color ranging from 0.0(green) up to 1.0(also green). Because of this I know a simple rgb to hex and hex to rgb coverter in my utility will not be enough without some other step that I cannot figure out. Anyone have any ideas on where to look or what is going on? private NoteParticle(World p_i51018_1_, double p_i51018_2_, double p_i51018_4_, double p_i51018_6_, double p_i51018_8_) { super(p_i51018_1_, p_i51018_2_, p_i51018_4_, p_i51018_6_, 0.0D, 0.0D, 0.0D); this.particleRed = Math.max(0.0F, MathHelper.sin(((float)p_i51018_8_ + 0.0F) * ((float)Math.PI * 2F)) * 0.65F + 0.35F); this.particleGreen = Math.max(0.0F, MathHelper.sin(((float)p_i51018_8_ + 0.33333334F) * ((float)Math.PI * 2F)) * 0.65F + 0.35F); this.particleBlue = Math.max(0.0F, MathHelper.sin(((float)p_i51018_8_ + 0.6666667F) * ((float)Math.PI * 2F)) * 0.65F + 0.35F); } (Not the full constructor, but the relevant code for what I have found)
-
[1.14.4] [SOLVED] world.addParticle() crashing with ParticleType
saxon564 replied to saxon564's topic in Modder Support
I have gotten it working now. I finally found the code in the ParticleArgument class that handles this and was able to implement it. I had build some code similar, but didn't have all the parts to it. I had: private static deserializeParticle(StringReader reader, ParticleType<T extends IParticleData> type) { But what it needed to be was: private static <T extends IParticleData> T deserializeParticle(StringReader reader, ParticleType<T> type) throws CommandSyntaxException { Thank you for your patience with my diesieben! You are always a great help! -
[1.14.4] [SOLVED] world.addParticle() crashing with ParticleType
saxon564 replied to saxon564's topic in Modder Support
Sorry, was late and forgot about that. Here is the current code -
[1.14.4] [SOLVED] world.addParticle() crashing with ParticleType
saxon564 replied to saxon564's topic in Modder Support
Unfortunately there wasn't much I could use from your code. Since I do not know exactly which particle I am using I cannot call ParticleTypes, which when you call world.addParticle(AirParticleData.NORMAL, posX, posY, posZ, 0, 0, 0); it is equivalent to me calling world.addParticle(ParticleTypes.BUBBLE, posX, posY, posZ, 0, 0, 0); as you already have the IParticleData setup. I have to setup the IParticleData on the fly, which I have figured out how to do, if only I could figure out how to get around the error The method deserialize(ParticleType<capture#5-of ?>, StringReader) in the type IParticleData.IDeserializer<capture#5-of ?> is not applicable for the arguments (ParticleType<capture#6-of ?>, StringReader) -
[1.14.4] [SOLVED] world.addParticle() crashing with ParticleType
saxon564 replied to saxon564's topic in Modder Support
Awesome! Sounds like you have a lot of good information in there! I will take a look at it when I have the opportunity tonight. Hopefully I can find what Im looking for and learn how to use it better for my application. -
[1.14.4] [SOLVED] world.addParticle() crashing with ParticleType
saxon564 replied to saxon564's topic in Modder Support
I've been trying to figure out how to work the deserializer to get IParticleData and for the life of me am having trouble figuring it out. Do you have any examples I can take a look at to help me with this? Or possibly know a mod with open source that does this that I can take a look at? -
[1.14.4] [SOLVED] world.addParticle() crashing with ParticleType
saxon564 replied to saxon564's topic in Modder Support
I just looked into what you mentioned. Most calls use a field from ParticleTypes which I could do if the needed particle wasn't configurable or there was a way to get the ParticleTypes fields from the chosen particle in the configs. The other ones I saw was creating a new instance of ItemParticleData, BlockParticleData, or RedstoneParticleData, also I could use those if the particle I was handling needed one of them. But that is not the case. I am getting the particle from the ForgeRegistries which uses ParticleType. I have been digging around and am struggling to find a way to get from ParticleType to IParticleData and currently is is looking like I would have to re-register the particle which I know can't be the correct way to do it. -
I am having an issue now where when I spawn my mob in, the game crashes when it starts trying to spawn particles around the entity. I have it set up where the user can specify the particles in the configs and it also allows them to use more than 1 particle. Because of this I have to use an array (protected static ParticleType<?>[] particleType;) to handle the particles. But when I fill the array and use it my editor is telling me I need to cast ParticleType to IParticleData, which cannot be done. How can I still use this array and also give the method the IParticleData it wants? This is my code trying spawning the particles. My code setting the paticleType variable My code building the array of particles.
-
[1.14.4] [SOLVED] Prevent Custom Configs From Being Removed
saxon564 replied to saxon564's topic in Modder Support
I figured it out! After lots and LOTS of digging, I was able to use to same type of system that was removing the configuration options to add them to the internal configuration. It isn't pretty and I am sure it could be done better, but this is the first way I could find to do it and until I am a little more comfortable with this system, unless someone else has suggestions it is probably going to remain the way it is for a while. You can see my code on this github page. What it is doing is cycling through the categories in the configuration files until it finds the "Spawning" category, then it cycles through everything in that category to fin the sub category "Biomes." From there it once again cycles through each biome in that category and adds them to the map I have to hold the values for reference and also adds them to the configuration file I am generating. -
You have multiple errors along the lines of this: This one shows that the game is not finding firstblock.json in the location resources/test/blockstates. You do have the file "firstblock", but not "firstblock.json" That is a very important distinction to notice and realize when making your files.
-
[1.14.4] [SOLVED] Prevent Custom Configs From Being Removed
saxon564 replied to saxon564's topic in Modder Support
I found that what is causing my issue is within the code of forge itself. Inside ForgeConfigSpec is a private correct() method, and within this method lies this code: // Second step: removes the unspecified values for (Iterator<Map.Entry<String, Object>> ittr = configMap.entrySet().iterator(); ittr.hasNext();){ Map.Entry<String, Object> entry = ittr.next(); if (!specMap.containsKey(entry.getKey())) { if (dryRun) return 1; ittr.remove(); parentPath.addLast(entry.getKey()); listener.onCorrect(REMOVE, parentPathUnmodifiable, entry.getValue(), null); parentPath.removeLast(); count++; } } Which removes all the user generated config values. On a personal level I feel that we should be able to pass a boolean on whether this should be used or not, but I do see the importance of cleaning up irrelevant information to limit the size of the file and improve load times. EDIT: The only possible work around I can think of for this is to copy and paste most of the ForgeConfigSpec file and remove that section of code. (This is exactly what I did to confirm my suspicion) But I do not plan on actually doing that for a solution because it is bad practice and there isn't much of a change I would do to it that would allow me to make it my own. -
[1.14.4] [SOLVED] Prevent Custom Configs From Being Removed
saxon564 replied to saxon564's topic in Modder Support
After some playing around with it, I have learned that forge rewrites every config file every time it boots up and will replace the internally supplied values with values from the previous file. Because of this, when a user adds something outside of the norm, what the user adds never gets read and put into the new file, therefore it ends up getting deleted. Now knowing this is making me wonder if there is a good way to check for the existence of those values and pass them into the new file... My previous layout had an extra layer so it read [Spawning] Min_Spawn_Light_Level = 0 "Can Spawn" = true Min_Spawn_Temp = 0.0 Spawn_Probability = 10 Min_Spawn_Group_Size = 2 Biome_List_Type = "Blacklist" Max_Spawn_Group_Size = 3 Max_Spawn_Temp = 1.0 Max_Spawn_Light_Level = 7 Biome_List = "[List of Biomes mob may or may not spawn in]" [Spawning.Biomes] [Spawning.Biomes.minecraft_hell] Spawn_Probability = 5 Min_Spawn_Group_Size = 1 Max_Spawn_Group_Size = 1 I am wondering on the possibility of checking if Spawning.Biomes is empty and if not, parsing through the sub-groups and values to pass them into the new file. I am not sure if this is possible or would work as it would mean I would need to be able to actually read the config file on demand instead of just reading values stored as variables inside my class. Does anyone have any thoughts on how possible this may be? This leads into the second issue I mentioned in an earlier post, which is reading the config files on demand since I will not know what the user puts in therefore will not be able to save it as a variable with this format. -
[1.14.4] [SOLVED] Prevent Custom Configs From Being Removed
saxon564 replied to saxon564's topic in Modder Support
Thats what I'm afraid of as my best option. I can get it to generate the file to look like the second example, in fact the example is how I am currently generating my configs while testing. Only thing is that if I were to manually add [Spawning.minecraft_end] it would just remove it. There is one other potential issue to address after this, but that issue is dependant on being able to do the configs the way I want to do them. I do see that there are different writing systems when building the files. But neither of the others sound like they would be a step in the right direction. One if them just overwrites the entire file and the other ands onto the end of the file. -
The problem I am currently having is how to prevent the NightCore config system from over-writing config options the user enters that are outside the scope of the normal config options. I have several mobs which I offer spawning config options for, and would like to be able to offer the ability for people to set config options per biome. By default this is what the config files will look like for most of my mobs. [Spawning] Min_Spawn_Light_Level = 0 Can_Spawn = true Min_Spawn_Temp = 0.0 Spawn_Probability = 10 Min_Spawn_Group_Size = 2 Biome_List_Type = "Blacklist" Max_Spawn_Group_Size = 3 Max_Spawn_Temp = 1.0 Max_Spawn_Light_Level = 7 Biome_List = "[List of Biomes mob may or may not spawn in]" When someone adds their own options it would look more like this: [Spawning] Min_Spawn_Light_Level = 0 "Can Spawn" = true Min_Spawn_Temp = 0.0 Spawn_Probability = 10 Min_Spawn_Group_Size = 2 Biome_List_Type = "Blacklist" Max_Spawn_Group_Size = 3 Max_Spawn_Temp = 1.0 Max_Spawn_Light_Level = 7 Biome_List = "[List of Biomes mob may or may not spawn in]" [Spawning.minecraft_hell] Spawn_Probability = 5 Min_Spawn_Group_Size = 1 Max_Spawn_Group_Size = 1 The code I currently have to build the configs is this: public static void loadConfig(ForgeConfigSpec spec, Path path) { final CommentedFileConfig configData = CommentedFileConfig.builder(path) .sync().autosave().build(); configData.load(); spec.setConfig(configData); } As far as I can tell, this is the basic most commonly used code for building the config files. The problem is that with the current system when the game boots up it will remove everything that falls in 'Spawning.Biomes' unless it is set inside the code, which will only be the case for a few mobs. Currently, the only way I can think of around this is to iterate through each biome and set a blank area for the config options which would increase the server load considerably since it would cycle through all the biomes a total of 2 times for each mob. Once while setting up the configs, and once more while registering the spawns for each mob, which is something I don't want to do if I don't have to.
-
So I found that only when the chicken is tamed, the list of possible near targets returns empty, even if the chickens are right next to each other, but if the chicken is not tamed, it does return a list with the closest chickens. The strange part is, if I comment out the taming code, the list will still return empty if the chicken is spawned in with an owner, though it doesnt know it is actually tamed.
-
I do have a line printing to the console if the bool is true and I do see that line while testing. I am also testing on a 3x3 platform near build height so I dont get any chickens spawning on the ground, so there is nothing obstructing their view. Though I have tried it with checkSight set to both true and false. Setting an attack target is such a simple thing to do, which is why I am so confused as to why it isnt working.
-
Does anyone have an idea about what is going on? I am still trying to figure it out to no availe.
-
I notice the first post didn't seem to really offer much information so I have reworked the post to be: I am working on adding infections for the chickens in my mod, and one of the infections causes the chicken to attack the other chickens from the mod. I have gone about this various ways, and have seen that the target is getting added, but the chicken is not attacking the target like it supposed to be. They still attack players like they are supposed to, just not other chickens. All my chickens extend from EntityMoChicken so they should all be valid targets. I have tried a specific chicken class and it still did not work. Is there something I am missing? The code is here on GitHub
-
I am working on adding infections for the chickens in my mod, and one of the infections causes the chicken to attack the other chickens from the mod. I have gone about this various ways, and have seen that the target is getting added, but the chicken is not attacking the target like it supposed to be. The code is here on GitHub
-
[1.11.2] Config Int Array Becoming Empty before use
saxon564 replied to saxon564's topic in Modder Support
I would assume you would pass a List into the constructor? If not and you mean all the options as variables, that would be 60 variables to pass, which in my mind is a lot of clutter which would all be in 24 places based of the current number of entities in my mod. (23 entities plus the constructor. Considering this, there really is no clean and better way to handle it... At least in my mind. Also considering if you were thinking of passing a List, then there would be 23 calls to the constructor which would each have the list declared with all 60 options. If you can think of something that would be cleaner and use less file space, I am more than happy to try it Edit: Maybe having a class called "ChickenConfig" with a sub-class for each of the entities so they would be called by ChickenConfig.BeefyChickenConfig(event) or something like that. It would create a class that is over 4000 lines though, so that part makes me hesitant. -
[1.11.2] Config Int Array Becoming Empty before use
saxon564 replied to saxon564's topic in Modder Support
Then what would you do for it??? I took what you said and removed the '= new String[50]' and '=new int[50]' (amplifications and durations) and it is now working. As well as deleted the config files that I had before the change since I realized I forgot to do that before. -
[1.11.2] Config Int Array Becoming Empty before use
saxon564 replied to saxon564's topic in Modder Support
Each of the mods is customizable and runs off a different config, the class I have been showing you is a base class they all extend. I have uploaded the new config code updating all of them to use the Strings, but before I was just testing 1 of the mobs since they all in the end use the same thing. The loading doesn't seem to have the issue. the issue seems to be when it actually trys to create the potion effect. Using strings now is causing it to crash since strings can actually be null. I have added the crash report in the spoiler. -
[1.11.2] Config Int Array Becoming Empty before use
saxon564 replied to saxon564's topic in Modder Support
Changed it to a String and am now getting the potion through the resource location. But that aside, the issue remains the same. -
[1.11.2] Config Int Array Becoming Empty before use
saxon564 replied to saxon564's topic in Modder Support
Alright. Well to get back to the original reason for this post, were you able to find why my array was beimg emptied?