Posted August 19, 20169 yr I currently have a scarecrow model which I would like to Render as a block. The scarecrow is two blocks high. But it doesn't show it's texture and it also renders like into the ground and not into the air. http://i252.photobucket.com/albums/hh24/Raycoms/2016-08-19_08.32.55_zpsdytiqsog.png[/img] public class ModelScarecrowBoth extends ModelBase { //fields ModelRenderer Head; ModelRenderer Post; ModelRenderer LeftArmPeg; ModelRenderer RightArmPeg; ModelRenderer Torso; ModelRenderer RightLegPeg; ModelRenderer LeftLegPeg; ModelRenderer LeftArm; ModelRenderer RightArm; ModelRenderer RightLeg; ModelRenderer LeftLeg; public ModelScarecrowBoth() { textureWidth = 128; textureHeight = 64; Head = new ModelRenderer(this, 0, 0); Head.addBox(-8.2F, -35.6F, -4.2F, 8, 8, ; Head.setRotationPoint(7F, 24F, -1F); Head.setTextureSize(128, 64); Head.mirror = true; setRotation(Head, 0F, 0.1858931F, -0.1092638F); Post = new ModelRenderer(this, 0, 32); Post.addBox(-1F, -16F, -1F, 2, 16, 2); Post.setRotationPoint(0F, 24F, 0F); Post.setTextureSize(128, 64); Post.mirror = true; setRotation(Post, 0F, 0F, 0F); LeftArmPeg = new ModelRenderer(this, 9, 33); LeftArmPeg.addBox(23.5F, 1F, -1F, 2, 2, 2); LeftArmPeg.setRotationPoint(7F, 24F, 0F); LeftArmPeg.setTextureSize(128, 64); LeftArmPeg.mirror = true; setRotation(LeftArmPeg, 0F, 0F, -1.351339F); RightArmPeg = new ModelRenderer(this, 9, 33); RightArmPeg.addBox(-28F, 15.8F, -1F, 2, 2, 2); RightArmPeg.setRotationPoint(7F, 24F, 0F); RightArmPeg.setTextureSize(128, 64); RightArmPeg.mirror = true; setRotation(RightArmPeg, 0F, 0F, 1.351339F); Torso = new ModelRenderer(this, 16, 16); Torso.addBox(-10.3F, -27.6F, -2F, 8, 12, 4); Torso.setRotationPoint(7F, 24F, 0F); Torso.setTextureSize(128, 64); Torso.mirror = true; setRotation(Torso, 0F, 0F, -0.0349066F); RightLegPeg = new ModelRenderer(this, 9, 33); RightLegPeg.addBox(-11F, -4F, -1F, 2, 2, 2); RightLegPeg.setRotationPoint(7F, 24F, 0F); RightLegPeg.setTextureSize(128, 64); RightLegPeg.mirror = true; setRotation(RightLegPeg, 0F, 0F, 0.0872665F); LeftLegPeg = new ModelRenderer(this, 9, 33); LeftLegPeg.addBox(-4.5F, -5F, -1F, 2, 2, 2); LeftLegPeg.setRotationPoint(7F, 24F, 0F); LeftLegPeg.setTextureSize(128, 64); LeftLegPeg.mirror = true; setRotation(LeftLegPeg, 0F, 0F, -0.0872665F); LeftArm = new ModelRenderer(this, 40, 16); LeftArm.addBox(22.5F, -10F, -1.99F, 4, 12, 4); LeftArm.setRotationPoint(7F, 24F, 0F); LeftArm.setTextureSize(128, 64); LeftArm.mirror = true; setRotation(LeftArm, 0F, 0F, -1.351339F); RightArm = new ModelRenderer(this, 40, 16); RightArm.addBox(-29F, 4.8F, -1.99F, 4, 12, 4); RightArm.setRotationPoint(7F, 24F, 0F); RightArm.setTextureSize(128, 64); RightArm.mirror = true; setRotation(RightArm, 0F, 0F, 1.351339F); RightLeg = new ModelRenderer(this, 0, 16); RightLeg.addBox(-12F, -15F, -1.99F, 4, 12, 4); RightLeg.setRotationPoint(7F, 24F, 0F); RightLeg.setTextureSize(128, 64); RightLeg.mirror = true; setRotation(RightLeg, 0F, 0F, 0.0872665F); LeftLeg = new ModelRenderer(this, 0, 16); LeftLeg.addBox(-5.5F, -16F, -1.98F, 4, 12, 4); LeftLeg.setRotationPoint(7F, 24F, 0F); LeftLeg.setTextureSize(128, 64); LeftLeg.mirror = true; setRotation(LeftLeg, 0F, 0F, -0.0872665F); } public void render(float scaleFactor) { Head.render(scaleFactor); Post.render(scaleFactor); LeftArmPeg.render(scaleFactor); RightArmPeg.render(scaleFactor); Torso.render(scaleFactor); RightLegPeg.render(scaleFactor); LeftLegPeg.render(scaleFactor); LeftArm.render(scaleFactor); RightArm.render(scaleFactor); RightLeg.render(scaleFactor); LeftLeg.render(scaleFactor); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } } I also have a tileEntitySpecialRenderer @SideOnly(Side.CLIENT) public class TileEntityScarecrowRenderer extends TileEntitySpecialRenderer<ScarecrowTileEntity> { private final ModelScarecrowBoth model; public TileEntityScarecrowRenderer() { this.model = new ModelScarecrowBoth(); } @Override public void renderTileEntityAt(ScarecrowTileEntity te, double posX, double posY, double posZ, float partialTicks, int destroyStage) { GlStateManager.pushMatrix(); // store the transformation GlStateManager.translate(posX, posY, posZ); // set viewport to tile entity position to render it /* ============ Rendering Code goes here ============ */ EnumFacing facing = te.getWorld().getBlockState(te.getPos()).getValue(BlockHutField.FACING); this.bindTexture(this.getResourceLocation(te)); GlStateManager.rotate(180, te.getPos().getX(), te.getPos().getY(), te.getPos().getZ()); this.model.render(.0625f); /* ============ Rendering Code stops here =========== */ GlStateManager.popMatrix(); // restore the transformation, so other renderer's are not messed up } private ResourceLocation getResourceLocation(ScarecrowTileEntity tileentity) { String loc; if(tileentity.getType()) loc = "/resources/assets/minecolonies/textures/blocks/blockScarecrowPumpkin.png"; else loc = "/resources/assets/minecolonies/textures/blocks/blockScarecrowNormal.png"; return new ResourceLocation(Constants.MOD_ID + ":" + loc); } } I don't have any json files, are they necessary? How do I generate them?
August 19, 20169 yr When you call translate add 1 or .5, and in the block class override isOpaqueCube() to false and getRenderType() to -1 You should use the new model system as TESRs should be for dynamic rendering. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 19, 20169 yr I would recommend checking out MrCrayfish's Model Creator (assuming you're in 1.8+). It does mean you have to remake the model in that software instead, but what it does is generate a json file for you. This means you don't need a TileEntity and you don't get that pink and black box. IGN: matte006 Played Minecraft since summer 2011. Modding is my life now. Please check out my mod https://minecraft.curseforge.com/projects/gadgets-n-goodies-mod?gameCategorySlug=mc-mods&projectID=230028
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.