net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer Java Examples

The following examples show how to use net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderChunkSchematicVbo.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void addTileEntity(BlockPos pos, CompiledChunk compiledChunk, Set<TileEntity> tileEntities)
{
    TileEntity te = this.schematicWorldView.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);

    if (te != null)
    {
        TileEntitySpecialRenderer<TileEntity> tesr = TileEntityRendererDispatcher.instance.<TileEntity>getRenderer(te);

        if (tesr != null)
        {
            compiledChunk.addTileEntity(te);

            if (tesr.isGlobalRenderer(te))
            {
                tileEntities.add(te);
            }
        }
    }
}
 
Example #2
Source File: ShipStorage.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void setTESRs() {
	tesrs.clear();
	for (BlockStorage bs : blockMap.values()) {
		if (bs.tileentity != null) {
			@SuppressWarnings("rawtypes")
			TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.renderers
					.get(bs.tileentity.getClass());
			if (renderer != null)
				tesrs.add(bs.tileentity);
		}
	}
}
 
Example #3
Source File: ClientProxy.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void registerRenderInfo()
{
    BlockBabyChest.pRenderID = RenderingRegistry.getNextAvailableRenderId();
    TileEntitySpecialRenderer render = new RenderBabyChest();

    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MainRegistry._mBlockBabyChest), new RenderItemBabyChest());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBabyChest.class, render);

    MinecraftForge.EVENT_BUS.register(CONFIG_HANDLER);
}
 
Example #4
Source File: ItemRenderTileEntity.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ItemRenderTileEntity(TileEntitySpecialRenderer renderer, T tile) {
    this.renderer = renderer;
    this.tile = tile;

    if(tile.getWorldObj() == null) {
        tile.setWorldObj(FAKE_WORLD);
    }
}
 
Example #5
Source File: ItemRenderStoneMachine.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void registerRenderer(int metadata, TileEntity tile, TileEntitySpecialRenderer renderer) {
    RenderInfo info = new RenderInfo();
    info.renderer = renderer;
    info.tile = tile;
    renderers.put(metadata, info);

    if(tile.getWorldObj() == null) {
        tile.setWorldObj(FAKE_WORLD);
    }
}
 
Example #6
Source File: RenderTileStickyJar.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
    if(tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) {
        TileStickyJar stickyJar = (TileStickyJar) tile;

        TileJarFillable parent = stickyJar.getParent();
        World world = tile.getWorldObj();
        Block block = stickyJar.getParentBlock();

        GL11.glPushMatrix();

        GL11.glTranslated(x, y, z);
        rotateJar(stickyJar.placedOn, ForgeDirection.getOrientation(stickyJar.facing));

        //TESR
        TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(parent);
        if(renderer != null) {
            stickyJar.syncToParent();

            renderer.renderTileEntityAt(parent, 0, 0, 0, partialTicks);

            stickyJar.syncFromParent();
        }

        //ISimpleBlockHandler
        GL11.glPushMatrix();
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        bindTexture(TextureMap.locationBlocksTexture);

        RENDER_BLOCKS.blockAccess = world;

        Tessellator tess = Tessellator.instance;
        tess.startDrawingQuads();

        tess.setNormal(0, -stickyJar.placedOn.offsetY, -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX));

        tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord);

        RENDER_BLOCKS.renderBlockByRenderType(block, tile.xCoord, tile.yCoord, tile.zCoord);

        tess.setTranslation(0, 0, 0);
        tess.draw();

        GL11.glPopAttrib();
        GL11.glPopMatrix();

        GL11.glPopMatrix();
    }
}
 
Example #7
Source File: ItemRenderTileEntityMulti.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public RenderSet(TileEntitySpecialRenderer renderer, TileEntity te, int meta) {
    this.renderer = renderer;
    this.te = te;
    this.meta = meta;
}
 
Example #8
Source File: SimpleModelTileEntityRenderer.java    From OpenModsLib with MIT License 4 votes vote down vote up
public static <T extends OpenTileEntity> TileEntitySpecialRenderer<T> create(ITileEntityModel<T> model, ResourceLocation texture) {
	return new SimpleModelTileEntityRenderer<>(model, texture);
}
 
Example #9
Source File: ClientProxy.java    From Artifacts with MIT License 4 votes vote down vote up
@Override
	public void registerRenders() {
		
		int r = RenderingRegistry.getNextAvailableRenderId();
		ISimpleBlockRenderingHandler handler = new RenderFakeBlock(r);
		RenderingRegistry.registerBlockHandler(handler);
		((BlockIllusionary)BlockIllusionary.instance).renderType = r;
//		GameRegistry.registerTileEntity(TileEntitySpikes.class, "artifacts.spiketrap");
		
		r = RenderingRegistry.getNextAvailableRenderId();
		handler = new RenderArrowTrap(r);
		RenderingRegistry.registerBlockHandler(handler);
		((BlockTrap)BlockTrap.instance).renderType = r;
//		GameRegistry.registerTileEntity(TileEntityTrap.class, "artifacts.arrowtrap");

//		r = RenderingRegistry.getNextAvailableRenderId();
//		handler = new RenderQuickSand(r);
//		RenderingRegistry.registerBlockHandler(handler);
//		((BlockQuickSand)BlockQuickSand.instance).renderType = r;
		
		r = RenderingRegistry.getNextAvailableRenderId();
		handler = new RenderCoverPlate(r);
		RenderingRegistry.registerBlockHandler(handler);
		((BlockCoverPlate)BlockCoverPlate.instance).renderType = r;
        RenderingRegistry.registerEntityRenderingHandler(EntityClayGolem.class, new RenderClayGolem());
        
		TileEntitySpecialRenderer render = new TESwordRenderer();
		ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySword.class, render);
        MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockSword.instance), new ItemRenderPedestal(render, new TileEntitySword()));
		
        render = new PedestalRenderer();
		ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayPedestal.class, render);
        MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockPedestal.instance), new ItemRenderPedestal(render, new TileEntityDisplayPedestal()));
        
        render = new SpikesRenderer();
        ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySpikes.class, render);
        MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockSpikes.instance), new ItemRenderPedestal(render, new TileEntitySpikes()));
        
        r = RenderingRegistry.getNextAvailableRenderId();
        handler = new RenderLaserBeam(r);
		RenderingRegistry.registerBlockHandler(handler);
		((BlockLaserBeam)BlockLaserBeam.instance).renderID = r;

        r = RenderingRegistry.getNextAvailableRenderId();
        handler = new RenderLaserSource(r);
		RenderingRegistry.registerBlockHandler(handler);
		((BlockLaserBeamSource)BlockLaserBeamSource.instance).renderID = r;
		
		if(Loader.isModLoaded("antiqueatlas")) {
//			AtlasAPI.getTileAPI().setTexture("wizardtower", new ResourceLocation("artifacts:textures/gui/tower.png"));
		}
	}
 
Example #10
Source File: ItemRenderPedestal.java    From Artifacts with MIT License 4 votes vote down vote up
public ItemRenderPedestal(TileEntitySpecialRenderer render, TileEntity dummy) {
    this.render = render;
    this.dummytile = dummy;
}
 
Example #11
Source File: ItemRenderSpikes.java    From Artifacts with MIT License 4 votes vote down vote up
public ItemRenderSpikes(TileEntitySpecialRenderer render, TileEntity dummy) {
    this.render = render;
    this.dummytile = dummy;
}