Jump to content

IceMetalPunk

Members
  • Posts

    402
  • Joined

  • Last visited

Everything posted by IceMetalPunk

  1. Oh...darn, that means I need to create 16 model files just for the particle texture Oh, well, if I must I must. Thank you! Yes, that would have been more concise. It looks like I won't be using the state mapper anyway after all, as it breaks particles; but thank you anyway!
  2. Thank you! This fixed it! However, I now noticed something that may have been a problem before, but I didn't realize until now. The block-breaking particles from the trapped shulker boxes are the purple-and-black "no texture" image. Without a block model, how do I define the particle texture?
  3. My class extends the BlockShulkerBox class, which already does that... but just to be sure, I added another override like you suggested into my child class, and it still gives me the same "model not found" errors. EDIT Actually, I just realized that although the error is coming from the ModelLoader, it's the missing block *state* file that's causing the error. But that said, the block doesn't have any block states, either, so this still shouldn't be happening... Here's the relevant class, if it helps: https://github.com/IceMetalPunk/RedPlusPlus/blob/master/main/java/com/icemetalpunk/redplusplus/blocks/BlockTrappedShulkerBox.java
  4. In my mod, I'm basically hijacking vanilla shulker boxes to add a new block which is a simple trapped shulker box. That is, it's identical to a shulker box, except when opened, it emits a redstone signal like a trapped chest. Everything works perfectly fine. Except that I get "model not found" errors in the console log, since it's using vanilla's shulker box Tile Entity to do the rendering rather than an actual model file. The errors aren't fatal, and they cause no problems with the game; the boxes work and look exactly as they should. But I'm not comfortable releasing the mod with those errors still in. How do I stop Forge from looking for model files for my block when it doesn't use model files?
  5. I'm trying to switch my code over from using GameRegistry.addShaped/ShapelessRecipe() to the new 1.12 JSON files, but things aren't going well. I'm transitioning with just one of my items first, and once that works, I'll transition the rest. For that one item, I've stopped calling addShapedRecipe(), and I've added a recipe file in assets/redplusplus/recipes based on one of the vanilla recipe files. Then, in the game, I've given myself all recipes with /recipe give @a * to ensure I've unlocked it. The strange thing is that the recipe does work--I can craft it perfectly--but it's not showing up in the recipe book itself. Is there an extra step I need to add it to the recipe book? I've seen a few topics lately about 1.12 recipes, but none have actually said anything more is needed beyond the .json file, so I'm lost now. Here's the contents of the JSON file, called assets/redplusplus/recipes/diamond_pressure_plate.json: { "type": "minecraft:crafting_shaped", "group": "redplusplus:diamond_pressure_plate", "pattern": [ "DD" ], "key": { "D": { "item": "minecraft:diamond" } }, "result": { "item": "redplusplus:diamond_pressure_plate", "data":0 } } If the recipe works, why wouldn't it be added to the recipe book? EDIT If it helps, here's the repo containing my project, with all its code and resources: https://github.com/IceMetalPunk/RedPlusPlus
  6. It you check that it equals zero, then it will only be true when the random number is exactly zero; in other words, it will make it spawn the Ruby type 1/6 of the time instead of 5/6. EDIT Whoops, a bit of a delayed response; I should have refreshed the page before replying. Sorry.
  7. That entire line is all evaluated before deciding whether it should use the Ruby type. if (biome instanceof BiomeHills && this.worldObj.canSeeSky(new BlockPos(this)) && this.rand.nextInt(6) != 0) Which means if it spawns outside the hills biome, if there are any blocks above it when it spawns (so it can't see the sky directly), or if there happens to be a 1/6 chance on the random number result.... if any of those things are true, it won't use the Ruby type. So you might want to check all those conditions with some console output (using, for instance, the System.out.println() method) to see which is failing.
  8. It'd be the same thing. Picking a random integer between 0 and 5 gives you a 1/6 chance of picking any particular one of those numbers; if you're checking that it hasn't picked just one of them, the value you choose to compare against doesn't matter, it will still be the same 1/6 chance of being false.
  9. && means "and". this.rand is a random number generator, which all Entities have. nextInt(int X) is a method of Java's random number generators that generates a random integer from 0 to X-1. != means "not equal to". So this uses the entity's random number generator to pick a random integer from 0 to 5 and check that it's not 0. Which means it creates a 5/6 chance of the condition being true, and a 1/6 chance of it being false. In other words, in this case, 5/6 of the dragons in the hills will be Ruby type, while 1/6 will not.
  10. You can set it to as many breeds as you want. Remember that you can use "else if" statements in Java. weightedProb determines the chance that this particular mob will spawn instead of a different mob that can spawn in the same biome. So for instance, if your dragon could spawn, or a skeleton could spawn, giving your dragon a higher weightedProb makes it more likely the game will spawn your dragon instead of a skeleton.
  11. Right, but if you try representing more than 16 blocks with an ItemBlock, then as soon as it's placed in the world, all hell will break loose. (And by that, I mean "it won't work".) Which you can easily do by using the data value of the ItemBlock; as far as I know, when an ItemBlock is placed in the world, it calls the block's getStateForPlacement() method and passes its metadata in (which, by default, passes the metadata into the getStateFromMeta() method). So you can take that metadata in that method and convert it to the proper block state for your color, and return that.
  12. Which method of GameRegsitry, and for what? It seems perhaps there are basic concepts of both Java and Forge that you aren't quite familiar with. I'd suggest starting smaller, with some more basic mods and watching/reading tutorials on how to make a basic mod first. Once you're comfortable with that, then move on to larger projects like trying to update an existing dragon-taming mod.
  13. No... onInitialSpawn is just a method that will be called on your entity whenever it spawns in the world. It's up to you to put the code in that method to check the biome, set the breed data, and do whatever else you need your entity to do whenever it spawns.
  14. The EntityLiving class contains a method called onInitialSpawn which is called the first time an entity spawns and never again for that instance of the entity. You can override that to check the biome the entity is currently in and set the data accordingly.
  15. Yes, but that's not where you should be looking for spawning data. For spawning of custom entities, you should be using the Forge method EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biomes). So for instance, to add your NetherDragon to the Nether, spawning in groups of 1 to 3 often, keeping in mind the Nether's biome is called HELL, you'd do something like this: EntityRegistry.addSpawn(EntityNetherDragon.class, 1.0f, 1, 3, EnumCreatureType.MONSTER, Biomes.HELL);
  16. Neither. Look up how to create and use event handlers with Forge; they'll come in very useful for you in the future
  17. Rather than making the entity immune to fire, I would hook into the LivingEvent.LivingHurtEvent. This way you can cancel all fire damage for your entity like you want, but you can also apply potion effects if the DamageSource is fire damage. For instance: @SubscribeEvent public void handleFirePotion(LivingEvent.LivingHurtEvent event) { if (event.getSource().isFireDamage() && event.getEntityLiving() instanceof EntityNetherDragon) { event.getEntityLiving().addPotionEffect(new PotionEffect(...)); event.setCanceled(true); } } Fill in the PotionEffect's constructor as needed, of course.
  18. What's your code? How are you registering your sound events? Do you have your sound.json file set up properly, and the .ogg files it references in the right spot? And lastly, why are you using the minecraft: domain for your custom sounds? You should be using your own.
  19. Data values and NBT tags are two different things. The data value is an integer, and you can only have one data value per item/item stack. So if you're trying to keep track of both color and wood type, unless you can represent all combinations of those things within a single integer from 0 to 15, you can't use data values for it. But overall, even if you're using NBT tags for this, it's pretty easy. You'd register all your possible item variant model locations with ModelLoader.registerItemVariants(), then you'd supply a customMeshDefinition function that does the logic to determine which model should be used at any given time. Check out this tutorial file for a bit more clarity: https://github.com/McJty/ModTutorials/blob/master/src/main/java/mcjty/modtut/items/MultiModelItem.java Note that the customMeshDefintion function can have any logic you want, whether it be based on the item stack's metadata, NBT tags, or anything else that can be obtained from an ItemStack within the Item class.
  20. I hope I'm not "hijacking" this topic (if I am, let me know and I'll post my own topic for this), but I'm having a very similar problem now that I'm trying to transition to recipe .json files instead of using the #add[X]Recipe methods. I'm testing the transition with just one item, and although the recipe works (I can craft it), it's not showing up in the recipe book. I have, in fact, called /recipe give @a * to make sure I've unlocked the recipe; then I even specified the item in that command and it told me I already have the recipe for it. And yet, it's not anywhere in the recipe book. (I've tried searching for its name, and also just looking through every page of the book to the end, and it's not there.) The JSON file (which I assume is okay, since the recipe itself works) contains this: { "type": "minecraft:crafting_shaped", "group": "redplusplus:diamond_pressure_plate", "pattern": [ "DD" ], "key": { "D": { "item": "minecraft:diamond" } }, "result": { "item": "redplusplus:diamond_pressure_plate", "data":0 } } If the recipe is properly loading, shouldn't it also be properly added to the recipe book? (Note: I tried removing the group and it didn't change anything.)
  21. According to the vanilla recipe files, no; you can specify an array of items for any of the ingredient keys, and any item which is included in that array will match for your recipe. That's how the bed recipe checks for all the different planks, at least; I'd hope Forge is able to handle it, too
  22. *Facepalm* Whoops, I was looking at an entirely different line of code when I wrote that... I probably shouldn't try to help people at 4AM without sleep. I guess I'm taking the "Always Be Coding" motto too far... Sorry, themistik! But, yes, as voidwalker pointed out, you've got your order of parameters mixed up; the ItemStack comes last, not first.
  23. The constructor you're using for your new PotionEffect() is one which assigns a duration of 0 to the effect. Most effects won't actually be visible with a zero duration. You should try using one of the other constructors which takes in a duration and using a non-zero duration with it. If that still doesn't work, try adding a System.out.println() debug output inside that FOR loop to see if it's even running, and what the effect is if so; that should give you some more insight into the problem.
  24. Never mind, it works now >_< Originally, I didn't have the domain on either the sound name or the resource location. That's when it was giving me the "empty sound event" error. Then I added it to the sound name, which removed that error, so I thought I was going in the right direction and added it to the resource location. Obviously, still no luck. Turns out the domain is required in the resource location, but cannot be in the sound name. Because with that combination, it works just fine. Go figure. Now I know! Thank you for your help!
  25. It wasn't sass at all. If your code works, you're probably doing it right. If it doesn't work, then we need to know what problems you're having before we can help you figure out what you're doing wrong.
×
×
  • Create New...

Important Information

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