Jump to content

[1.7.10] [SOLVED] Make a Cauldron with a Different Liquid


TheFreeHigh

Recommended Posts

I was trying to make a BlockCauldron that Renders with any liquid, but is Hard-Coded to Water on RenderBlocks. I tried with TileEntityRenderer:

package hyghlander.mods.DragonScales.common.blocks.tile;

import hyghlander.mods.DragonScales.common.blocks.BlockModCauldron;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCauldron;
import net.minecraft.block.BlockLiquid;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;

public class TileEntityModCauldronRenderer extends TileEntitySpecialRenderer {

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float size) {
	RenderBlocks renderer = RenderBlocks.getInstance();
	Block block =  te.blockType;
	renderer.renderStandardBlock(block, (int)x, (int)y, (int)z);
        Tessellator tessellator = Tessellator.instance;
        tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, (int)x, (int)y, (int)z));
        int l = block.colorMultiplier(renderer.blockAccess, (int)x, (int)y, (int)z);
        float f = (float)(l >> 16 & 255) / 255.0F;
        float f1 = (float)(l >> 8 & 255) / 255.0F;
        float f2 = (float)(l & 255) / 255.0F;
        float f4;

        if (EntityRenderer.anaglyphEnable)
        {
            float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
            f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
            float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
            f = f3;
            f1 = f4;
            f2 = f5;
        }

        tessellator.setColorOpaque_F(f, f1, f2);
        IIcon iicon1 = block.getBlockTextureFromSide(2);
        f4 = 0.125F;
        renderer.renderFaceXPos(block, (double)((float)x - 1.0F + f4), (double)y, (double)z, iicon1);
        renderer.renderFaceXNeg(block, (double)((float)x + 1.0F - f4), (double)y, (double)z, iicon1);
        renderer.renderFaceZPos(block, (double)x, (double)y, (double)((float)z - 1.0F + f4), iicon1);
        renderer.renderFaceZNeg(block, (double)x, (double)y, (double)((float)z + 1.0F - f4), iicon1);
        IIcon iicon2 = BlockModCauldron.getCauldronIcon("inner");
        renderer.renderFaceYPos(block, (double)x, (double)((float)y - 1.0F + 0.25F), (double)z, iicon2);
        renderer.renderFaceYNeg(block, (double)x, (double)((float)y + 1.0F - 0.75F), (double)z, iicon2);
        int i1 = renderer.blockAccess.getBlockMetadata((int)x, (int)y, (int)z);

        if (i1 > 0)
        {
            IIcon iicon = BlockLiquid.getLiquidIcon("lava_still");
            renderer.renderFaceYPos(block, (double)x, (double)((float)y - 1.0F + BlockModCauldron.getRenderLiquidLevel(i1)), (double)z, iicon);
        }
}

}

 

But it gave the Crash when the Block was created:

---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 19/02/16 07:30
Description: Rendering Block Entity

java.lang.NullPointerException: Rendering Block Entity
at net.minecraft.block.Block.getMixedBrightnessForBlock(Block.java:608)
at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithColorMultiplier(RenderBlocks.java:6176)
at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4427)
at hyghlander.mods.DragonScales.common.blocks.tile.TileEntityModCauldronRenderer.renderTileEntityAt(TileEntityModCauldronRenderer.java:20)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at net.minecraft.block.Block.getMixedBrightnessForBlock(Block.java:608)
at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithColorMultiplier(RenderBlocks.java:6176)
at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4427)
at hyghlander.mods.DragonScales.common.blocks.tile.TileEntityModCauldronRenderer.renderTileEntityAt(TileEntityModCauldronRenderer.java:20)

