-
Posts
176 -
Joined
-
Last visited
Everything posted by Skyriis
-
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.
-
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
-
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.
-
Have you registered your class as EventBusSubscriber on the correct bus?
-
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?
-
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)?
-
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
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? -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
by multiplying the poseStack with Vector3f.ZP.rotationDegrees(-itemTransform.rotation.z()) -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
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 -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
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. -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
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). -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
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_); } } -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
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? -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
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? -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
i kinda managed to render a Mob instead of the player using @OnlyIn(Dist.CLIENT) @Override public void renderPlayer(final Player player, final PoseStack poseStack, final MultiBufferSource buffer, final int light, final float partialTicks) { final Slime entity = EntityType.SLIME.create(player.level); entity.setSize(0, false); entity.setPos(player.getX(), player.getY(), player.getZ()); entity.setXRot(player.getXRot()); entity.setYRot(player.getYRot()); entity.setYHeadRot(player.getYHeadRot()); entity.setOldPosAndRot(); Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(entity).render(entity, 0F, partialTicks, poseStack, buffer, light); } but the rotations won't be applied. Any ideas how to fix that? -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
That doesn't seems to work since the RenderPlayerEvent.Pre renderer is a PlayerRenderer and not a LivingEntityRenderer. Which means that the model needs to be a PlayerModel (or extend it) and can't be a normal EntityModel. -
[1.17.1] Replacing Player Model with a Mob Model
Skyriis replied to Skyriis's topic in Modder Support
Bump. I'm still struggling -
[1.16.2] Changing slot x and y position on the fly
Skyriis replied to BeardlessBrady's topic in Modder Support
As Luis_ST mentioned you could use an accesstransformer to make those fields public and non-final by adding a -f after the public modifier. Edit: Just in case you don't know how to get the SRG names for your at. Join the Forge Discord Server and message the forge-bot with !mcp <field name|method name> (for MCP Mappings) or !moj <field name|method name> (for Official Mappings). -
This isn't the gradle subforum ether. Is it? Why would you need to create so much models?
-
This seems to be an issue of the immersiverailroading. Try reporting it to the mod author
-
Hello Guys, i'm working on a Mod which allows you to play Minecraft as one of the existing Mobs. i'm currently struggling on the player rendering since the player model should be replaced with the Mob Model. I guess i need to cancel the RenderPlayerEvent, get my capability and then render the mob which i can identify by the value in my capability. Canceling the Event and getting the Capability isn't a thing but how do i render render the Mob? i would be really grateful for help. Thanks in advance!
-
[CLOSED][1.17.1] Attribute Modifier doesn't apply
Skyriis replied to Skyriis's topic in Modder Support
ah well. I found the issue. I was applying the modifier on the client side but not on the server side which causes the server to remove the modifier on the client. YIKES -
Hello there, i'm trying to add a AttributeModifier to the player but somehow it won't be applied. The modifier should be applied in my AttributeAbility class using the applyAttribute method which is called on every capability sync. The applyAttribute method is called and the modifier contains the correct values but it still doesn't apply to the player. Am i missing something?
-
So if i want to open the Container using a Button from another gui i need to Send a packet to the Server which sends a new packet with the needed Information to the client? Well it kinda works now but the slots are on a weird place and since i can't get the screen width and height at the container i don't know how to place them where they should be. Some ideas how to fix that?
-
The screen shows capability data (with buttons to edit the given values) and the inventory (which should be modifiable). So I guess i have to create a Container. How can i open a Container without a TileEntity?