
Mottbro
Members-
Posts
11 -
Joined
-
Last visited
Everything posted by Mottbro
-
Game crashes after adding a custom rendered block
Mottbro replied to Mottbro's topic in Modder Support
Hi Thanks to everyone who replied to me! I have found that the problem was caused by me using mirrored textures in Techne and once I removed those parts it worked fine. Just seems to be a problem with Techne exporting the java code. -
Game crashes after adding a custom rendered block
Mottbro replied to Mottbro's topic in Modder Support
I just corrected that, but it still crashes. -
Game crashes after adding a custom rendered block
Mottbro replied to Mottbro's topic in Modder Support
Hi Thanks for replying Here is the code from the modelcoastercar1 you asked for. https://gist.github.com/anonymous/3e6994de402e790fc596 -
I have just added another custom rendered block to my mod but for some reason, the came seems to crash on launch. I am not sure why this is as I have already added many custom rendered blocks. One difference with this one is that it is larger than one block and has a large number of components, so I don't know how to (or if I need to) do something with custom block bounds??? This is the crash report, which I don't have a clue what it means: ---- Minecraft Crash Report ---- // This doesn't make any sense! Time: 14/07/14 21:33 Description: Initializing game java.lang.NullPointerException: Initializing game at com.mottbro.coastercraftmod.model.ModelCoasterCar1.<init>(ModelCoasterCar1.java:779) at com.mottbro.coastercraftmod.renderer.RenderCoasterCar1.<init>(RenderCoasterCar1.java:26) at com.mottbro.coastercraftmod.lib.ProxyClient.registerRenderInformation(ProxyClient.java:26) at com.mottbro.coastercraftmod.CoastercraftMod.load(CoastercraftMod.java:119) 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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) 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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) 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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:690) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) at net.minecraft.client.Minecraft.run(Minecraft.java:815) at net.minecraft.client.main.Main.main(SourceFile:103) 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:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.mottbro.coastercraftmod.model.ModelCoasterCar1.<init>(ModelCoasterCar1.java:779) at com.mottbro.coastercraftmod.renderer.RenderCoasterCar1.<init>(RenderCoasterCar1.java:26) at com.mottbro.coastercraftmod.lib.ProxyClient.registerRenderInformation(ProxyClient.java:26) at com.mottbro.coastercraftmod.CoastercraftMod.load(CoastercraftMod.java:119) 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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) 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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) 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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:690) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:815) at net.minecraft.client.main.Main.main(SourceFile:103) 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:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_05, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 857006728 bytes (817 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: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML{7.2.211.1121} [Forge Mod Loader] (forgeBin-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized Forge{10.12.2.1121} [Minecraft Forge] (forgeBin-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized coastercraftmod{1.0} [Coastercraft Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: ATI Mobility Radeon HD 5650 GL version 3.2.9712 Compatibility Profile Context, ATI Technologies Inc. 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: ~~ERROR~~ NullPointerException: null Anisotropic Filtering: Off (1)
-
I am pretty sure that I need to sync the data from the server to the client but am unsure on the code. Does anyone know what I should add?
-
Thanks a lot
-
I Just added this to the TileEntity class but it didn't work. - The Blocks rotated back when the world was reloaded. Do you know why it didn't work?
-
Ok Thanks So I need to modify the Tile Entity to write and read from NBT using: @Override public void writeToNBT(NBTTagCompound nbt) { } @Override public void readFromNBT(NBTTagCompound nbt) { } But where does the other 2 lines go and what do I need to substitute in for ***, identifierString and variable (I know it is probably really obvious but I am hopeless )
-
Whichever is easiest to do due to me being a bit of a newbe.
-
Ok so could you give me the code that I need to add? (Sorry I am fairly new to making mods)
-
I have added a custom rendered block to Minecraft and have added some code so that it faces the player when it is placed. The problem is that when I reload the Minecraft world, the rotation of the block is not saved so they all face the default direction. I am pretty sure that there is a fairly simple fix but am not sure what it is. CODE: Block package com.mottbro.coastercraftmod.blocks; import com.mottbro.coastercraftmod.CoastercraftMod; import com.mottbro.coastercraftmod.titleentity.TitleEntityTrackS; import com.mottbro.coastercraftmod.titleentity.TitleEntityTrackStraightS; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class TrackStraightS extends BlockContainer { public TrackStraightS(Material material) { super(material); this.setHardness(2.0F); this.setResistance(5.0F); this.setHardness(4f); this.setCreativeTab(CoastercraftMod.tabMyMod); } public int getRenderType() { return -1; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } //Rotate when placed @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { if (entity == null) { return; } TitleEntityTrackStraightS tile = (TitleEntityTrackStraightS) world.getTileEntity(x, y, z); tile.direction = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3; } @Override public TileEntity createNewTileEntity(World arg0, int arg1) { return new TitleEntityTrackStraightS(); } //Set Icon Image as the Unlocalised Name @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("coastercraftmod" + ":" + this.getUnlocalizedName().substring(5)); } } TileEntity package com.mottbro.coastercraftmod.titleentity; import com.jcraft.jogg.Packet; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TitleEntityTrackStraightS extends TileEntity { //rotate when placed public int direction; } TileEntitySpecialRenderer package com.mottbro.coastercraftmod.renderer; import org.lwjgl.opengl.GL11; import com.mottbro.coastercraftmod.model.ModelSupportBaseConcrete; import com.mottbro.coastercraftmod.model.ModelTrackStraightSupport; import com.mottbro.coastercraftmod.titleentity.TitleEntityTrackStraightS; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; public class RenderTrackStraightSupport extends TileEntitySpecialRenderer { //texture WORKING! private static final ResourceLocation texture = new ResourceLocation("coastercraftmod" + ":" + "textures/model/TrackStraightSupport.png"); private ModelTrackStraightSupport model; private TitleEntityTrackStraightS te; public RenderTrackStraightSupport() { this.model = new ModelTrackStraightSupport(); } @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); this.bindTexture(texture); GL11.glRotatef(180, 0F, 0F, 1F); //Direction when placed TitleEntityTrackStraightS myTile = (TitleEntityTrackStraightS) tileentity; int direction = myTile.direction; GL11.glRotatef(direction * 90, 0.0F, 1.0F, 0.0F); GL11.glPushMatrix(); this.model.renderModel(0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } private int getFacingDirection() { // TODO Auto-generated method stub return 0; } } Thanks for your help!