-- Block Entity Details --
Details:
Name: null // hyghlander.mods.DragonScales.common.blocks.tile.TileEntityModCauldron
Block type: ID #179 (tile.essentiaCauldron // hyghlander.mods.DragonScales.common.blocks.BlockModCauldron)
Block data value: 3 / 0x3 / 0b0011
Block location: World: (544,70,349), Chunk: (at 0,4,13 in 34,21; contains blocks 544,0,336 to 559,255,351), Region: (1,0; contains chunks 32,0 to 63,31, blocks 512,0,0 to 1023,255,511)
Actual block type: ID #179 (tile.essentiaCauldron // hyghlander.mods.DragonScales.common.blocks.BlockModCauldron)
Actual block data value: 3 / 0x3 / 0b0011
Stacktrace:
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141)
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:539)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player583'/192, l='MpServer', x=544,69, y=71,93, z=349,67]]
Chunk stats: MultiplayerChunkCache: 5, 5
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (196,64,232), Chunk: (at 4,4,8 in 12,14; contains blocks 192,0,224 to 207,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 19239 game time, 6314 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 25 total; [EntityClientPlayerMP['Player583'/192, l='MpServer', x=544,69, y=71,93, z=349,67], EntityCreeper['Creeper'/194, l='MpServer', x=552,28, y=54,15, z=325,31], EntityItem['item.tile.flower2.poppy'/195, l='MpServer', x=572,25, y=61,98, z=346,06], EntityItem['item.item.seeds'/196, l='MpServer', x=564,28, y=62,00, z=338,34], EntitySquid['Squid'/197, l='MpServer', x=575,10, y=58,88, z=340,14], EntitySquid['Squid'/198, l='MpServer', x=572,66, y=59,09, z=338,05], EntityTrail['unknown'/326, l='MpServer', x=544,69, y=71,93, z=349,67], EntityCow['Cow'/199, l='MpServer', x=547,63, y=69,15, z=359,53], EntityCow['Cow'/200, l='MpServer', x=558,97, y=69,15, z=364,09], EntityBat['Bat'/201, l='MpServer', x=532,34, y=54,10, z=330,75], EntityCow['Cow'/202, l='MpServer', x=516,03, y=66,15, z=327,03], EntityCow['Cow'/203, l='MpServer', x=532,09, y=68,15, z=311,03], EntityZombie['Zombie'/204, l='MpServer', x=567,50, y=47,15, z=311,50], EntityItem['item.item.seeds'/205, l='MpServer', x=589,78, y=61,42, z=360,59], EntityCreeper['Creeper'/206, l='MpServer', x=553,44, y=17,15, z=298,56], EntityCreeper['Creeper'/207, l='MpServer', x=554,41, y=15,15, z=291,06], EntityZombie['Zombie'/208, l='MpServer', x=548,50, y=17,15, z=297,50], EntityZombie['Zombie'/209, l='MpServer', x=544,50, y=17,15, z=295,50], EntityZombie['Zombie'/210, l='MpServer', x=549,50, y=17,15, z=298,50], EntityCreeper['Creeper'/211, l='MpServer', x=558,97, y=48,15, z=300,53], EntitySpider['Spider'/212, l='MpServer', x=529,60, y=19,15, z=289,13], EntityWitch['Witch'/213, l='MpServer', x=562,50, y=45,15, z=290,50], EntityChicken['Chicken'/214, l='MpServer', x=520,47, y=66,46, z=393,56], EntityCow['Cow'/215, l='MpServer', x=505,85, y=68,15, z=315,84], EntitySkeleton['Skeleton'/216, l='MpServer', x=527,69, y=16,15, z=298,94]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
at net.minecraft.client.Minecraft.run(Minecraft.java:984)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_66, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 767999600 bytes (732 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 13, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 7 mods loaded, 7 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
UCHIJAAAA	Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
UCHIJAAAA	BRForgersCore{1.5.1} [bRForgersCore] (BRForgersCore-1.5.1-dev.jar) 
UCHIJAAAA	DragonScalesEX{1.0.1} [Dragon Scales EX Mod] (bin) 
UCHIJAAAA	iChunUtil{4.2.2} [iChunUtil] (iChunUtil-4.2.2-deobf.jar) 
UCHIJAAAA	Tabula{4.1.1} [Tabula] (Tabula-4.1.1-deobf.jar) 
GL info: ' Vendor: 'Intel' Version: '2.1.0 - Build 8.15.10.2993' Renderer: 'Intel(R) HD Graphics'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: Intel(R) HD Graphics GL version 2.1.0 - Build 8.15.10.2993, Intel
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because ARB_framebuffer_object is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)

 

Any Idea of what happened or how to do this? I'm horrible with Rendering that doesn't use Models.

(Also, I registered the TileEntity to the Renderer and set the Block to BlockContainer and copied most part of the BlockCauldron)

Link to comment
Share on other sites

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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