Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Skyriis

Members
  • Posts

    102
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Germany

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Skyriis's Achievements

Creeper Killer

Creeper Killer (4/8)

2

Reputation

  1. Hey Guys, i would love to create an animated obj model for my BlockEntity. I already know how to create and use obj models but i got no idea how to use animations with them. I would really appreciate help.
  2. you should be able to set the claimable chunks for default user to 0 but the user will always be able to activate the minimap back if you disable it
  3. i would really appreciate help on this. i just can't figure out how to deobf my api module / prevent the api module from being obfuscated in the dev env.
  4. Have you registered your class as EventBusSubscriber on the correct bus?
  5. Hello there, i'm trying to create a multi module project with 3 modules (1 library mod, 2 mod which depend on that libray). The library module works just fine but the other 2 throws a NoSuchFieldError when running the client in the dev env. How do i setup my depencies on those 2 projects to fix that?
  6. Hey Guys, i would love to create a dimension which generates a structure (which is kinda large) for a each player which joins that dimension and teleports the player to the start if that structure. If the player has left the structure it'll be deleted so another player will be able to generate a new structure there. Now my Questions: How do i create a void dimention? How do i generate a large structure? How do i generate that large structure to a position where no other structure is? How do i delete that structure if no player is on it (with a 5 min delay)?
  7. I tried -45, -180, 180, 90. Could it be possible that the arm isn't moving but the item in the hand still translates to the point where the player hand would be?
  8. by multiplying the poseStack with Vector3f.ZP.rotationDegrees(-itemTransform.rotation.z())
  9. Changing (translating) the position to where i want isn't the problem. That works like it should but the rotation of the item in the hand isn't. Like i've mentioned here. I still haven't figured out how to avoid the item to rotate on the z-axe. The weird thing is that i can rotate it on X and Y but not on Z
  10. I'm still looking for the method which rotates the item. #Edit 1 The only rotation i've found is in ItemInHandLayer#renderArmWithItem (L45-46). #Edit 2 Overriding the translateToHand method doesn't work. Rotating the matix stack to -armModelPart.zRot doesn't work too.
  11. i'm currently struggling on the rotation for the held item layer. This is how it should look like: This is how it looks after the invisible arm has moved: This is the layer: public class CustomItemInHandLayer<T extends Player, M extends PlayerModel<T>> extends ItemInHandLayer<T, M> { @SuppressWarnings("unchecked") public CustomItemInHandLayer(PlayerRenderer renderer) { super((RenderLayerParent<T, M>) renderer); } @ParametersAreNonnullByDefault @Override public void render(PoseStack stack, MultiBufferSource bufferSource, int light, T player, float p_117208_, float p_117209_, float p_117210_, float p_117211_, float p_117212_, float p_117213_) { if (MinecraftForge.EVENT_BUS.post(new RenderItemInHandEvent.Pre(stack, bufferSource, player, (PlayerRenderer) this.renderer))) return; super.render(stack, bufferSource, light, player, p_117208_, p_117209_, p_117210_, p_117211_, p_117212_, p_117213_); } @ParametersAreNonnullByDefault @Override protected void renderArmWithItem(LivingEntity player, ItemStack itemStack, ItemTransforms.TransformType transformType, HumanoidArm arm, PoseStack stack, MultiBufferSource bufferSource, int light) { if (itemStack.is(Items.SPYGLASS) && player.getUseItem() == itemStack && player.swingTime == 0) { this.renderArmWithSpyglass(player, itemStack, arm, stack, bufferSource, light); } else { if (!itemStack.isEmpty()) { stack.pushPose(); MinecraftForge.EVENT_BUS.post(new RenderItemInHandEvent.ApplyModifier(stack, bufferSource, (Player) player, itemStack, arm, (PlayerRenderer) this.renderer)); this.getParentModel().translateToHand(arm, stack); stack.mulPose(Vector3f.XP.rotationDegrees(-90.0F)); stack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); boolean flag = arm == HumanoidArm.LEFT; stack.translate((flag ? -1d : 1d) / 16.0d, 0.125D, -0.625D); Minecraft.getInstance().getItemInHandRenderer().renderItem(player, itemStack, transformType, flag, stack, bufferSource, light); MinecraftForge.EVENT_BUS.post(new RenderItemInHandEvent.ResetModifier(stack, bufferSource, (Player) player, itemStack, arm, (PlayerRenderer) this.renderer)); stack.popPose(); } } } private void renderArmWithSpyglass(LivingEntity player, ItemStack itemStack, HumanoidArm arm, PoseStack stack, MultiBufferSource bufferSource, int light) { stack.pushPose(); MinecraftForge.EVENT_BUS.post(new RenderItemInHandEvent.ApplyModifier(stack, bufferSource, (Player) player, itemStack, arm, (PlayerRenderer) this.renderer)); ModelPart modelpart = this.getParentModel().getHead(); float f = modelpart.xRot; modelpart.xRot = Mth.clamp(modelpart.xRot, (-(float) Math.PI / 6F), ((float) Math.PI / 2F)); modelpart.translateAndRotate(stack); modelpart.xRot = f; CustomHeadLayer.translateToHead(stack, false); boolean flag = arm == HumanoidArm.LEFT; stack.translate((flag ? -2.5F : 2.5F) / 16.0F, -0.0625D, 0.0D); Minecraft.getInstance().getItemInHandRenderer().renderItem(player, itemStack, ItemTransforms.TransformType.HEAD, false, stack, bufferSource, light); MinecraftForge.EVENT_BUS.post(new RenderItemInHandEvent.ResetModifier(stack, bufferSource, (Player) player, itemStack, arm, (PlayerRenderer) this.renderer)); stack.popPose(); } } i've tried a few things but haven't found a way to prevent the item to move (even if the arm doesn't move the item does).
  12. Here is just the current state of my code. RenderEvent: public static void onPreRenderPlayer(final RenderPlayerEvent.Pre e) { if (!(e.getPlayer() instanceof AbstractClientPlayer)) return; final AbstractClientPlayer player = (AbstractClientPlayer) e.getPlayer(); player.getCapability(Capabilities.BEING).ifPresent(beingCapability -> { final LivingBeing being = beingCapability.getLivingBeing(); being.getModelTexture().ifPresent(textureLocation -> { //Replace Texture with Slime Texture try { player.getPlayerInfo().textureLocations.remove(MinecraftProfileTexture.Type.SKIN); player.getPlayerInfo().textureLocations.put(MinecraftProfileTexture.Type.SKIN, textureLocation); } catch (NullPointerException npe) { //TODO real exception handling OtherLivingBeings.getLogger().fatal("Could not get Player Information."); npe.printStackTrace(); } }); //Replace Model being.getModel(e.getRenderer()).ifPresent(model -> e.getRenderer().model = model); }); } getModel Method: @OnlyIn(Dist.CLIENT) @Override public Optional<PlayerModel<AbstractClientPlayer>> getModel(final PlayerRenderer renderer) { final PlayerModelReplacement replacement = new PlayerModelReplacement( SmallSlimeModel.createHead().bakeRoot(), SmallSlimeModel.createHat().bakeRoot(), SmallSlimeModel.createBody().bakeRoot(), emptyPart, emptyPart, emptyPart, emptyPart, emptyPart, emptyPart, emptyPart, emptyPart, emptyPart, emptyPart, emptyPart); final SmallSlimeModel model = new SmallSlimeModel(replacement.toModelPart()); //Remove Player Model Layers renderer.layers.clear(); //Add Armor Layer renderer.addLayer(new SmallSlimeArmorLayer<>(renderer)); return Optional.of(model); } Test Model (SmallSlimeModel): @OnlyIn(Dist.CLIENT) public class SmallSlimeModel extends PlayerModel<AbstractClientPlayer> { private final ModelPart root; public SmallSlimeModel(ModelPart parent) { super(parent, false); this.root = parent; } public static LayerDefinition createHat() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); partdefinition.addOrReplaceChild("hat", CubeListBuilder.create() .texOffs(32, 0) .addBox(-4.0F, 17.0F, -4.0F, 8.0F, 8.0F, 8.0F, CubeDeformation.NONE), PartPose.ZERO); return LayerDefinition.create(meshdefinition, 64, 32); } public static LayerDefinition createHead() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); partdefinition.addOrReplaceChild("cube", CubeListBuilder.create() .texOffs(0, 16) .addBox(-3.0F, 17.0F, -3.0F, 6.0F, 6.0F, 6.0F), PartPose.ZERO); partdefinition.addOrReplaceChild("right_eye", CubeListBuilder.create().texOffs(32, 0).addBox(-3.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F), PartPose.ZERO); partdefinition.addOrReplaceChild("left_eye", CubeListBuilder.create().texOffs(32, 4).addBox(1.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F), PartPose.ZERO); partdefinition.addOrReplaceChild("mouth", CubeListBuilder.create().texOffs(32, 8).addBox(0.0F, 21.0F, -3.5F, 1.0F, 1.0F, 1.0F), PartPose.ZERO); return LayerDefinition.create(meshdefinition, 64, 32); } public static LayerDefinition createBody() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); partdefinition.addOrReplaceChild("cube", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, 16.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.ZERO); return LayerDefinition.create(meshdefinition, 64, 32); } public ModelPart root() { return this.root; } } Custom armor layer: public class SmallSlimeArmorLayer<T extends LivingEntity, M extends HumanoidModel<T>, A extends HumanoidModel<T>> extends HumanoidArmorLayer<T, M, A> { public SmallSlimeArmorLayer(RenderLayerParent<T, M> parent) { super(parent, (A) new HumanoidModel(PlayerRendererUtils.getEntityRendererContext(parent).bakeLayer(ModelLayers.PLAYER_INNER_ARMOR)), (A) new HumanoidModel(PlayerRendererUtils.getEntityRendererContext(parent).bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR))); } @Override public void render(PoseStack stack, MultiBufferSource bufferSource, int p_117098_, T player, float p_117100_, float p_117101_, float p_117102_, float p_117103_, float p_117104_, float p_117105_) { super.render(stack, bufferSource, p_117098_, player, p_117100_, p_117101_, p_117102_, p_117103_, p_117104_, p_117105_); } }
  13. Okay so basiclly i need to remove all existing layers, extend from HumanoidArmorLayer and override the render method to change the position and then add the layer to the renderer?
  14. okay... i've managed to create a model which rotates with the player rotation and looks like whatever i want. The only problem is that holding items (or weared items) are on the wrong spot. How can i change the position?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.