Jump to content

[solved][1.19.2] force crawl position on player entity and how to prevent getting suffocation damage


perromercenary00

Recommended Posts

im retaking the work on the toilet block 

 

 

this toilet actually works but there's two issues that bother me the first one is visual coze the toilet takes the player entity and carry it trough the tunnel in standing position,  the tunnel is just one block high and player eye position is at 1.8 soo it clips inside the block above and you cannot see where the water is taking you also that's kill the player by suffocation damage in long runs

toilet01-edit.gif


 

that is 
 i need a coded way to force the player to crawl position and also a way to avoid getting suffocation damage

thanks for your ideas .


 

Edited by perromercenary00
solved
Link to comment
Share on other sites

5 hours ago, Alpvax said:

You need to set/force the pose to Pose.SWIMMING

hthanks its works buts also  brings  a new issue 

player.setForcedPose(Pose.SWIMMING);

causes the player to crawl but gets stuck crawling and the only way is close reopen the map 

 

crawling-edit2.gif

 

i would perfect to has some kind of 

int time = 20;

player.setForcedPose(Pose.SWIMMING, time);

and before time expires check the conditions to crawl another 20 ticks 

still usable know i have to find a way to store a list of entities inside the toilet entity and a way to pass that list from server side to client side 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

  • perromercenary00 changed the title to [solved][1.19.2] force crawl position on player entity and how to prevent getting suffocation damage

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

    • Yep it works but now I've got other problems. Life of a modder, I suppose.
    • Figured out how to do armor layering thanks to another post for 1.8.9 that still worked for 1.18.2, so credits to them. However, now I have the opposite problem; the armor textures are displaying colors correctly but the items are no longer doing so. I've already edited the JSON texture layering files like so: { "parent": "item/generated", "textures": { "layer0": "cai:items/wool_leggings", "layer1": "cai:items/blank" } } (also "CAI" stands for "Catz's Adventure Items" if you wanted to know that, it's a private mod) So far I've already used the following in my code: Extending DyeableArmorItem Implementing DyeableLeatherItem Overridden getColor() and getArmorTexture() to allow armor layering to work (see above linked post) Anyone know what's up with that? Am I layering the textures incorrectly? Is there some item color class implementation I'm missing?
    • Chosen modded  adventure works, 30-80 fps   
    • Hello, I've decided I want to replace the default player model with a custom one but can't quite seem to figure it out. I'm somewhat new to minecraft modding so please forgive me if I'm missing something obvious. My code is also a bit jumbled and nothing atm (been deleting any code that hasn't been working) and imports things that aren't being used as I've been doing a lot of experimenting with this problem. I've read through probably every other existing topic on rendering player models but their solutions don't seem to quite translate to my particular issue. My PlayerRenderOverride class can't access the render method since the render is static. On a side note, I have successfully been able to render mobs using my model and renderer files. My replacement code package net.grem.bioniclemod.playerrender; import net.grem.bioniclemod.BionicleMod; import net.grem.bioniclemod.entity.custom.ToaModelLayers; import net.grem.bioniclemod.entity.custom.toamodel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import java.util.EventObject; @Mod.EventBusSubscriber(modid = BionicleMod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class PlayerRenderOverride { public static toamodel model; @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre e) { e.setCanceled(true); ToaPlayerRenderer.render(e.getEntity(), 0f, 0f, e.getPoseStack(), 0f, 0f); } } My render code package net.grem.bioniclemod.playerrender; import com.mojang.blaze3d.vertex.PoseStack; import net.grem.bioniclemod.BionicleMod; import net.grem.bioniclemod.entity.custom.ToaModelLayers; import net.grem.bioniclemod.entity.custom.toamodel; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.resources.ResourceLocation; public class ToaPlayerRenderer extends LivingEntityRenderer<AbstractClientPlayer, toamodel<AbstractClientPlayer>>{ public ToaPlayerRenderer(EntityRendererProvider.Context pContext, boolean pUseSlimModel) { super(pContext, new toamodel<>(pContext.bakeLayer(ToaModelLayers.toalayer)), 0.5F); // this.addLayer(new ToaArmorLayer -- doesn't exist yet. do later } @Override public void render(AbstractClientPlayer pEntity, float pEntityYaw, float pPartialTicks, PoseStack pPoseStack, MultiBufferSource pBuffer, int pPackedLight){ super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight); } @Override public ResourceLocation getTextureLocation(AbstractClientPlayer pEntity) { return new ResourceLocation(BionicleMod.MODID, "textures/entity/toa.png"); } } My model file   package net.grem.bioniclemod.entity.custom;// Made with Blockbench 4.11.0-beta.1 // Exported for Minecraft version 1.17 or later with Mojang mappings // Paste this class into your mod and generate all required imports import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.model.HierarchicalModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.world.entity.Entity; public class toamodel<T extends Entity> extends HierarchicalModel<T> { // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor private final ModelPart toa; private final ModelPart body; private final ModelPart right_leg; private final ModelPart left_leg; private final ModelPart torso; private final ModelPart head; private final ModelPart brain; private final ModelPart right_arm; private final ModelPart left_arm; public toamodel(ModelPart root) { this.toa = root.getChild("toa"); this.body = root.getChild("toa").getChild("body"); this.right_leg = root.getChild("toa").getChild("body").getChild("right_leg"); this.left_leg = root.getChild("toa").getChild("body").getChild("left_leg"); this.torso = root.getChild("toa").getChild("body").getChild("torso"); this.head = root.getChild("toa").getChild("body").getChild("head"); this.brain = root.getChild("toa").getChild("body").getChild("head").getChild("brain"); this.right_arm = root.getChild("toa").getChild("body").getChild("right_arm"); this.left_arm = root.getChild("toa").getChild("body").getChild("left_arm"); } public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); PartDefinition toa = partdefinition.addOrReplaceChild("toa", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F)); PartDefinition body = toa.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); PartDefinition right_leg = body.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(24, 47).mirror().addBox(-1.5F, 5.7394F, -2.5568F, 3.0F, 7.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-2.5F, -12.75F, 0.0F)); PartDefinition cube_r1 = right_leg.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(26, 38).mirror().addBox(-1.0F, -16.0F, -2.0F, 2.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 15.95F, -2.15F, -0.1745F, 0.0F, 0.0F)); PartDefinition cube_r2 = right_leg.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(25, 32).mirror().addBox(0.0F, -1.5F, -1.5F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-1.5F, 0.25F, 0.0F, 0.7418F, 0.0F, 0.0F)); PartDefinition left_leg = body.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(24, 47).addBox(1.0F, -7.0106F, -3.0568F, 3.0F, 7.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.5F)); PartDefinition cube_r3 = left_leg.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(26, 38).addBox(-1.0F, -16.0F, -2.0F, 2.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.5F, 3.2F, -2.65F, -0.1745F, 0.0F, 0.0F)); PartDefinition cube_r4 = left_leg.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(25, 32).addBox(0.0F, -1.5F, -1.5F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.0F, -12.5F, -0.5F, 0.7418F, 0.0F, 0.0F)); PartDefinition torso = body.addOrReplaceChild("torso", CubeListBuilder.create().texOffs(58, 34).addBox(-8.0F, -23.75F, -0.5F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) .texOffs(58, 34).addBox(-18.0F, -23.75F, -0.5F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) .texOffs(20, 23).addBox(-16.0F, -23.75F, -1.0F, 8.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)) .texOffs(45, 43).addBox(-15.0F, -13.0F, -0.5F, 6.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) .texOffs(44, 34).addBox(-15.0F, -16.0F, -1.0F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)) .texOffs(40, 19).addBox(-15.5F, -23.5F, -3.0F, 7.0F, 6.0F, 5.0F, new CubeDeformation(0.0F)) .texOffs(48, 30).addBox(-13.0F, -18.0F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) .texOffs(48, 37).addBox(-13.0F, -15.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)) .texOffs(50, 11).addBox(-13.0F, -29.0F, -1.0F, 2.0F, 6.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(12.0F, 0.0F, 0.0F)); PartDefinition cube_r5 = torso.addOrReplaceChild("cube_r5", CubeListBuilder.create().texOffs(40, 30).addBox(0.0F, -1.0F, 0.0F, 4.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-9.0353F, -14.8863F, -0.5F, 0.0F, 0.0F, -1.309F)); PartDefinition cube_r6 = torso.addOrReplaceChild("cube_r6", CubeListBuilder.create().texOffs(40, 30).mirror().addBox(-4.0F, -1.0F, 0.0F, 4.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-14.9647F, -14.8863F, -0.5F, 0.0F, 0.0F, 1.309F)); PartDefinition head = body.addOrReplaceChild("head", CubeListBuilder.create().texOffs(21, 11).addBox(-1.5F, 0.0F, -4.45F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) .texOffs(19, 17).addBox(-2.0F, 2.05F, -3.45F, 4.0F, 1.0F, 4.0F, new CubeDeformation(0.0F)) .texOffs(6, 10).addBox(0.0094F, 0.0F, -3.1379F, 3.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)) .texOffs(6, 10).mirror().addBox(-3.0094F, 0.0F, -3.1379F, 3.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false) .texOffs(23, 0).addBox(-0.5F, -4.6985F, -2.7399F, 1.0F, 1.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -27.5F, -0.55F)); PartDefinition cube_r7 = head.addOrReplaceChild("cube_r7", CubeListBuilder.create().texOffs(24, 4).addBox(0.0F, -4.0F, 0.0F, 1.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, -0.9397F, -4.108F, -0.3491F, 0.0F, 0.0F)); PartDefinition cube_r8 = head.addOrReplaceChild("cube_r8", CubeListBuilder.create().texOffs(18, 7).mirror().addBox(-2.0F, -2.0F, 0.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.4075F, -2.4747F, -2.8121F, -0.1278F, 0.0283F, 0.2164F)); PartDefinition cube_r9 = head.addOrReplaceChild("cube_r9", CubeListBuilder.create().texOffs(16, 10).mirror().addBox(-2.0F, -3.0F, 0.0F, 3.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-1.0568F, 0.4292F, -3.1944F, -0.1278F, 0.0283F, 0.2164F)); PartDefinition cube_r10 = head.addOrReplaceChild("cube_r10", CubeListBuilder.create().texOffs(18, 7).addBox(0.0F, -2.0F, 0.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.4075F, -2.4747F, -2.8121F, -0.1278F, -0.0283F, -0.2164F)); PartDefinition cube_r11 = head.addOrReplaceChild("cube_r11", CubeListBuilder.create().texOffs(16, 10).addBox(-1.0F, -3.0F, 0.0F, 3.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.0568F, 0.4292F, -3.1944F, -0.1278F, -0.0283F, -0.2164F)); PartDefinition cube_r12 = head.addOrReplaceChild("cube_r12", CubeListBuilder.create().texOffs(17, 17).mirror().addBox(-0.9393F, -1.0F, -0.3536F, 2.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-2.0685F, 1.0F, -3.4873F, 0.0F, 0.7156F, 0.0F)); PartDefinition cube_r13 = head.addOrReplaceChild("cube_r13", CubeListBuilder.create().texOffs(17, 17).addBox(-1.0607F, -1.0F, -0.3536F, 2.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.0685F, 1.0F, -3.4873F, 0.0F, -0.7156F, 0.0F)); PartDefinition cube_r14 = head.addOrReplaceChild("cube_r14", CubeListBuilder.create().texOffs(18, 4).mirror().addBox(0.0F, -5.0F, 0.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-2.5F, 0.9F, -5.0F, -0.3914F, 0.0334F, 0.0807F)); PartDefinition cube_r15 = head.addOrReplaceChild("cube_r15", CubeListBuilder.create().texOffs(18, 4).addBox(-2.0F, -5.0F, 0.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.5F, 0.9F, -5.0F, -0.3914F, -0.0334F, -0.0807F)); PartDefinition brain = head.addOrReplaceChild("brain", CubeListBuilder.create().texOffs(39, 3).addBox(-2.0F, -4.0515F, -0.5601F, 4.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)) .texOffs(44, 0).addBox(-2.0F, -6.0F, 0.0F, 4.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 2.3015F, -2.4899F)); PartDefinition right_arm = body.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(0, 34).mirror().addBox(-1.5F, 1.6F, -10.25F, 3.0F, 4.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false) .texOffs(0, 18).mirror().addBox(-1.5F, -1.5F, -1.25F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-5.5F, -23.0F, -0.25F, 0.9861F, 0.0F, 0.0F)); PartDefinition cube_r16 = right_arm.addOrReplaceChild("cube_r16", CubeListBuilder.create().texOffs(0, 24).mirror().addBox(-1.0F, -2.0F, 0.0F, 2.0F, 3.0F, 7.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 4.8F, -5.0F, 0.637F, 0.0F, 0.0F)); PartDefinition left_arm = body.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(0, 34).addBox(-1.5F, 1.6F, -10.25F, 3.0F, 4.0F, 6.0F, new CubeDeformation(0.0F)) .texOffs(0, 18).addBox(-1.5F, -1.5F, -1.25F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(5.5F, -23.0F, -0.25F, 1.0036F, 0.0F, 0.0F)); PartDefinition cube_r17 = left_arm.addOrReplaceChild("cube_r17", CubeListBuilder.create().texOffs(0, 24).addBox(-2.0F, -2.0F, 0.0F, 2.0F, 3.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.0F, 4.8F, -5.0F, 0.637F, 0.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 64, 64); } @Override public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { // no anims yet } @Override public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { toa.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); } @Override public ModelPart root(){ return toa; } }      
    • here's the log: https://drive.google.com/file/d/1rzvNfT10q6MNpw_k6BGMwDr49A7h6SVv/view?usp=drive_link
  • Topics

×
×
  • Create New...

Important Information

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