Jump to content

Shield model not rendering properly (1.16.5)


Leronus

Recommended Posts

Using ShieldBaseModel from vanilla, I have added a copper shield with the exact same model as the vanilla item.

It renders properly when holding it, but it doesn't properly go up when blocking with the shield. 

It's also slightly rotated when I look at the player in third person mode.

I can't figure out where the mistake lies, any help would be greatly appreciated.

I am modding with Forge 36.2.6 for Minecraft 1.16.5

 

GitRepo: https://github.com/Leronus/mOres

 

Classes used:

src/main/java/mod/mores/client/entity/model/ModelHandler.java 

src/main/java/mod/mores/client/entity/render/ShieldTileEntityRenderer.java

src/main/java/mod/mores/client/entity/ShieldTextures.java

src/main/java/mod/mores/init/ItemInit.java

src/main/java/mod/mores/objects/ItemShield.java

 

https://imgshare.io/image/pFTDBO

https://imgshare.io/image/pFTtc9

Link to comment
Share on other sites

30 minutes ago, Luis_ST said:

that's not a answer to my question 

Your question was and I quote "did you looked at vanilla?"

This can be interpreted in many ways, but I'm guessing that you meant "did you look at the vanilla source code for the shield?"

If that is in fact what you meant, I answered with "yes I did." 

I believe that suffices as an answer to your question but please correct me if I'm wrong.

In conclusion, I still don't see how a single annotation in a class used for saving the ResourceLocation of my shield textures impacts the way the model is rendered when blocking with the shield...

Edited by Leronus
Link to comment
Share on other sites

7 hours ago, Luis_ST said:

no, it's an error in your json models check them or use the vanilla one for testing

I have updated the json models. The blocking is now registering properly in third person mode, however when just holding the shield it is still slightly rotated.

It also appears to be rendering the blocking shield permanently in first person mode. Even when not actually blocking.

Any ideas what might be the cause?

Edited by Leronus
Link to comment
Share on other sites

your copper shield json "extends" your wood shield, inside i found this error:

  1. wood_shield, line 17, translation y should be 2
  2. wood_shield, line 22, translation y should be -2
  3. wood_shield_blocking, line 17, translation y should be 5
  4. wood_shield_blocking, line 22, translation y should be 5

i'm not sure if this values cause the error but you can change them and test again

  • Thanks 1
Link to comment
Share on other sites

38 minutes ago, Luis_ST said:

your copper shield json "extends" your wood shield, inside i found this error:

  1. wood_shield, line 17, translation y should be 2
  2. wood_shield, line 22, translation y should be -2
  3. wood_shield_blocking, line 17, translation y should be 5
  4. wood_shield_blocking, line 22, translation y should be 5

i'm not sure if this values cause the error but you can change them and test again

Yeah that was my old model, I have since committed and pushed the new models, where new problems arise

Link to comment
Share on other sites

Copper shield - Not blocking - Third Person (does not work as intended)

https://imgshare.io/image/pFofW8

Vanilla shield - Not blocking - Third Person
https://imgshare.io/image/pFozKw

Copper shield - Blocking - Third Person (works as intended)
https://imgshare.io/image/pFoBOK

Vanilla shield - Blocking - Third Person
https://imgshare.io/image/pFo1FS

Vanilla shield - Not blocking - First Person
https://imgshare.io/image/pFogUj

Copper shield - Not blocking - First Person (does not work as intended, is being rendered as "blocking")
https://imgshare.io/image/pFtrH6

Copper shield - Blocking - First Person (works as intended)
https://imgshare.io/image/pFtNwe

Vanilla shield - Blocking - First Person
https://imgshare.io/image/pFtpIy

Link to comment
Share on other sites

2 hours ago, Luis_ST said:

after use debugger in your repo i found the error:
that's your error compare this with the vanilla ItemModelProperty for the Shield

it should be:

  Hide contents
(stack, world, entity) -> entity != null && entity.isUsingItem() && entity.getUseItem() == stack ? 1.0F : 0.0F

 

Bro I thought it was that statement too, back in 1.16.3 it was entity.IsHandActive(), but I couldn't find the right replacement. Apparently it's isUsingItem() as you said

Thanks a lot man!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

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