Jump to content

when multiblock is complete, render model?


Recommended Posts

Im trying to make it so that when you finish my multiblock, it renders a model, ive set up the multiblock correctly, but setting the boolean that allows the  model to render isnt working. heres my code:


multiblock function


public void onBlockAdded(World World, int x, int y, int z)
TileEntityHolomap teh = new TileEntityHolomap();
System.out.println("isMultiBlock called");
    	System.out.println("holomap tileentity is set to not render, checking multiblock");
	if(World.getBlockId(x+1, y, z+1) == Lyoko.blockHolomap.blockID
    			&& World.getBlockId(x+1, y, z) == Lyoko.blockHolomap.blockID
    			&& World.getBlockId(x+1, y, z-1) == Lyoko.blockHolomap.blockID
    			&& World.getBlockId(x, y, z+1) == Lyoko.blockHolomap.blockID
    			&& World.getBlockId(x, y, z) == Lyoko.blockHolomapProjector.blockID
    			&& World.getBlockId(x, y, z-1) == Lyoko.blockHolomap.blockID
    			&& World.getBlockId(x+1, y, z+1) == Lyoko.blockHolomap.blockID
    			&& World.getBlockId(x-1, y, z+1) == Lyoko.blockHolomap.blockID
    			&& World.getBlockId(x-1, y, z) == Lyoko.blockHolomap.blockID
    			&& World.getBlockId(x-1, y, z-1) == Lyoko.blockHolomap.blockID)
    		System.out.println("Holomap Projector Complte");
    		((TileEntityHolomap)teh).shouldRender = true; 




tile entity:


package codelyoko.Client;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;

public class TileEntityHolomap extends TileEntity{

public boolean shouldRender = false;

public Packet getDescriptionPacket()
	NBTTagCompound tag = new NBTTagCompound();
	return new Packet132TileEntityData(xCoord, yCoord, zCoord, 0, tag);

public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
	NBTTagCompound tag = pkt.customParam1;

public void readFromNBT(NBTTagCompound tagCompound)
	this.shouldRender = tagCompound.getBoolean("shouldRender");

public void writeToNBT(NBTTagCompound tagCompound)
	tagCompound.setBoolean("shouldRender", this.shouldRender);



Tile Entity render:


package codelyoko.Client;

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.util.ResourceLocation;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

import org.lwjgl.opengl.GL11;

import codelyoko.common.Lyoko;
import codelyoko.models.ModelHolomapProjector;
import codelyoko.models.ModelSuperComputerInterface;
import codelyoko.models.ModelTowerConsole;
import codelyoko.models.ModelTowerFloor;

public class TileEntityRenderHolomap extends TileEntitySpecialRenderer{
//This method is called when minecraft renders a tile entity

public static Minecraft mc = Minecraft.getMinecraft();
public static String modelfile = "";
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f) {
	//This will move our renderer so that it will be on proper place in the world
	GL11.glTranslatef((float)d, (float)d1, (float)d2);
	/*Note that true tile entity coordinates (tileEntity.xCoord, etc) do not match to render coordinates (d, etc) that are calculated as [true coordinates] - [player coordinates (camera coordinates)]*/
	renderBlockYour(tileEntity.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, Lyoko.blockHolomapProjector);
//And this method actually renders your tile entity
public void renderBlockYour(World world, int i, int j, int k, Block block) {
	TileEntityHolomap teh = (TileEntityHolomap) world.getBlockTileEntity(i, j, k);
			System.out.println("Loading Holomap Model: Default");
			ModelHolomapProjector model = new ModelHolomapProjector();
			Tessellator tessellator = Tessellator.instance;
			//This will make your block brightness dependent from surroundings lighting.
			float f = block.getBlockBrightness(world, i, j, k);
			int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
			int l1 = l % 65536;
			int l2 = l / 65536;
			tessellator.setColorOpaque_F(f, f, f);
			OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2); 

			GL11.glTranslatef(0.0F, 0, 0.0F);
			//This line actually rotates the renderer.
			GL11.glRotatef(0F, 0F, 1F, 0F);
			GL11.glTranslatef(0.5F, -0.5F, 0.5F);
			mc.renderEngine.func_110577_a(new ResourceLocation("codelyoko:textures/blocks/HolomapProjector.png"));
			model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);




ive had the block create the tile entity, registered it, bound the renderer to the tile entity, any one know whats happening? cause i dont


Link to comment
Share on other sites

Hmm i'd set a breakpoint at the place where you set the value to true and see what happens and what the server and client is doing?


Also using breakpoints you could make the program pause whenever the variable is changed, so you can see if it's switched back and forth between true and false :)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

  • 3 weeks later...

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.

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.


  • Create New...

Important Information

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