Drachenbauer Posted December 21, 2020 Posted December 21, 2020 (edited) Hello i just cheated a pyramid-shaped umbrella in blender. I also fitted it´s uv-mat to a minecraft-like texture. Now i have the model as .blend and .obj-file and the texture as .png-file. How can i use this umbrella as an item in a minecraft-mod? Can i export it as .json? . Edited December 21, 2020 by Drachenbauer Quote
ChampionAsh5357 Posted December 21, 2020 Posted December 21, 2020 Forge supports using obj models inside of minecraft. You can view the supported model loaders via ModelLoaderRegistry. Quote
Drachenbauer Posted December 21, 2020 Author Posted December 21, 2020 (edited) if i make an item-class for the umbrella, what must i put into it to use an .obi-modelloader insted of the normal json stuff? And where in the ressource-folders must i place my obj-model and it´s textures? Now i have got the basic mod setup with 16 items for different colored umbrellas registered. And i have .obj-models and .png-textures for all 16 colors in the resource-folders. how do i now load the models into the items? And how can i control, how such an item looks in an inventory-slot, thrown on the ground, pinned in an item-frame and equipped in first and third person view? Edited December 22, 2020 by Drachenbauer Quote
TheGreyGhost Posted December 22, 2020 Posted December 22, 2020 Howdy There are some examples of Wavefront in in this tutorial project see mbe21 (tileentity) and mbe81 (entity and item) https://github.com/TheGreyGhost/MinecraftByExample -TGG mbe21: mbe81: Quote
TheGreyGhost Posted December 22, 2020 Posted December 22, 2020 On 12/22/2020 at 10:49 AM, diesieben07 said: A TESR is not necessary for rendering OBJs. Expand That is true, but if DrachenBauer wants this Quote And how can i control, how such an item looks in an inventory-slot, thrown on the ground, pinned in an item-frame and equipped in first and third person view? Expand then (s)he may need to use an ItemStackTileEntityRenderer. mbe81 uses item json for wavefront rendering (no TER), eg mbe81b_boomerang_registry_name.json { "loader": "forge:obj", "model" : "minecraftbyexample:models/entity/mbe81b_boomerang.obj", "flip-v": true, "detectCullableFaces": false, "diffuseLighting": true, "ambientToFullbright": false, "materialLibraryOverride": "minecraftbyexample:models/entity/mbe81b_boomerang.mtl", "__comment": "flip-v may be required if your texture appears mirrored. See OBJloader::read() for other flags. currently the available options are", "__comment1": "detectCullableFaces (default true) = try to convert faces to Directional Quads (EAST, WEST, etc) instead of just general quads", "__comment2": "diffuseLighting (default false) = attempt to apply the direction-dependent lighting as per vanilla blocks. Currently does nothing.", "__comment3": "flipV (default false) = mirror the texture sheet top-->bottom (if your textures appear upside-down)", "__comment4": "ambientToFullbright (default true) = always render at maximum world illumination (combinedLight) regardless of the actual skylight or blocklight present", "__comment5": "materialLibraryOverrideLocation (default null) = use this path/filename for the material library file .mtl", "display": { "thirdperson_righthand": { "rotation": [ 180, 0, 90 ], "translation": [ 0.00, 3.50, -1.75 ], "scale": [ 0.04, 0.04, 0.04] }, "thirdperson_lefthand": { "rotation": [ 90, 0, 90 ], "translation": [ 0.00, 3.50, -1.75 ], "scale": [ 0.04, 0.04, 0.04] }, "firstperson_righthand": { "rotation": [ 188, 0, 90 ], "translation": [ 0.00, 5.25, -2.25 ], "scale": [ 0.05, 0.05, 0.05] }, "firstperson_lefthand": { "rotation": [ 90, 0, 90 ], "translation": [ 0.00, 5.25, -2.25 ], "scale": [ 0.05, 0.05, 0.05] }, "gui": { "rotation": [ 82, 0, 0 ], "translation": [ 0.75, -1.00, 0.00 ], "scale": [ 0.06, 0.06, 0.06] }, "head": { "rotation": [ 0, 0, 0 ], "translation": [ 0.00, 0.00, 0.00 ], "scale": [ 0.05, 0.05, 0.05] }, "fixed": { "rotation": [ 270, 162, 0 ], "translation": [ 0.00, 0.00, 0.25 ], "scale": [ 0.06, 0.06, 0.06] }, "ground": { "rotation": [ 90, 278, 0 ], "translation": [ 0.00, 9.00, 0.00 ], "scale": [ 0.05, 0.05, 0.05] } } } Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 (edited) In blender my model has the size of 1m x 1m x 1m is this one block in minecraft? if yes, then i have the right display-values now. Edited December 22, 2020 by Drachenbauer Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 (edited) As i thested it, i got this error: Quote java.util.concurrent.CompletionException: net.minecraft.util.ResourceLocationException: Non [a-z0-9_.-] character in namespace of location: D:\\Mods\\1_15_1\\UmbrellaMod\\src\\main\\resources\\assets\\umbrellamod\\textures\\model\\black_umbrella.png Expand and it was stuck in a circle of crashing and reloading. But i see nothing uppercase or other stuff after the folder "src"... Edited December 22, 2020 by Drachenbauer Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 (edited) Quote [m[36m[15:57:25] [Render thread/DEBUG] [ne.mi.fm.cl.ClientModLoader/CORE]: Generating PackInfo named mod:umbrellamod for mod file D:\Mods\1_15_1\UmbrellaMod\bin\main [m[36m[15:57:25] [Render thread/DEBUG] [ne.mi.fm.cl.ClientModLoader/CORE]: Generating PackInfo named mod:forge for mod file C:\Users\Besitzer\.gradle\caches\forge_gradle\minecraft_user_repo\net\minecraftforge\forge\1.15.2-31.1.18_mapped_snapshot_20200312-1.15.1\forge-1.15.2-31.1.18_mapped_snapshot_20200312-1.15.1-recomp.jar [m[32m[15:57:25] [Render thread/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, Mod Resources [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.fm.co.ConfigTracker/CONFIG]: Loading configs type CLIENT [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.fm.co.ConfigTracker/CONFIG]: Loading config file type CLIENT at forge-client.toml for forge [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.fm.co.ConfigFileTypeHandler/CONFIG]: Built TOML config for D:\Mods\1_15_1\UmbrellaMod\run\config\forge-client.toml [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.fm.co.ConfigFileTypeHandler/CONFIG]: Loaded TOML config file D:\Mods\1_15_1\UmbrellaMod\run\config\forge-client.toml [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.fm.co.ConfigFileTypeHandler/CONFIG]: Watching TOML config file D:\Mods\1_15_1\UmbrellaMod\run\config\forge-client.toml for changes [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.co.ForgeConfig/FORGEMOD]: Loaded forge config file forge-client.toml [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.fm.co.ConfigTracker/CONFIG]: Loading configs type COMMON [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.fm.ModList/LOADING]: Dispatching parallel event LifecycleEvent:COMMON_SETUP [m[36m[15:57:25] [Server-Worker-15/DEBUG] [ne.mi.fm.ModList/LOADING]: Dispatching parallel event LifecycleEvent:SIDED_SETUP [m[32m[15:57:29] [Render thread/INFO] [minecraft/Minecraft]: Caught error loading resourcepacks, removing all selected resourcepacks java.util.concurrent.CompletionException: net.minecraft.util.ResourceLocationException: Non [a-z0-9_.-] character in namespace of location: D:\\Mods\\1_15_1\\UmbrellaMod\\src\\main\\resources\\assets\\umbrellamod\\textures\\model\\black_umbrella.png at java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source) ~[?:1.8.0_271] {} at java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source) ~[?:1.8.0_271] {} at java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) ~[?:1.8.0_271] {} at java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source) ~[?:1.8.0_271] {} at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) ~[?:1.8.0_271] {} at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) ~[?:1.8.0_271] {} at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) ~[?:1.8.0_271] {} at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) ~[?:1.8.0_271] {} Caused by: net.minecraft.util.ResourceLocationException: Non [a-z0-9_.-] character in namespace of location: D:\\Mods\\1_15_1\\UmbrellaMod\\src\\main\\resources\\assets\\umbrellamod\\textures\\model\\black_umbrella.png at net.minecraft.util.ResourceLocation.<init>(ResourceLocation.java:28) ~[?:?] {re:classloading} at net.minecraft.util.ResourceLocation.<init>(ResourceLocation.java:35) ~[?:?] {re:classloading} at net.minecraftforge.client.model.ModelLoaderRegistry.blockMaterial(ModelLoaderRegistry.java:167) ~[?:?] {re:classloading} at net.minecraftforge.client.model.ModelLoaderRegistry.resolveTexture(ModelLoaderRegistry.java:162) ~[?:?] {re:classloading} at net.minecraftforge.client.model.obj.OBJModel$ModelObject.lambda$getTextures$0(OBJModel.java:548) ~[?:?] {re:classloading} at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_271] {} at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[?:1.8.0_271] {} at net.minecraftforge.client.model.obj.OBJModel$ModelObject.getTextures(OBJModel.java:548) ~[?:?] {re:classloading} at net.minecraftforge.client.model.obj.OBJModel$ModelGroup.getTextures(OBJModel.java:579) ~[?:?] {re:classloading} at net.minecraftforge.client.model.geometry.IMultipartModelGeometry.getTextures(IMultipartModelGeometry.java:57) ~[?:?] {re:classloading} at net.minecraftforge.client.model.BlockModelConfiguration.getTextureDependencies(BlockModelConfiguration.java:151) ~[?:?] {re:classloading} at net.minecraft.client.renderer.model.BlockModel.getTextures(BlockModel.java:157) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.model.ModelBakery.lambda$processLoading$9(ModelBakery.java:199) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at java.util.stream.ReferencePipeline$7$1.accept(Unknown Source) ~[?:1.8.0_271] {} at java.util.HashMap$ValueSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_271] {} at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[?:1.8.0_271] {} at net.minecraft.client.renderer.model.ModelBakery.processLoading(ModelBakery.java:200) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraftforge.client.model.ModelLoader.<init>(ModelLoader.java:72) ~[?:?] {re:classloading} at net.minecraft.client.renderer.model.ModelManager.prepare(ModelManager.java:58) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.model.ModelManager.prepare(ModelManager.java:19) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.resources.ReloadListener.lambda$reload$0(ReloadListener.java:12) ~[?:?] {re:classloading} ... 6 more Expand this circled again and again. It seems like, it´s because of the absolute path in the .mtl-file if my model. what kind of path must be used there? I´m not sore, if the way, how it´s written in the json-files is compatible with .mtl... Edited December 22, 2020 by Drachenbauer Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 how do i write the texture reference right? Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 (edited) Now i schanged my .mtl files to this: # Blender MTL File: 'Umbrella.blend' # Material Count: 1 newmtl Material Ns 225.000000 Ka 1.000000 1.000000 1.000000 Kd 0.800000 0.800000 0.800000 Ks 0.500000 0.500000 0.500000 Ke 0.0 0.0 0.0 Ni 1.450000 d 1.000000 illum 2 map_Kd umbrellamod:model/black_umbrella It´s the same path-style as for the boomerang in the examples mod. But i still get sometimes this error but sometimes i can enter the game, but the umbrellas have the black and purple error-texture... Edit: now it works. maybe it just needed some refreshes... Edited December 22, 2020 by Drachenbauer Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 How can i make the arm point horizontally forward, if holding an umbrella? Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 third person. im first person the umbrella is already positioned correctly. Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 now i creadtd a model for closed umbrella, how can i make one click on the equipped umbrella opens it and another click closes it? And how can i make slow falling and soft landing while the umbrella is open Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 Now i added a set of closed umbrellas. how do i now make the change on rightclick? Quote
Drachenbauer Posted December 22, 2020 Author Posted December 22, 2020 for slow falling, i added private static final UUID SLOW_FALLING_ID = UUID.fromString("A5B6CF2A-2F7C-31EF-9022-7C3E7D5E6ABA"); private static final AttributeModifier SLOW_FALLING = new AttributeModifier(SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION).setSaved(false); public static final net.minecraft.entity.ai.attributes.IAttribute ENTITY_GRAVITY = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.entity_gravity", 0.08D, -8.0D, 8.0D).setShouldWatch(true); above the constructor in the UmbrellaItem class and IAttributeInstance gravity = player.getAttribute(ENTITY_GRAVITY); gravity.applyModifier(SLOW_FALLING); player.fallDistance = 0.0F; in "onUsingTick". but falling is as fast as normal and i see the collison-particles on landing. Must i place the lines in the seccond code-snippet into another method? Quote
Drachenbauer Posted December 23, 2020 Author Posted December 23, 2020 (edited) i thaught, this is the way to add a modifyer... You told me to look in Entity living. And i thaught, this is the way, it is used there. in the sword i founf this: public Multimap<String, AttributeModifier> getAttributeModifiers(EquipmentSlotType equipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(equipmentSlot); if (equipmentSlot == EquipmentSlotType.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double)this.attackDamage, AttributeModifier.Operation.ADDITION)); multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double)this.attackSpeed, AttributeModifier.Operation.ADDITION)); } return multimap; } but in "SharedMonsterAttributes" i cannot find the "ENTITY_GRAVITY" attribute. So how els can i put this attribute there? If i replace "SharedMonsterAttributes" with "ForgeMod", it also cannot find "ENTITY_GRAVITY" in there... The only appearens of "ENTITY_GRAVITY", that i can find, is in "LivingEntity" Edited December 23, 2020 by Drachenbauer Quote
Drachenbauer Posted December 23, 2020 Author Posted December 23, 2020 (edited) if i open this ForgeMod Class fron the Reference Libraries in my ide it does not contain theese lines, that are highlighted in your link. Maybe its added there since 1.16... Is it anywhere else in 1.15? Edited December 23, 2020 by Drachenbauer Quote
Drachenbauer Posted December 23, 2020 Author Posted December 23, 2020 I try to use this: public Multimap<String, AttributeModifier> getAttributeModifiers(EquipmentSlotType equipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(equipmentSlot); if (equipmentSlot == EquipmentSlotType.MAINHAND) { multimap.put(LivingEntity.ENTITY_GRAVITY.getName(), new AttributeModifier(LivingEntity.SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION).setSaved(false)); } return multimap; } But i still have a problem with this line: multimap.put(LivingEntity.ENTITY_GRAVITY.getName(), new AttributeModifier(LivingEntity.SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION).setSaved(false)); i cannot use LivingEntity.SLOW_FALLING_ID, because it´s private So i tryed this: multimap.put(LivingEntity.ENTITY_GRAVITY.getName(), LivingEntity.SLOW_FALLING); But LivingEntity.SLOW_FALLING is also private. what is the right setup for this line? Quote
Drachenbauer Posted December 23, 2020 Author Posted December 23, 2020 (edited) How do i make my own modifyer? I want it exactly the same as the existing slow falling effect. Some posts ago you told me, copying the stuff from LivingEntity is not the right way. Edited December 23, 2020 by Drachenbauer Quote
Drachenbauer Posted December 23, 2020 Author Posted December 23, 2020 are there any rules for this id? Quote
Drachenbauer Posted December 23, 2020 Author Posted December 23, 2020 (edited) In the existing one letters where uppercase, in the one from the page, letters are lowercase. Does this matter? And i cannot find infos about what to use instead of "getAttributeModifiers", that is deprecated Edited December 23, 2020 by Drachenbauer Quote
Drachenbauer Posted December 23, 2020 Author Posted December 23, 2020 I cannot find a replacement for the deprecated "getAttributeModifiers". i see nothing else about attributes there. Quote
Drachenbauer Posted December 23, 2020 Author Posted December 23, 2020 i added an itemstack-argument to the method and it´s super-call and now the warning is gone. and the slow falling works now. Quote
Drachenbauer Posted December 26, 2020 Author Posted December 26, 2020 (edited) https://www.youtube.com/watch?v=6te-IdUIBdY here he hoints his arm up while holding an umbrella.at the end of the video. but there in no link to the mod with the umbrella... I notived, i fall slower with the umbrella, bot still get a tiny little bit of damage on landing. How to remove the fall damage compleetely, if holding that item? Edit: i canceled the LivingFallEvent, if holding the umbrella. Now i can jump from as high as i want with the umbrella without being damaged. Edited December 27, 2020 by Drachenbauer Quote
Drachenbauer Posted January 8, 2021 Author Posted January 8, 2021 (edited) I noticed, that i can jump higher, if holding this umbrella. Than i saw a video of someone, who made a tower of scaffolding, placed a cage of scaffolfing ontop and filled it with chckens. Then he removed the bottom scaffolding and the chickens fell down slowly and took no damage at landing on the ground. how can i attach this exact behavior to my umbrella? In the ChickenEntitx-Class i find just this: public boolean onLivingFall(float distance, float damageMultiplier) { return false; } But nothing about the falling-speed. Edited January 8, 2021 by Drachenbauer Quote
Recommended Posts
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.