Jump to content

Azanor

Forge Modder
  • Posts

    15
  • Joined

  • Last visited

Posts posted by Azanor

  1. It seems that textures are getting flipped (or not getting flipped) like they did in previous versions.

     

    Either way, I solved it by creating a custom block renderer and drawing the faces individually and then flipping the textures for the north and east faces.

     

    here is a bit of the code I used:

           @Override
    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,Block block, int modelId, RenderBlocks renderer) {
                            block.setBlockBounds(0, 0, 0, 1, 1, 1);
    		renderer.setRenderBoundsFromBlock(block);
    
    		for (int d = 0; d<6;d++) {
    			ForgeDirection dir1 = ForgeDirection.getOrientation(d);
    			if (block.shouldSideBeRendered(world, x, y, z, dir1.getOpposite().ordinal())) {
    				if (dir1==ForgeDirection.NORTH || dir1==ForgeDirection.EAST) {
    					renderer.flipTexture=true;
    				}
    				switch(d) {
    				case 0:renderer.renderFaceYNeg(block, x, y, z, block.getIcon(world, x, y, z, d));break;
    				case 1:renderer.renderFaceYPos(block, x, y, z, block.getIcon(world, x, y, z, d));break;
    				case 2:renderer.renderFaceZNeg(block, x, y, z, block.getIcon(world, x, y, z, d));break;
    				case 3:renderer.renderFaceZPos(block, x, y, z, block.getIcon(world, x, y, z, d));break;
    				case 4:renderer.renderFaceXNeg(block, x, y, z, block.getIcon(world, x, y, z, d));break;
    				case 5:renderer.renderFaceXPos(block, x, y, z, block.getIcon(world, x, y, z, d));break;
    				}
    				renderer.flipTexture=false;
    			}
    		}
    
    	     renderer.clearOverrideBlockTexture();
                         block.setBlockBounds(0f, 0f, 0f, 1f, 1f, 1f);
                         renderer.setRenderBoundsFromBlock(block);
    }
    

  2. I'm having a strange issue. (Using MCP 72 and Forge 204)

     

    When I run my mod in SSP it work fine. If I create a server and connect to it with a client it also seems to work fine, I can place blocks from my mod, etc.

     

    However after I disconnect and try and reconnect with a client I get the following error:

    [hide]

    2012-08-18 14:04:21 [iNFO] [sTDERR] java.lang.ArrayIndexOutOfBoundsException

    2012-08-18 14:04:21 [iNFO] [sTDERR] at java.lang.System.arraycopy(Native Method)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.src.Chunk.fillChunk(Chunk.java:1367)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.src.NetClientHandler.handleMapChunks(NetClientHandler.java:1090)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.src.Packet56MapChunks.processPacket(Packet56MapChunks.java:154)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.src.TcpConnection.processReadPackets(TcpConnection.java:438)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.src.NetClientHandler.processReadPackets(NetClientHandler.java:99)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.src.GuiConnecting.updateScreen(GuiConnecting.java:42)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1484)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:831)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:761)

    2012-08-18 14:04:21 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

    [/hide]

     

    The server is still running, without any errors, but starting or stopping it doesn't fix anything. Only deleting the server world save works.

     

  3. As an example for when I ran into this issue:

     

    I created a block that "listens" via the hook for specific notes being played by a vanilla noteblock. Everthing works perfectly as long as the player remains within the view distance of the noteblock. Any further and the sounds doesn't play and the hook is never triggered.

     

    However the sound call is still made so in my mind the hook should still trigger, even though the actual sound doesn't play.

     

     

    Anyway, there are a few other issues with this as well, since I suspect this won't work in SMP anyway.

  4. Currently the onPlaySound hook from ISoundHandler is triggered from within the playSound method in SoundManager. playSoundEffect in World first calls playSound in RenderGlobal and in that method a distance check is made to the current renderViewEntity before passing it on to SoundManager.

     

    This means that the Forge hook is never called if the current render entity is out of a certain range of the block.

    Would it be possible to move the call to the hook before the range check is done, either within World or within RenderGlobal ? This way you could still check if a sound was supposed to be played even if it is never actually played due to distance considerations, making it possible to create blocks that can "listen" for certain sounds.

     

    NOTE: The onPlaySoundAtEntity hook in ISoundHandler works correctly as it is triggered within World

×
×
  • Create New...

Important Information

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