
Peerius
Members-
Posts
53 -
Joined
-
Last visited
Everything posted by Peerius
-
To clarify what I mean:
-
Not exactly. The texture for the item shall be handled as always and then I want to add a layer with another texture with the things mentioned above. But I guess the things you told me should help, so I'm going to try it. Thank you for now - I write again, if I have more problems
-
Hello, I already asked this question a while ago for 1.15, but I think I can ask more specificially now. I want to implement a falling star similar to the one in the LegendGear mod. So it's basically a ProjectileItemEntity falling from the sky but overlayed with a spinning, color changing star-shaped texture. I already implemented the entity and it works fine, but I struggle with the renderer. I looked at the SpriteRenderer to get some information on how to use MatrixStacks and so on and this is what I currently have: @Override public void render(ShootingStarEntity entity, float f1, float f2, MatrixStack stack, IRenderTypeBuffer buffer, int i1) { super.render(entity, f1, f2, stack, buffer, i1); IVertexBuilder builder = buffer.getBuffer(RenderType.getCutout()); if(!entity.collidedVertically) { }else { stack.push(); stack.rotate(this.renderManager.getCameraOrientation()); stack.rotate(Vector3f.YP.rotationDegrees(180.0F)); this.itemRenderer.renderItem(entity.getItem(), ItemCameraTransforms.TransformType.GROUND, i1, 0, stack, buffer); stack.pop(); } } (The renderItem call has currently no further use) And this code is, as far as I got it basically used to make the ProjectileItemEntity (e.g. snowball) appear and look at the player. My texture for the overlay is just a white, star-shaped texture with some transperancy. I hope someone can give me a hint on how to overlay a texture and how to rotate and color it. I found many methods in many classes, but I don't know which to use here. Thank you in advance and stay healthy
-
[1.16.3] How to create a custom potion with a custom effect?
Peerius replied to Peerius's topic in Modder Support
Ah okay, I didn't know what exactly to use there. Thank you very much, it works now! -
[1.16.3] How to create a custom potion with a custom effect?
Peerius replied to Peerius's topic in Modder Support
Okay, now I did this: public static void init (){ EFFECTS.register(FMLJavaModLoadingContext.get().getModEventBus()); POTIONS.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static void addBrewingRecipes(FMLCommonSetupEvent event) { System.out.println("PotionList: Brewing Recipes called."); event.enqueueWork( () -> { BrewingRecipeRegistry.addRecipe(Ingredient.fromStacks(PotionUtils.addPotionToItemStack(ItemStack.EMPTY, Potions.AWKWARD)), Ingredient.fromStacks(new ItemStack(ItemList.nectar)), PotionUtils.addPotionToItemStack(ItemStack.EMPTY, PotionList.LOVE.get())); } ); } public static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, DeepAffection.modid); public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTION_TYPES, DeepAffection.modid); //Effects public static final RegistryObject<Effect> LOVE_EFFECT = EFFECTS.register("love_effect", () -> new ModEffect(EffectType.BENEFICIAL, 13209599) .addAttributesModifier(Attributes.field_233821_d_, "55FCED67-E92A-486E-9800-B47F202C4386", (double)0.34F, AttributeModifier.Operation.MULTIPLY_TOTAL) .addAttributesModifier(Attributes.field_233825_h_,"AF8B6E3F-3328-4C0A-AA36-5BA2BB9DBEF3", (double)0.17F, AttributeModifier.Operation.MULTIPLY_TOTAL) .addAttributesModifier(Attributes.field_233818_a_, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", 10.0D, AttributeModifier.Operation.ADDITION) .addAttributesModifier(Attributes.field_233828_k_, "03C3C89D-7037-4B42-869F-B146BCB64D2E", 1.0D, AttributeModifier.Operation.ADDITION)); //Potions public static final RegistryObject<Potion> LOVE = POTIONS.register("love", () -> new Potion(new EffectInstance(PotionList.LOVE_EFFECT.get(), 6000))); My potion works now, but I can't brew it yet. Did I do something wrong with the enqueueWork? -
[1.16.3] How to create a custom potion with a custom effect?
Peerius replied to Peerius's topic in Modder Support
Okay, that helps - thank you. I only have one problem left: register the potion and the effect the right way. Here is what I've done: public static void init (){ EFFECTS.register(FMLJavaModLoadingContext.get().getModEventBus()); POTIONS.register(FMLJavaModLoadingContext.get().getModEventBus()); PotionList.addBrewingRecipes(); } public static void addBrewingRecipes() { BrewingRecipeRegistry.addRecipe(Ingredient.fromStacks(PotionUtils.addPotionToItemStack(ItemStack.EMPTY, Potions.AWKWARD)), Ingredient.fromStacks(new ItemStack(ItemList.nectar)), PotionUtils.addPotionToItemStack(ItemStack.EMPTY, PotionList.LOVE.get())); } public static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, DeepAffection.modid); public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTION_TYPES, DeepAffection.modid); //Effects public static final RegistryObject<Effect> LOVE_EFFECT = EFFECTS.register("love", () -> new ModEffect(EffectType.BENEFICIAL, 0xc98fff).addAttributesModifier(Attributes.field_233821_d_, "55FCED67-E92A-486E-9800-B47F202C4386", (double)0.34F, AttributeModifier.Operation.MULTIPLY_TOTAL)); //Potions public static final RegistryObject<Potion> LOVE = POTIONS.register("love", () -> new Potion(new EffectInstance(PotionList.LOVE_EFFECT.get(), 3600))); When I start the game, I get a NullPointerException because the registry object deepaffection:love is not present. The init() method get's during the instantiation of DeepAffection. Could you please tell me what I did wrong? -
Yes, that helped - thank you very much. Now my game is crashing because of a NullPointerException, but that is another issue
-
No, I did everything in Eclipse.
-
Hello, I have the above mentioned issue. Here is my log: [14Okt2020 21:43:49.779] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20200911.084530, --fml.mcVersion, 1.16.3, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 34.1.0, --version, MOD_DEV, --assetIndex, 1.16, --assetsDir, C:\Users\peers\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ????????, --userProperties, {}] [14Okt2020 21:43:49.844] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 7.0.1+78+master.e9771d8 starting: java version 1.8.0_201 by Oracle Corporation [14Okt2020 21:43:52.625] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust [14Okt2020 21:43:52.674] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.1 Source=file:/C:/Users/peers/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.1/3099ac85bce29d37a22d3561073d01eb99b0cf4b/mixin-0.8.1.jar Service=ModLauncher Env=CLIENT [14Okt2020 21:43:55.110] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevclient' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\peers\.gradle\caches\forge_gradle\assets, --assetIndex, 1.16, --username, Dev, --accessToken, ????????, --userProperties, {}] [14Okt2020 21:44:10.768] [Render thread/INFO] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService/]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD' [14Okt2020 21:44:10.885] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev [14Okt2020 21:44:11.237] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Backend library: LWJGL version 3.2.2 build 10 [14Okt2020 21:44:18.671] [modloading-worker-0/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 34.1.0, for MC 1.16.3 with MCP 20200911.084530 [14Okt2020 21:44:18.672] [modloading-worker-0/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v34.1.0 Initialized [14Okt2020 21:44:19.189] [Render thread/INFO] [deepaffection/]: Blocks registred. [14Okt2020 21:44:19.204] [Render thread/INFO] [deepaffection/]: Items registred. [14Okt2020 21:44:19.426] [Render thread/ERROR] [net.minecraft.util.Util/]: No data fixer registered for heart_entity [14Okt2020 21:44:19.428] [Render thread/ERROR] [net.minecraft.util.Util/]: No data fixer registered for shooting_star_entity [14Okt2020 21:44:21.967] [Render thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded [14Okt2020 21:44:22.149] [Render thread/INFO] [net.minecraft.resources.SimpleReloadableResourceManager/]: Reloading ResourceManager: Default, Mod Resources [14Okt2020 21:44:22.822] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: java.lang.reflect.InvocationTargetException [14Okt2020 21:44:22.822] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [14Okt2020 21:44:22.822] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [14Okt2020 21:44:22.822] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [14Okt2020 21:44:22.822] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at java.lang.reflect.Method.invoke(Unknown Source) [14Okt2020 21:44:22.822] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at peer.deepaffection.lists.PotionList.addMix(PotionList.java:28) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at peer.deepaffection.lists.PotionList.addBrewingRecipes(PotionList.java:35) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at peer.deepaffection.DeepAffection.setup(DeepAffection.java:80) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at net.minecraftforge.fml.ModContainer.lambda$null$4(ModContainer.java:112) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$5(ModContainer.java:112) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at java.util.concurrent.CompletableFuture$AsyncRun.exec(Unknown Source) [14Okt2020 21:44:22.823] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) [14Okt2020 21:44:22.824] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) [14Okt2020 21:44:22.824] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) [14Okt2020 21:44:22.824] [Worker-Main-4/INFO] [STDERR/]: [peer.deepaffection.lists.PotionList:addMix:30]: at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) [14Okt2020 21:44:22.824] [Worker-Main-4/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:-1]: Caused by: java.lang.NullPointerException [14Okt2020 21:44:22.824] [Worker-Main-4/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:-1]: at net.minecraft.potion.PotionBrewing$MixPredicate.<init>(PotionBrewing.java:222) [14Okt2020 21:44:22.824] [Worker-Main-4/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:-1]: at net.minecraft.potion.PotionBrewing.addMix(PotionBrewing.java:211) [14Okt2020 21:44:22.824] [Worker-Main-4/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:-1]: ... 19 more [14Okt2020 21:44:22.826] [Worker-Main-4/INFO] [deepaffection/]: Setup method registred. [14Okt2020 21:44:22.997] [Forge Version Check/INFO] [net.minecraftforge.fml.VersionChecker/]: [forge] Starting version check at https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [14Okt2020 21:44:23.811] [Forge Version Check/INFO] [net.minecraftforge.fml.VersionChecker/]: [forge] Found status: UP_TO_DATE Current: 34.1.0 Target: null [14Okt2020 21:44:32.567] [Worker-Main-8/INFO] [deepaffection/]: Entity render registerd. [14Okt2020 21:44:32.575] [Worker-Main-8/INFO] [deepaffection/]: clientRegistries method registred. [14Okt2020 21:44:33.588] [Worker-Main-6/ERROR] [net.minecraft.client.renderer.texture.AtlasTexture/]: Using missing texture, unable to load deepaffection:textures/item/nectar.png : java.io.FileNotFoundException: deepaffection:textures/item/nectar.png [14Okt2020 21:44:33.698] [Worker-Main-6/ERROR] [net.minecraft.client.renderer.texture.AtlasTexture/]: Using missing texture, unable to load deepaffection:textures/block/bellbird.png : java.io.FileNotFoundException: deepaffection:textures/block/bellbird.png [14Okt2020 21:44:33.749] [Worker-Main-6/ERROR] [net.minecraft.client.renderer.texture.AtlasTexture/]: Using missing texture, unable to load deepaffection:textures/item/bellbird.png : java.io.FileNotFoundException: deepaffection:textures/item/bellbird.png [14Okt2020 21:44:39.522] [Render thread/INFO] [net.minecraft.client.audio.SoundSystem/]: OpenAL initialized. [14Okt2020 21:44:39.524] [Render thread/INFO] [net.minecraft.client.audio.SoundEngine/SOUNDS]: Sound engine started [14Okt2020 21:44:40.124] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 1024x512x4 minecraft:textures/atlas/blocks.png-atlas [14Okt2020 21:44:40.582] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas [14Okt2020 21:44:40.584] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x512x4 minecraft:textures/atlas/banner_patterns.png-atlas [14Okt2020 21:44:40.594] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x512x4 minecraft:textures/atlas/shield_patterns.png-atlas [14Okt2020 21:44:40.612] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas [14Okt2020 21:44:40.625] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas [14Okt2020 21:44:40.640] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas [14Okt2020 21:44:41.882] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas [14Okt2020 21:44:41.895] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas [14Okt2020 21:44:41.898] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 128x128x0 minecraft:textures/atlas/mob_effects.png-atlas [14Okt2020 21:44:42.672] [Realms Notification Availability checker #1/INFO] [com.mojang.realmsclient.client.RealmsClient/]: Could not authorize you against Realms server: Invalid session id [14Okt2020 21:45:40.986] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498] [14Okt2020 21:45:40.988] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0] [14Okt2020 21:45:40.989] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0] [14Okt2020 21:45:40.990] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498] [14Okt2020 21:45:40.992] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0] [14Okt2020 21:45:40.996] [Render thread/INFO] [net.minecraft.resources.SimpleReloadableResourceManager/]: Reloading ResourceManager: Default, main, forge-1.16.3-34.1.0_mapped_snapshot_20200514-1.16-recomp.jar As you can see, the launcher catches an InvocationTargetException in my PotionList class, but my class looks like this: package peer.deepaffection.lists; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.Attributes; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.potion.Effect; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectType; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionUtils; import net.minecraft.potion.Potions; import net.minecraftforge.common.brewing.BrewingRecipeRegistry; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import peer.deepaffection.DeepAffection; public class PotionList { public static Potion love_potion; public static Effect love_effect; public static void addBrewingRecipes() { System.out.println("PotionList: Brewing Recipes called."); BrewingRecipeRegistry.addRecipe(Ingredient.fromStacks(PotionUtils.addPotionToItemStack(ItemStack.EMPTY, Potions.AWKWARD)), Ingredient.fromStacks(new ItemStack(ItemList.nectar)), PotionUtils.addPotionToItemStack(ItemStack.EMPTY, PotionList.love_potion)); } public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTION_TYPES, DeepAffection.modid); public static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, DeepAffection.modid); //Potions public static final RegistryObject<Potion> LOVE = POTIONS.register("love", () -> new Potion(new EffectInstance(PotionList.love_effect, 3600))); //Effects public static final RegistryObject<Effect> LOVE_EFFECT = EFFECTS.register("love", () -> new ModEffect(EffectType.BENEFICIAL, 0xc98fff).addAttributesModifier(Attributes.field_233821_d_, "55FCED67-E92A-486E-9800-B47F202C4386", (double)0.34F, AttributeModifier.Operation.MULTIPLY_TOTAL)); public static void init (){ EFFECTS.register(FMLJavaModLoadingContext.get().getModEventBus()); POTIONS.register(FMLJavaModLoadingContext.get().getModEventBus()); PotionList.addBrewingRecipes(); } public static class ModEffect extends Effect{ public ModEffect(EffectType typeIn, int liquidColorIn) { super(typeIn, liquidColorIn); } } } Yes, I'm pretty sure the register part isn't right yet, but the main problem is that the code that causes the exception isn't even there anymore. I deleted it a while ago. To be precise: Since this exception first occured, it seems like nothing I'm coding get's added to the mod. I already tried refreshing and gradlew Eclipse but nothing works. Also, everytime I want to execute the launcher, Eclipse tells me that there are errors existing in the project but there are no errors anywhere. I would appreciate your help and thank you in advance. Stay healthy
-
[1.16.3] How to create a custom potion with a custom effect?
Peerius replied to Peerius's topic in Modder Support
Okay and how can I transfer specific potions into ItemStacks? -
Hello, I tried to create a custom potion with a custom effect and looked at the vanilla code. Someone on YouTube also tried that and used invoke to make a private method accessable. Here is the code: private static void addMix(Potion start, Item ingredient, Potion result) { if(brewing_mixes == null) { brewing_mixes = ObfuscationReflectionHelper.findMethod(PotionBrewing.class, "addMix", Potion.class, Item.class, Potion.class); brewing_mixes.setAccessible(true); } try { brewing_mixes.invoke(null, start, ingredient, result); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } } public static void addBrewingRecipes() { addMix(Potions.AWKWARD, ItemList.nectar, PotionList.love_potion); } public static class ModEffect extends Effect{ public ModEffect(EffectType typeIn, int liquidColorIn) { super(typeIn, liquidColorIn); } } The addBrewingRecipes() method get's called during the FMLCommonSetupEvent. But there is something wrong with it, because the invoke method throws an InvocationTargetException. So I guess I need to try it differently. Could someone please give me a hint where I have to start? Thanks in advance and stay healthy.
-
[1.16.3] Custom Flower Generation In Vanilla Biomes
Peerius replied to Peerius's topic in Modder Support
Okay. Do I have to register my ConfiguredFeature somewhere else or am I able to use it without registering? -
Hello, I have problems updating my flower generation to 1.16.3. As already mentioned in the topic, I want to make my custom flower generate in some vanilla biomes. Here is my code: public static void setupFlowerGeneration() { for(Biome biome: ForgeRegistries.BIOMES) { if(biome==ForgeRegistries.BIOMES.getValue(new ResourceLocation("savanna"))){ BiomeGenerationSettings.Builder GENERATION_SETTINGS = (new BiomeGenerationSettings.Builder()).func_242519_a(biome.func_242440_e().func_242500_d()); GENERATION_SETTINGS.func_242513_a(GenerationStage.Decoration.VEGETAL_DECORATION, BiomeFeatures.HEART_FLOWER); } } } My BiomeFeatures.HEART_FLOWER looks like this: public static final ConfiguredFeature<?, ?> HEART_FLOWER = register("heart_flower", Feature.RANDOM_PATCH.withConfiguration((new BlockClusterFeatureConfig.Builder((new WeightedBlockStateProvider()).addWeightedBlockstate(BlockList.heart_flower.getDefaultState(), 2), new SimpleBlockPlacer())).tries(64).build()).withPlacement(Placement.TOP_SOLID_HEIGHTMAP.configure(new NoPlacementConfig()))); private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String key, ConfiguredFeature<FC, ?> feature) { return Registry.register(WorldGenRegistries.field_243653_e, new ResourceLocation(DeepAffection.modid, key), feature); } I also already tested: The setupFlowerGeneration() method gets called and also the if gets called, but somehow my flowers don't generate. By the way - I can see on github of other people that their methods have clear names while mine always only have those func_1231411513 names. Does anyone know why I have this? I hope someone can help me - Thank you in advance.
-
Hello, I wanted to let my custom flowers generate in vanilla biomes, but I don't know how to do it anymore. Here is the code I used in 1.16.1, which worked fine: public class FlowerGeneration { public static void setupFlowerGeneration() { BlockState state_heart = BlockList.heart_flower.getDefaultState(); BlockState state_sun = BlockList.sun_flower.getDefaultState(); BlockClusterFeatureConfig HEART_FLOWER_CONFIG = (new BlockClusterFeatureConfig.Builder((new WeightedBlockStateProvider()).addWeightedBlockstate(state_heart, 2), new SimpleBlockPlacer())).tries(64).build(); BlockClusterFeatureConfig SUN_FLOWER_CONFIG = (new BlockClusterFeatureConfig.Builder((new WeightedBlockStateProvider()).addWeightedBlockstate(state_sun, 2), new SimpleBlockPlacer())).tries(64).build(); for(Biome biome: ForgeRegistries.BIOMES) { if(biome==Biomes.SAVANNA||biome==Biomes.SAVANNA_PLATEAU||biome==Biomes.SUNFLOWER_PLAINS||biome==Biomes.FLOWER_FOREST||biome==Biomes.MOUNTAIN_EDGE||biome==Biomes.MOUNTAINS||biome==Biomes.WOODED_HILLS||biome==Biomes.WOODED_MOUNTAINS||biome==Biomes.PLAINS||biome==Biomes.FOREST||biome==Biomes.BIRCH_FOREST||biome==Biomes.BIRCH_FOREST_HILLS||biome==Biomes.DARK_FOREST||biome==Biomes.DARK_FOREST_HILLS) { biome.addFeature(Decoration.VEGETAL_DECORATION, Feature.FLOWER.withConfiguration(HEART_FLOWER_CONFIG).withPlacement(Placement.COUNT_HEIGHTMAP_32.configure(new FrequencyConfig(2)))); } if(biome == Biomes.PLAINS|| biome == Biomes.SUNFLOWER_PLAINS || biome == Biomes.BAMBOO_JUNGLE || biome == Biomes.BAMBOO_JUNGLE_HILLS || biome == Biomes.JUNGLE || biome == Biomes.JUNGLE_EDGE || biome == Biomes.JUNGLE_HILLS || biome == Biomes.MODIFIED_JUNGLE || biome == Biomes.MODIFIED_JUNGLE_EDGE) { biome.addFeature(Decoration.VEGETAL_DECORATION, Feature.FLOWER.withConfiguration(SUN_FLOWER_CONFIG).withPlacement(Placement.COUNT_HEIGHTMAP_32.configure(new FrequencyConfig(2)))); } } } } Now I got two problems: 1st the Biomes.BIOME expression gives me a RegistryKey<Biome> instead of a Biome and 2nd addFeature(...) method from the class Biome doesn't seem to exist anymore. I read through the Biome, Biomes and RegistryKey classes and some more, but I didn't find anything helpful. I would appreciate it, if someone could tell me, what I have to use. Thank you in advance.
-
Hello, I have a little problem concerning my ProjectileItemEntity. I made a new Item overriding the onItemRightClick method, where a new Entity should be spawned and shooted like a snowball, but at the current stage the Entity always flys in the same direction. The flying itself works perfectly, only the direction is wrong. Here is my code for the item: @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); Vector3d look = playerIn.getLookVec(); HeartEntity heart = new HeartEntity(1.0D,1.0D,1.0D,worldIn); heart.setPosition(playerIn.lastTickPosX + look.x , playerIn.lastTickPosY + look.y + 1, playerIn.lastTickPosZ + look.z); Vector3d vec3d = heart.getMotion(); double d0 = heart.getPosX() + vec3d.x; double d1 = heart.getPosY() + vec3d.y; double d2 = heart.getPosZ() + vec3d.z; worldIn.addParticle(ParticleTypes.HEART, d0 - vec3d.x * 0.25D, d1 - vec3d.y * 0.25D, d2 - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z); heart.setShooter(playerIn); heart.shoot(heart.getPosX(), heart.getPosY(), heart.getPosZ(), playerIn.rotationYaw, playerIn.rotationPitch); if (!worldIn.isRemote) { worldIn.addEntity(heart); if(!playerIn.isCreative()) { stack.shrink(1); } } worldIn.playSound(playerIn, new BlockPos(playerIn.getPositionVec()), SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.PLAYERS,1.0f,1.0f); return new ActionResult<ItemStack>(ActionResultType.SUCCESS, stack); } I hope that somebody can help me and thank you in advance.
-
Still needing help with this
-
For now, I have this: public class ShootingStarRenderer extends SpriteRenderer<ShootingStarEntity> { protected ShootingStarRenderer(EntityRendererManager renderManager, ItemRenderer itemRenderer) { super(renderManager, itemRenderer); } @Override public ResourceLocation getEntityTexture(ShootingStarEntity entity) { return DeepAffection.RegistryEvents.location("textures/entity/star.png"); } private void add(IVertexBuilder renderer, MatrixStack stack, float x, float y, float z, float u, float v) { renderer.pos(stack.getLast().getMatrix(), x, y, z) .color(1.0f, 1.0f, 1.0f, 1.0f) .tex(u, v) .normal(1, 0, 0) .endVertex(); } @Override public void render(ShootingStarEntity entity, float f1, float f2, MatrixStack stack, IRenderTypeBuffer buffer, int i1) { super.render(entity, f1, f2, stack, buffer, i1); IVertexBuilder builder = buffer.getBuffer(RenderType.getEntityGlint()); if(!entity.collided) { }else { stack.push(); AtlasTexture star = new AtlasTexture(DeepAffection.RegistryEvents.location("textures/entity/star")); TextureAtlasSprite sprite = star.getSprite(DeepAffection.RegistryEvents.location("textures/entity/star")); stack.translate(0.5, 0.5, 0.5); add(builder, stack, 0.0f, 0.0f, 0.0f, sprite.getMinU(), sprite.getMinV()); add(builder, stack, 1.0f, 0.0f, 0.0f, sprite.getMaxU(), sprite.getMinV()); add(builder, stack, 0.0f, 1.0f, 0.0f, sprite.getMinU(), sprite.getMaxV()); add(builder, stack, 1.0f, 1.0f, 0.0f, sprite.getMaxU(), sprite.getMaxV()); stack.pop(); } } I just picked some floats for the add method, so that I could look how it looks like. But when summoning the entity, the game crashes after it collided because of a NullPointerException from the line where the add method get's called the first time. I would guess that sprite equals null, but I don't know how to fix that.
-
Bump.
-
Hello So, I wanted to make a shooting star similar to the one from the LegendGear Mod by NMcCoy. If someone doesn't know, how those look like, you can see it for example in this video: https://youtu.be/PSIjNFwPDfk?t=565 at 9:25. Now, I created a new ProjectileItemEntity, which works perfectly fine and renders as normal. I got only two issues left: The first one is, that my entity doesn't have a beam and this star looking spinning thing around my entity yet. I came across TileEntities, but those are only for blocks if I got that right. So, I thought of implementing it with extending the SpriteRenderer, overriding the render(...) method, calling super.render(...); and adding this there. But since those classes and methods for rendering don't seem like they are self-explanatory, I don't know how to do it. For now, I only have a white texture for the beam and the star, which I would like to switch colors. And my second one is naturally spawning my entity. I came across EntitySpawnPlacementRegistry.register(...) but I don't know how to create an EntitySpawnPlacementRegistry.IPlacementPredicate and it looked like in vanilla this code is only used for MobEntities. Obviously, I also want to make my entity spawn in the air, maybe like 30 blocks above ground level. I am grateful for any help. Thank you in advance.
-
[1.15.2] Adding a particle track to my ProjectileItemEntity
Peerius replied to Peerius's topic in Modder Support
That fixed everything, thank you! -
[1.15.2] Adding a particle track to my ProjectileItemEntity
Peerius replied to Peerius's topic in Modder Support
I guess it's because of a wrong registration. This is where I register my entity currently: public class RegistryHandler { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, DeepAffection.modid); public static void init(){ ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static final RegistryObject<EntityType<HeartEntity>> HEART_ENTITY = ENTITY_TYPES.register("heart_entity", () -> EntityType.Builder.<HeartEntity>create(EntityClassification.MISC).size(0.5F, 0.5F).build("heart_entity")); } But I read in other posts that the register part should somehow look like this: public static final RegistryObject<EntityType<HeartEntity>> HEART_ENTITY = ENTITY_TYPES.register("heart_entity", () -> EntityType.Builder.create(HeartEntity::new, EntityClassification.MISC).size(0.5F, 0.5F).build("heart_entity")); However this doesn't works like I thought it would.. In the create method part I get the error: "Cannot infer type argument(s) for <T> create(EntityType.IFactory<T>, EntityClassification)" and in the HeartEntity::new part I get: "The type HeartEntity does not define HeartEntity(EntityType<Entity>, World) that is applicable here" What have I done wrong? In other posts in this forum it seems like it worked like this... -
[1.15.2] Adding a particle track to my ProjectileItemEntity
Peerius replied to Peerius's topic in Modder Support
Okay, but then it seems like it's never true, because the code inside of the if(...) doesn't get called. -
[1.15.2] Adding a particle track to my ProjectileItemEntity
Peerius replied to Peerius's topic in Modder Support
And how do I change that? -
[1.15.2] Adding a particle track to my ProjectileItemEntity
Peerius replied to Peerius's topic in Modder Support
Just found it there in my documents.. but it's also there. Changed it now. -
[1.15.2] Adding a particle track to my ProjectileItemEntity
Peerius replied to Peerius's topic in Modder Support
Sorry, forgot to upload that.. Strange that it worked for me without that