http://www.mcmodding.ru/учебник/zbctvz написал(а):Как сделать свой материал
в ванильном нашёл но не заработало.
код чуть позже приложу.
[15:47:12] [Client thread/ERROR]: Unable to parse metadata from minecrftgases:textures/blocks/a.png
java.lang.RuntimeException: broken aspect ratio and not an animation
at net.minecraft.client.renderer.texture.TextureAtlasSprite.loadSprite(TextureAtlasSprite.java:245) ~[TextureAtlasSprite.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:170) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:579) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:890) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
package net.minecrftgases.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class TileEntityTrafficLightBlock extends Block {
//Treat it like a normal block here. The Block Bounds are a good idea - the first three are X Y and Z of the botton-left corner,
//And the second three are the top-right corner.
public TileEntityTrafficLightBlock() {
super(Material.iron);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
//Make sure you set this as your TileEntity class relevant for the block!
public TileEntity createNewTileEntity(World world) {
return new TileEntityTrafficLightEntity();
}
//You don't want the normal render type, or it wont render properly.
@Override
public int getRenderType() {
return -1;
}
//It's not an opaque cube, so you need this.
@Override
public boolean isOpaqueCube() {
return false;
}
//It's not a normal block, so you need this too.
public boolean renderAsNormalBlock() {
return false;
}
//This is the icon to use for showing the block in your hand.
public void registerIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("Roads:TrafficLightIcon");
}
}
package net.minecrftgases.blocks;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecrftgases.stuff.ModInfo;
import org.lwjgl.opengl.GL11;
public class TileEntityTrafficLightRenderer extends TileEntitySpecialRenderer {
//The model of your block
private final TrafficLightModel model;
public TileEntityTrafficLightRenderer() {
this.model = new TrafficLightModel();
}
private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
GL11.glPushMatrix();
GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
//The PushMatrix tells the renderer to "start" doing something.
GL11.glPushMatrix();
//This is setting the initial location.
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
//This is the texture of your block. It's pathed to be the same place as your other blocks here.
//Outdated bindTextureByName("/mods/roads/textures/blocks/TrafficLightPoleRed.png");
//Use in 1.6.2 this
ResourceLocation textures = (new ResourceLocation("minecrftgases:textures/blocks/a.png"));
//the ':' is very important
//binding the textures
Minecraft.getMinecraft().renderEngine.bindTexture(textures);
//This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
//A reference to your Model file. Again, very important.
this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
//Tell it to stop rendering for both the PushMatrix's
GL11.glPopMatrix();
GL11.glPopMatrix();
}
//Set the lighting stuff, so it changes it's brightness properly.
private void adjustLightFixture(World world, int i, int j, int k, Block block) {
Tessellator tess = Tessellator.instance;
float brightness = block.getBlockHardness(world, i, j, k);
int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
int modulousModifier = skyLight % 65536;
int divModifier = skyLight / 65536;
tess.setColorOpaque_F(brightness, brightness, brightness);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
}
}
package net.minecrftgases.blocks;
import net.minecraft.tileentity.TileEntity;
public class TileEntityTrafficLightEntity extends TileEntity {
}
package net.minecrftgases.blocks;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class TrafficLightModel extends ModelBase
{
//fields
ModelRenderer korpus;
ModelRenderer kreplenie_osnova;
ModelRenderer gorelka;
ModelRenderer svet;
ModelRenderer Shape2;
ModelRenderer Shape3;
public TrafficLightModel()
{
textureWidth = 64;
textureHeight = 32;
korpus = new ModelRenderer(this, 0, 0);
korpus.addBox(2F, 4F, 2F, 12, 12, 12);
korpus.setRotationPoint(-8F, 8F, -8F);
korpus.setTextureSize(64, 32);
korpus.mirror = true;
setRotation(korpus, 0F, 0F, 0F);
kreplenie_osnova = new ModelRenderer(this, 0, 24);
kreplenie_osnova.addBox(6F, 3F, 6F, 4, 1, 4);
kreplenie_osnova.setRotationPoint(-8F, 8F, -8F);
kreplenie_osnova.setTextureSize(64, 32);
kreplenie_osnova.mirror = true;
setRotation(kreplenie_osnova, 0F, 0F, 0F);
gorelka = new ModelRenderer(this, 16, 24);
gorelka.addBox(6F, 14F, 6F, 4, 1, 4);
gorelka.setRotationPoint(-8F, 8F, -8F);
gorelka.setTextureSize(64, 32);
gorelka.mirror = true;
setRotation(gorelka, 0F, 0F, 0F);
svet = new ModelRenderer(this, 0, 0);
svet.addBox(7F, 13F, 7F, 2, 1, 2);
svet.setRotationPoint(-8F, 8F, -8F);
svet.setTextureSize(64, 32);
svet.mirror = true;
setRotation(svet, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 0, 3);
Shape2.addBox(7F, 2F, 7F, 2, 1, 2);
Shape2.setRotationPoint(-8F, 8F, -8F);
Shape2.setTextureSize(64, 32);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
Shape3 = new ModelRenderer(this, 36, 0);
Shape3.addBox(7F, 1F, 0F, 2, 1, 8);
Shape3.setRotationPoint(-8F, 8F, -8F);
Shape3.setTextureSize(64, 32);
Shape3.mirror = true;
setRotation(Shape3, 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); //add entity here
korpus.render(f5);
kreplenie_osnova.render(f5);
gorelka.render(f5);
svet.render(f5);
Shape2.render(f5);
Shape3.render(f5);
}
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) //Add Entity entity here
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); //Add entity here
}
}
Не помогло всё равно ошибкаlaz2727 написал(а):О-фи-ге-ть.
Код:ResourceLocation textures = new ResourceLocation("minecrftgases", "/textures/blocks/a.png");
f1rSt1k, ты хуй бля! (lurkmo.re/265)
ошибка исчезло но текстуру не видно!laz2727 написал(а):Фирстик, ты омич. Сказано же -
У тебя текстура кривая. Надо, чтобы стороны были одинаковые и делились на 8.Код:broken aspect ratio and not an animation
package net.minecrftgases.blocks;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class TrafficLightModel extends ModelBase
{
//fields
ModelRenderer Korpus;
ModelRenderer Kreplenie_osnova;
ModelRenderer Gorelka;
ModelRenderer Svet;
ModelRenderer Shape2;
ModelRenderer Shape3;
ModelRenderer Korpus2;
ModelRenderer Shape1;
ModelRenderer Shape4;
ModelRenderer Shape5;
ModelRenderer Shape6;
public TrafficLightModel()
{
textureWidth = 64;
textureHeight = 64;
Korpus = new ModelRenderer(this, 0, 0);
Korpus.addBox(2F, 4F, 2F, 12, 1, 12);
Korpus.setRotationPoint(-8F, 8F, -8F);
Korpus.setTextureSize(64, 64);
Korpus.mirror = true;
setRotation(Korpus, 0F, 0F, 0F);
Kreplenie_osnova = new ModelRenderer(this, 16, 24);
Kreplenie_osnova.addBox(6F, 3F, 6F, 4, 1, 4);
Kreplenie_osnova.setRotationPoint(-8F, 8F, -8F);
Kreplenie_osnova.setTextureSize(64, 64);
Kreplenie_osnova.mirror = true;
setRotation(Kreplenie_osnova, 0F, 0F, 0F);
Gorelka = new ModelRenderer(this, 0, 24);
Gorelka.addBox(6F, 14F, 6F, 4, 1, 4);
Gorelka.setRotationPoint(-8F, 8F, -8F);
Gorelka.setTextureSize(64, 64);
Gorelka.mirror = true;
setRotation(Gorelka, 0F, 0F, 0F);
Svet = new ModelRenderer(this, 0, 0);
Svet.addBox(7F, 13F, 7F, 2, 1, 2);
Svet.setRotationPoint(-8F, 8F, -8F);
Svet.setTextureSize(64, 64);
Svet.mirror = true;
setRotation(Svet, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 0, 3);
Shape2.addBox(7F, 2F, 7F, 2, 1, 2);
Shape2.setRotationPoint(-8F, 8F, -8F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
Shape3 = new ModelRenderer(this, 36, 0);
Shape3.addBox(7F, 1F, 0F, 2, 1, 8);
Shape3.setRotationPoint(-8F, 8F, -8F);
Shape3.setTextureSize(64, 64);
Shape3.mirror = true;
setRotation(Shape3, 0F, 0F, 0F);
Korpus2 = new ModelRenderer(this, 0, 0);
Korpus2.addBox(2F, 15F, 2F, 12, 1, 12);
Korpus2.setRotationPoint(-8F, 8F, -8F);
Korpus2.setTextureSize(64, 64);
Korpus2.mirror = true;
setRotation(Korpus2, 0F, 0F, 0F);
Shape1 = new ModelRenderer(this, 0, 12);
Shape1.addBox(2F, 5F, 1F, 1, 10, 1);
Shape1.setRotationPoint(-8F, 8F, -7F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
Shape4 = new ModelRenderer(this, 0, 12);
Shape4.addBox(2F, 5F, 13F, 1, 10, 1);
Shape4.setRotationPoint(-8F, 8F, -8F);
Shape4.setTextureSize(64, 64);
Shape4.mirror = true;
setRotation(Shape4, 0F, 0F, 0F);
Shape5 = new ModelRenderer(this, 0, 12);
Shape5.addBox(13F, 5F, 2F, 1, 10, 1);
Shape5.setRotationPoint(-8F, 8F, -8F);
Shape5.setTextureSize(64, 64);
Shape5.mirror = true;
setRotation(Shape5, 0F, 0F, 0F);
Shape6 = new ModelRenderer(this, 0, 12);
Shape6.addBox(13F, 5F, 13F, 1, 10, 1);
Shape6.setRotationPoint(-8F, 8F, -8F);
Shape6.setTextureSize(64, 64);
Shape6.mirror = true;
setRotation(Shape6, 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); //add entity here
Korpus.render(f5);
Kreplenie_osnova.render(f5);
Gorelka.render(f5);
Svet.render(f5);
Shape2.render(f5);
Shape3.render(f5);
Korpus2.render(f5);
Shape1.render(f5);
Shape4.render(f5);
Shape5.render(f5);
Shape6.render(f5);
}
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) //Add Entity entity here
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); //Add entity here
}
}
я обычно быстрой правкой пользовался и не замечал.anti344 написал(а):Ты и сам можешь вообще-то.
я ненастолько умный. Обясни подробней.Dragon2488 написал(а):тесселятором ресивать а потом через реднер движок текстурировать.