Jump to content

scientistknight1

Members
  • Posts

    77
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by scientistknight1

  1. Ah; you can't just copy the properties, you need to use the same block class as the soul campfire.
  2. Unfortunately, you probably won't get any help with your problem here, since this is the Forge forums. As it says in the FAQ that you presumably read before posting, "We only support Forge here. We cannot help you with Fabric, Spigot, etc..." Forge and Fabric are completely different and run by different people, so it's unlikely (to say the least) that anyone here will be willing or able to assist with a Fabric problem. I'd recommend joining the Fabric Discord Server that's linked on the Fabric website. They might be able to help you there. I'd also recommend notifying the developers of whatever mod you're using.
  3. From what I've found, you can only manipulate the player's motion on the client side. It's extremely annoying. If you know how to use packets, you can use packets to transfer the information from the server. Take a look at my implementation on GitHub here if you want. You'd want something similar to the way I've done the PlayerAddVelocityPacket. Unfortunately, packets are rather complex; I'd recommend you watch a few tutorials on them before even trying to work with them. Feel free to use my code as a reference, but please give attribution if you plan to directly copy it.
  4. Can you post your ModBlocks class where you've registered the block, as well as which version of Minecraft you are using?
  5. It looks like you're trying to pass the lemon juice item itself to the .food method in your first code snippet; that won't work. The parameter to the .food method needs to be a FoodProperties object, as the error says. The second way you're doing it there is much closer to how it should be. The problem there is that you're trying to access the LEMON_JUICE field of the vanilla FoodProperties class. This won't work because the vanilla food properties class does not have LEMON_JUICE information in it. You'll need to make your own ModFoods class, looking something like the vanilla Foods class. Here's an example: public class ModFoods { public static final FoodProperties LEMON_JUICE = (new FoodProperties.Builder()).nutrition(3).saturationMod(0.25F) .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500), 0.5f).build(); } Then, your completed item registration would be: public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(ModFoods.LEMON_JUICE))); Notice that I changed the FoodProperties to ModFoods, since that's the class where you'd be storing the food data.
  6. Here is a tutorial; this is what I used. 1.20 Minecraft Forge Modding Tutorial - Packets
  7. Corrected item registration code: (for the ModItems class) public static final RegistryObject<Item> LEMON_JUICE_BOTTLE = ITEMS.register("lemon_juice_bottle", () -> new HoneyBottleItem(new Item.Properties().stacksTo(1) .food((new FoodProperties.Builder()).nutrition(3).saturationMod(0.25F) .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500), 0.5f).build())));
  8. Apologies for the late reply. You'll need to register the item in ModItems; if you're following those tutorials, that's the only place you should ever register items. Otherwise, the mod will fail to register them properly and you'll get all sorts of interesting errors. Looking back at the code snipped I posted, I think that actually has some errors. I'm adding a lemon juice bottle to my mod just to ensure that it works correctly, and I will reply when I have solved the problems.
  9. I might have an idea why your original method was causing so much trouble. See this while loop? You're only incrementing the number of blocks you've corrupted if you find one that you can corrupt. What happens if you can't find any? The while loop will run forever (a long time). This could happen if, for instance, the feature generates inside a vein of blocks that aren't marked as STONE_ABERRANTABLE. There are two alternate strategies I'd recommend to fix this. First, you could simply increment numBlockCorrupted regardless of whether you've actually corrupted the block. This is the simplest and quickest way, and it should ensure that the loop runs no more than numBlocksToCorrupt times. Alternatively, you could add a "kill switch" that keeps track of how many times the loop runs, and then ends it after a certain limit of your choosing. That could look something like this: // Keeps track of how many blocks have been checked so far. int numBlocksChecked = 0; // Check up to twice as many blocks as you actually want to corrupt. // This is a good compromise between speed and actually getting the number of blocks // that you want to corrupt. int numBlocksToCheck = numBlocksToCorrupt * 2; // Modified the while loop condition to end after a certain number of blocks are checked. while (numBlocksCorrupted < numBlocksToCorrupt && numBlocksChecked < numBlocksToCheck) { // Generate a random position within the area, using the offset origin BlockPos randomPos = offsetOrigin.offset( ctx.random().nextInt(2 * areaSizeX + 1) - areaSizeX, // between -areaSize and areaSize ctx.random().nextInt(2 * areaSizeY + 1) - areaSizeY, ctx.random().nextInt(2 * areaSizeZ + 1) - areaSizeZ ); // If the block at the random position is in the IS_ORE_ABERRANTABLE tag, replace it if (world.getBlockState(randomPos).is(ModBlockTags.STONE_ABERRANTABLE)) { world.setBlock(randomPos, surroundingBlockState, 2); numBlocksCorrupted++; } // Increment the number of blocks that you've checked. numBlocksChecked++; } Let me know if you're still running into lag problems or are confused by my explanation.
  10. Advice for the future: I made functions to create recipes more easily; they generate names for the recipes based on the ingredients and the result.
  11. I'm guessing that's so people can implement their own custom animated models? I really don't know though, since I've never had to use that at all. I just know that you can have more control over a block entity model than over a standard block model, as well as use animations. I'm glad I could help, though!
  12. Did you check the getRenderShape method of your block to ensure it's returning the correct enum value?
  13. It sounds to me like you're trying to register an item or block in the wrong place. Check to make sure you're handling the registries in the right place.
  14. A glowing texture for a custom armor is a daunting task; you'll need to create a custom render layer for your armor, which is easier said than done, and also connect that layer to the player that should be wearing it. I really have no idea how to do that. I'd recommend looking into how other mods do custom armor, and working from there.
  15. It sounds like you're probably registering the item in the wrong place, try looking at this tutorial for how to register items: Forge Modding Tutorial - Minecraft 1.20: Custom Items & Creative Mode Tab | #2 This (free) tutorial series is excellent, by the way, and I'd highly recommend watching through some or all of the videos. There may also be an error in the code I showed above since I was in a hurry, but it should be enough for the general idea. I can't be more specific since I don't know exactly what you plan to do.
  16. I can confirm a similar error when trying to set up a 1.19.2 modding environment in Eclipse; something is definitely cached that doesn't do well when the environment is edited. I solved it similarly to how you did, by simply restarting from the ground with a different project in a different version.
  17. Apologies for taking so long to respond, I forgot to check the forums for a while. You can probably just use the HoneyBottleItem class when registering your item, if you don't need custom behavior. Here's an example of what you might have to do: public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register( "lemon_juice", () -> new Item( new HoneyBottleItem.Properties().stacksTo(1).food( (new FoodProperties.Builder()) .nutrition(4) .saturationMod(0.1F) .effect(() -> new MobEffectInstance(MobEffects.GLOWING, 100, 0), 0.8F) .build() ) ) ); This is a random food item I grabbed from the mod I'm working on, I just renamed it to lemon juice so you could see what it would look like. Don't worry about being clueless, YouTube will only take you so far. I'd recommend looking at published mods on GitHub to see how to do things, it makes life easier. Just remember to give attribution if you use any of their code, and check their licenses. If you do need to register your item, you can just make a class that inherits from HoneyBottleItem, and then modify what you need in there.
  18. I'm not sure - I haven't actually used this mod, so I don't even know how it works. Can you get someone else to try changing the config?
  19. It looks like the configuration is server-side? "Fully configurable settings for the movement logic. (Configs are serverside)"
  20. It looks like you'll need to implement a custom class for the item; that's how the sounds are handled. Look at the class HoneyBottleItem to see how it's done. Alternatively, you could just use the HoneyBottleItem class for your item, if you're trying to make a bottled drink of some kind. That might be simpler. Reply to this post if you're having trouble, and I'll see if I can help. You'll use the HoneyBottleItem class (or your custom class) when you're registering the item, not when you're creating the properties. Thought I should probably make that clear.
  21. You'd probably have to override the normal sky rendering; I'd recommend you take a look at the LevelRenderer class. To do that, you'll probably need mixins. I have no idea how to proceed from there, though, since I don't know much of anything about how to do this. I have a feeling that it won't be trivial, though.
  22. As perromercenary00 said, you need to include the namespace of the texture. If you don't, Minecraft will assume the texture falls under the "minecraft:" namespace.
  23. I'd advise moving the starting position to just outside the block in the direction of the target position.
×
×
  • Create New...

Important Information

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