Hi! How do i make block turn to Default again? What i mean is that my code has the code: public void onNeighborBlockChange(World world, int i, int j, int k, Block l) So it teleport the model up. BUT! When i destory the block and place it again, its at the same point there i destoryed it.
Sorry for my bad english! Please help
Code:
public ModelRocket slide = new ModelRocket();
private double angle;
public void onNeighborBlockChange(World world, int i, int j, int k, Block l)
{
angle = angle - 0.3;
slide.Shape1.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape3.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape4.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape5.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape6.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape8.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape9.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape10.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape11.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape13.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape14.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape16.rotationPointY = (float)angle;
angle = angle - 0.3;
slide.Shape17.rotationPointY = (float)angle;
angle = angle - 0.05;
slide.Shape1.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape3.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape4.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape5.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape6.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape8.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape9.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape10.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape11.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape13.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape14.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape16.rotateAngleY = (float)angle;
angle = angle - 0.05;
slide.Shape17.rotateAngleY = (float)angle;
}
public int quantityDropped(Random par1Random){
return 1;
}
}
public static class TileEntityCustom extends TileEntity {}
public static class TileEntityCustomRenderer extends TileEntitySpecialRenderer {
private final ModelRocket model;
public TileEntityCustomRenderer() {this.model = new ModelRocket();}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
GL11.glTranslatef((float)x+0.5F, (float)y+1.0F, (float)z+0.5F);
ResourceLocation textures = (new ResourceLocation("Rocket.png"));
Minecraft.getMinecraft().renderEngine.bindTexture(textures);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glPushMatrix();
GL11.glRotatef(te.getBlockMetadata() * 90, 0.0F, 1.0F, 0.0F);
this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glPopMatrix();}
}
// Date: 2015-03-23 16:54:43
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
public static class ModelRocket extends ModelBase
{
//fields
public static ModelRenderer Shape1;
public static ModelRenderer Shape3;
public static ModelRenderer Shape4;
public static ModelRenderer Shape5;
public static ModelRenderer Shape6;
public static ModelRenderer Shape8;
public static ModelRenderer Shape9;
public static ModelRenderer Shape10;
public static ModelRenderer Shape11;
public static ModelRenderer Shape13;
public static ModelRenderer Shape14;
public static ModelRenderer Shape16;
public static ModelRenderer Shape17;
public ModelRocket()
{
textureWidth = 2000;
textureHeight = 2000;
Shape1 = new ModelRenderer(this, 0, 500);
Shape1.addBox(-24F, -96F, -24F, 48, 120, 48);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(2000, 2000);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
Shape3 = new ModelRenderer(this, 0, 800);
Shape3.addBox(-8F, 8F, 24F, 16, 19, 10);
Shape3.setRotationPoint(0F, 0F, 0F);
Shape3.setTextureSize(2000, 2000);
Shape3.mirror = true;
setRotation(Shape3, 0F, 0F, 0F);
Shape4 = new ModelRenderer(this, 0, 800);
Shape4.addBox(24F, 8F, -8F, 10, 19, 16);
Shape4.setRotationPoint(0F, 0F, 0F);
Shape4.setTextureSize(2000, 2000);
Shape4.mirror = true;
setRotation(Shape4, 0F, 0F, 0F);
Shape5 = new ModelRenderer(this, 0, 800);
Shape5.addBox(-8F, -8F, 24F, 16, 16, 10);
Shape5.setRotationPoint(0F, 0F, 0F);
Shape5.setTextureSize(2000, 2000);
Shape5.mirror = true;
setRotation(Shape5, 0F, 0F, 0F);
Shape6 = new ModelRenderer(this, 0, 800);
Shape6.addBox(-8F, 8F, -34F, 16, 19, 10);
Shape6.setRotationPoint(0F, 0F, 0F);
Shape6.setTextureSize(2000, 2000);
Shape6.mirror = true;
setRotation(Shape6, 0F, 0F, 0F);
Shape8 = new ModelRenderer(this, 0, 800);
Shape8.addBox(-8F, -8F, -34F, 16, 16, 10);
Shape8.setRotationPoint(0F, 0F, 0F);
Shape8.setTextureSize(2000, 2000);
Shape8.mirror = true;
setRotation(Shape8, 0F, 0F, 0F);
Shape9 = new ModelRenderer(this, 0, 800);
Shape9.addBox(-34F, -8F, -8F, 10, 16, 16);
Shape9.setRotationPoint(0F, 0F, 0F);
Shape9.setTextureSize(2000, 2000);
Shape9.mirror = true;
setRotation(Shape9, 0F, 0F, 0F);
Shape10 = new ModelRenderer(this, 500, 0);
Shape10.addBox(21F, -77F, -8F, 6, 16, 16);
Shape10.setRotationPoint(0F, 0F, 0F);
Shape10.setTextureSize(2000, 2000);
Shape10.mirror = true;
setRotation(Shape10, 0F, 0F, 0F);
Shape11 = new ModelRenderer(this, 0, 800);
Shape11.addBox(24F, -8F, -8F, 10, 16, 16);
Shape11.setRotationPoint(0F, 0F, 0F);
Shape11.setTextureSize(2000, 2000);
Shape11.mirror = true;
setRotation(Shape11, 0F, 0F, 0F);
Shape13 = new ModelRenderer(this, 0, 800);
Shape13.addBox(-34F, 8F, -8F, 10, 19, 16);
Shape13.setRotationPoint(0F, 0F, 0F);
Shape13.setTextureSize(2000, 2000);
Shape13.mirror = true;
setRotation(Shape13, 0F, 0F, 0F);
Shape14 = new ModelRenderer(this, 600, 0);
Shape14.addBox(-32F, -102F, -32F, 64, 6, 64);
Shape14.setRotationPoint(0F, 0F, 0F);
Shape14.setTextureSize(2000, 2000);
Shape14.mirror = true;
setRotation(Shape14, 0F, 0F, 0F);
Shape16 = new ModelRenderer(this, 900, 0);
Shape16.addBox(-23F, -105F, -24F, 48, 3, 48);
Shape16.setRotationPoint(0F, 0F, 0F);
Shape16.setTextureSize(2000, 2000);
Shape16.mirror = true;
setRotation(Shape16, 0F, 0F, 0F);
Shape17 = new ModelRenderer(this, 1300, 0);
Shape17.addBox(-4F, -125F, -3F, 8, 20, ;
Shape17.setRotationPoint(0F, 0F, 0F);
Shape17.setTextureSize(2000, 2000);
Shape17.mirror = true;
setRotation(Shape17, 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);
Shape1.render(f5);
Shape3.render(f5);
Shape4.render(f5);
Shape5.render(f5);
Shape6.render(f5);
Shape8.render(f5);
Shape9.render(f5);
Shape10.render(f5);
Shape11.render(f5);
Shape13.render(f5);
Shape14.render(f5);
Shape16.render(f5);
Shape17.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 e)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
}
}}