Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
public class ModelModChest extends ModelBase
{
ModelRenderer tabletop;
ModelRenderer leg1;
ModelRenderer leg2;
ModelRenderer leg3;
ModelRenderer leg4;
public ModelModChest()
{
textureWidth = 64;
textureHeight = 32;
tabletop = new ModelRenderer(this, 0, 0);
tabletop.addBox(0F, 0F, 0F, 16, 3, 16);
tabletop.setRotationPoint(-8F, 12F, -8F);
tabletop.setTextureSize(64, 32);
tabletop.mirror = true;
setRotation(tabletop, 0F, 0F, 0F);
leg1 = new ModelRenderer(this, 16, 19);
leg1.addBox(0F, 0F, 0F, 4, 9, 4);
leg1.setRotationPoint(-8F, 15F, -8F);
leg1.setTextureSize(64, 32);
leg1.mirror = true;
setRotation(leg1, 0F, 0F, 0F);
leg2 = new ModelRenderer(this, 0, 19);
leg2.addBox(0F, 0F, 0F, 4, 9, 4);
leg2.setRotationPoint(-8F, 15F, 4F);
leg2.setTextureSize(64, 32);
leg2.mirror = true;
setRotation(leg2, 0F, 0F, 0F);
leg3 = new ModelRenderer(this, 48, 19);
leg3.addBox(0F, 0F, 0F, 4, 9, 4);
leg3.setRotationPoint(4F, 15F, 4F);
leg3.setTextureSize(64, 32);
leg3.mirror = true;
setRotation(leg3, 0F, 0F, 0F);
leg4 = new ModelRenderer(this, 32, 19);
leg4.addBox(0F, 0F, 0F, 4, 9, 4);
leg4.setRotationPoint(4F, 15F, -8F);
leg4.setTextureSize(64, 32);
leg4.mirror = true;
setRotation(leg4, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
tabletop.render(f5);
leg1.render(f5);
leg2.render(f5);
leg3.render(f5);
leg4.render(f5);
}
public void renderModel(float f)
{
tabletop.render(f);
leg1.render(f);
leg2.render(f);
leg3.render(f);
leg4.render(f);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}
public class ModChestRender extends TileEntitySpecialRenderer
{
private static final ResourceLocation texture = new ResourceLocation(Main.MODID + ":" + "textures/models/ModChest.png");
private ModelModChest model;
public ModChestRender()
{
this.model = new ModelModChest();
}
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f, int i)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glRotatef(180, 0F, 0F, 1F);
this.bindTexture(texture);
GL11.glPushMatrix();
this.model.renderModel(0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
public class ModChest extends BlockContainer
{
public ModChest(Material material)
{
super(material);
this.setHardness(1.5F);
this.setResistance(5.0F);
this.setHarvestLevel("axe", 0);
this.setStepSound(Block.soundTypeWood);
this.setBlockBounds(0, 0, 0, 1.0F, 0.75F, 1.0F);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube()
{
return false;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileEntityModChest();
}
}
{
"variants": {
"normal": { "model": "rpgmod:ModChest" }
}
}
{
"textures": {
"top": "rpgmod:blocks/ModChest_top",
"side": "rpgmod:blocks/ModChest_side",
"bottom": "rpgmod:blocks/ModChest_bottom"
},
"elements": [
{ "from": [ 0, 0, 0 ],
"to": [ 16, 12, 16 ],
"faces": {
"down": { "texture": "#bottom", "cullface": "down" },
"up": { "texture": "#top", "cullface": "up" },
"north": { "texture": "#side", "cullface": "north" },
"south": { "texture": "#side", "cullface": "south" },
"west": { "texture": "#side", "cullface": "west" },
"east": { "texture": "#side", "cullface": "east" }
}
}
]
}
{
"parent": "rpgmod:block/ModChest",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}