Jump to content

NEG2013

Members
  • Posts

    123
  • Joined

  • Last visited

Posts posted by NEG2013

  1.  

     

    Time: 8/25/16 5:11 PM
    Description: Initializing game
    
    java.lang.IllegalArgumentException: Cannot set property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockStateContainer{block=null, properties=[]}
    at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:210)
    at com.drunkripper.storageplus.block.node.StorageNode.<init>(StorageNode.java:37)
    at com.drunkripper.storageplus.registry.BlockRegistry.initBlocks(BlockRegistry.java:24)
    at com.drunkripper.storageplus.main.StoragePlus.init(StoragePlus.java:43)
    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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579)
    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.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213)
    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.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)
    at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:774)
    at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:322)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:561)
    at net.minecraft.client.Minecraft.run(Minecraft.java:386)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)
    
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Thread: Client thread
    Stacktrace:
    at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:210)
    at com.drunkripper.storageplus.block.node.StorageNode.<init>(StorageNode.java:37)
    at com.drunkripper.storageplus.registry.BlockRegistry.initBlocks(BlockRegistry.java:24)
    at com.drunkripper.storageplus.main.StoragePlus.init(StoragePlus.java:43)
    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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579)
    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.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213)
    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.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)
    at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:774)
    at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:322)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:561)
    
    -- Initialization --
    Details:
    Stacktrace:
    at net.minecraft.client.Minecraft.run(Minecraft.java:386)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)
    
    -- System Details --
    Details:
    Minecraft Version: 1.10.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_74, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 771644064 bytes (735 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.32 Powered by Forge 12.18.1.2011 4 mods loaded, 4 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCHI	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
    UCHI	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar) 
    UCHI	Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar) 
    UCHE	storageplus{1.2b} [storagePlus] (bin) 
    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13416 Compatibility Profile Context 15.300.1025.1001' Renderer: 'AMD Radeon R7 Graphics'
    Launched Version: 1.10.2
    LWJGL: 2.9.4
    OpenGL: AMD Radeon R7 Graphics GL version 4.5.13416 Compatibility Profile Context 15.300.1025.1001, ATI Technologies Inc.
    GL Caps: Using GL 1.3 multitexturing.
    Using GL 1.3 texture combiners.
    Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
    Shaders are available because OpenGL 2.1 is supported.
    VBOs are available because OpenGL 1.5 is supported.
    
    Using VBOs: Yes
    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)
    CPU: 4x AMD FX-8800P Radeon R7, 12 Compute Cores 4C+8G 

  2. package com.drunkripper.storageplus.block.node;
    
    import java.util.List;
    
    import javax.annotation.Nullable;
    
    import com.drunkripper.storageplus.block.GBlock;
    import com.google.common.base.Predicate;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockHorizontal;
    import net.minecraft.block.material.Material;
    import net.minecraft.block.properties.PropertyBool;
    import net.minecraft.block.properties.PropertyDirection;
    import net.minecraft.block.state.IBlockState;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.util.BlockRenderLayer;
    import net.minecraft.util.EnumFacing;
    import net.minecraft.util.math.AxisAlignedBB;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    
    public class StorageNode extends GBlock {
    
     public static final PropertyDirection FACING = BlockHorizontal.FACING;
    
    
    
    //1 / 16 = 0.0625
    private static final AxisAlignedBB BOUNDING_BOX_DOWN = new AxisAlignedBB(0, 0, 0, 1, 0.25, 1);
    
    public StorageNode(Material materialIn, String name) {
    	super(materialIn, name);
    
    }//constructor
    
    @Override
    public boolean isFullCube(IBlockState state) {
    
    	return false;
    }//isFullCube
    
    
    @Override
    public boolean isOpaqueCube(IBlockState state) {
    
    	return false;
    }//isOpaqueCube
    
    @Override
    public BlockRenderLayer getBlockLayer() {
    
    	return BlockRenderLayer.TRANSLUCENT;
    }//BlockRenderLayer
    
    @Override
    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    
    
    
    
    	return BOUNDING_BOX_DOWN;
    }//getBoundingBox
    
    @Override
    public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
    		List<AxisAlignedBB> collidingBoxes, Entity entityIn) {
    
    	super.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOUNDING_BOX_DOWN);;
    }//addCollisionBoxToList
    
    }//class
    

  3. I'm trying to make a block change appearence based on how its facing, ive looked at the hopper's class and blocks state but still cant figure it out.

     

    blocks state:

    { 
    "forge_marker": 1,
        "defaults": { "model": "storageplus:storage_node_down"
        },
          "variants": {
             "normal": [{}],
             "inventory": [{}],
        
            "facing=down": { "model": "storageplus:storage_node_down" },
            "facing=north": { "model": "storageplus:storage_node_side" },
            "facing=south": { "model": "storageplus:storage_node_side", "y": 180 },
            "facing=west": { "model": "storageplus:storage_node_side", "y": 270 },
            "facing=east": { "model": "storageplus:storage_node_side", "y": 90 }
            "facing=up": { "model": "storageplus:storage_node_up"}
            
            }     
    }
    

     

    I also have no idea how to use enumfacing with a propertydirection.

     

     

     

  4. I'm trying to draw tabs, I have it set up so that when I click a certain area a boolean becomes true and then I'm based on the state of the boolean trying to draw a rectangle so it appears as if the the tab has been select

     

     

    method for drawing the tabs:

     

    public void drawSelectedTab(){
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    
    
    
    
    	int tabOU;
    
    	if(tabOfficial){
    		tabOU = 237;
    	}
    	else{
    		tabOU = 233;
    	}
    
    	//tab Official
    	drawTexturedModalRect(guiX + 203, guiY + 3,              tabOU, 15,             3, 22);
    
    
    	int tabCU;
    	if(tabCommunity){
    		tabCU = 237;
    	}
    	else{
    		tabCU = 233;
    	}
    	//tab Community
    	drawTexturedModalRect(guiX + 203, guiY + 27,             tabCU, 15,             3, 22);
    
    	int tabFU;
    	if(tabFavorites){
    		tabFU = 237;
    	}
    	else{
    		tabFU = 233;
    	}
    	//tab Favorites
    	drawTexturedModalRect(guiX + 203, guiY + 51,             tabFU, 15,             3, 22);	
    
    
    
    }

     

    and heres the part that determines which tab has been selected

    @Override
    protected void mouseClicked(int x, int y, int mouseButton) throws IOException {
    
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    
    	//tab Official
    	if(trueZone(guiX + 205, guiY + 3, 19, 22, x, y)){
    
    		tabOfficial = true;
    		tabCommunity = false;
    		tabFavorites = false;
    
    		if(tabOfficial){
    			System.out.println("Clicked tab Official");
    		}
    	}//tab Official
    
    	//tab Community
    	if(trueZone(guiX + 205, guiY + 27, 19, 22, x, y)){
    
    		tabOfficial = false;
    		tabCommunity = true;
    		tabFavorites = false;
    
    		if(tabCommunity){
    			System.out.println("Clicked tab Community");
    		}			
    	}//tab Community	
    
    	//tab Favorites
    	if(trueZone(guiX + 205, guiY + 51, 19, 22, x, y)){
    
    		tabOfficial = false;
    		tabCommunity = false;
    		tabFavorites = true;
    
    		if(tabFavorites){
    			System.out.println("Clicked tab Favorites");
    		}
    	}//tab Favorites
    
    

     

    Heres the entire class:

    package com.neg2013.main;
    
    import java.io.IOException;
    import java.util.List;
    
    import org.lwjgl.input.Keyboard;
    import org.lwjgl.opengl.GL11;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.gui.GuiButton;
    import net.minecraft.client.gui.GuiScreen;
    import net.minecraft.util.ResourceLocation;
    
    public class GuiServerPicker extends GuiScreen{
    
    int buttonWidth = 194;
    int buttonHeight = 21;
    
    int tabWidth = 19;
    int tabHeight = 22;
    
    int guiWidth = 225;
    int guiHeight = 154;
    
    boolean clicked1 = false;
    boolean clicked2 = false;
    boolean clicked3 = false;
    boolean clicked4 = false;
    boolean clicked5 = false;
    boolean clicked6 = false;
    
    boolean tabOfficial = true;
    boolean tabCommunity = false;
    boolean tabFavorites = false;
    
    int id = 0;
    GuiButton menuButton;
    
    //int serverV = 207;
    int ServersOnPage = 5;
    
    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    	mc.renderEngine.bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/gui.png"));
    	GL11.glColor4f(1, 1, 1, 1);
    	drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
    
    	serverButtons("NEG2013", "Is", "The", "God", "Of", "Sexiness", ServersOnPage);
    	drawSelectedTab();
    
    
    
    
    
    
    
    
    
    
    
    	super.drawScreen(mouseX, mouseY, partialTicks);
    
    }//drawScreen
    
    	//ADD THE PLAYER COUNT	
    
    public void serverButtons(String name1, String name2, String name3, String name4, String name5, String name6, int ServersOnPage){
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    	int color = 0X000000;
    
    
    
    	if(ServersOnPage < 1){
    		return;
    	}
    	//server 1
    		int i = 0;
    		int serverV;
    
    		if(clicked1){
    			serverV = 229;
    		}
    		else{
    			serverV = 207;
    		}
    
    		fontRendererObj.drawString( name1, guiX + 8 , guiY + 10 + (25 * i), color);
    		mc.renderEngine.bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/gui.png"));
    		GL11.glColor4f(1, 1, 1, 1);	
    		drawTexturedModalRect(guiX + 4 , guiY + 4 + (25 * i), 1, serverV, buttonWidth, buttonHeight);
    		fontRendererObj.drawString( name1, guiX + 4 + 4 , guiY + 4 + 6 + (25 * i), color);
    			//server 1 end
    
    
    	if(ServersOnPage < 2){
    		return;
    	}
    	//server 2
    		int i1 = 1;
    		int server1V;
    
    		if(clicked2){
    			server1V = 229;
    		}
    		else{
    			server1V = 207;
    		}
    
    		fontRendererObj.drawString( name2, guiX + 8 , guiY + 10 + (25 * i1), color);
    		mc.renderEngine.bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/gui.png"));
    		GL11.glColor4f(1, 1, 1, 1);	
    		drawTexturedModalRect(guiX + 4 , guiY + 4 + (25 * i1), 1, server1V, buttonWidth, buttonHeight);
    		fontRendererObj.drawString( name2, guiX + 4 + 4 , guiY + 4 + 6 + (25 * i1), color);
    			//server 3 end
    
    	if(ServersOnPage < 3){
    		return;
    	}
    	//server 3
    		int i2 = 2;
    		int server2V;
    
    		if(clicked3){
    			server2V = 229;
    		}
    		else{
    			server2V = 207;
    		}
    
    		fontRendererObj.drawString( name3, guiX + 8 , guiY + 10 + (25 * i2), color);
    		mc.renderEngine.bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/gui.png"));
    		GL11.glColor4f(1, 1, 1, 1);	
    		drawTexturedModalRect(guiX + 4 , guiY + 4 + (25 * i2), 1, server2V, buttonWidth, buttonHeight);
    		fontRendererObj.drawString( name3, guiX + 4 + 4 , guiY + 4 + 6 + (25 * i2), color);
    			//server 3 end
    
    	if(ServersOnPage < 4){
    		return;
    	}
    	//server 4
    		int i3 = 3;
    		int server3V;
    
    		if(clicked4){
    			server3V = 229;
    		}
    		else{
    			server3V = 207;
    		}
    
    		fontRendererObj.drawString( name4, guiX + 8 , guiY + 10 + (25 * i3), color);
    		mc.renderEngine.bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/gui.png"));
    		GL11.glColor4f(1, 1, 1, 1);	
    		drawTexturedModalRect(guiX + 4 , guiY + 4 + (25 * i3), 1, server3V, buttonWidth, buttonHeight);
    		fontRendererObj.drawString( name4, guiX + 4 + 4 , guiY + 4 + 6 + (25 * i3), color);
    			//server 4 end
    
    	if(ServersOnPage < 5){
    		return;
    	}
    	//server 5
    		int i4 = 4;
    		int server4V;
    
    		if(clicked5){
    			server4V = 229;
    		}
    		else{
    			server4V = 207;
    		}
    
    		fontRendererObj.drawString( name5, guiX + 8 , guiY + 10 + (25 * i4), color);
    		mc.renderEngine.bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/gui.png"));
    		GL11.glColor4f(1, 1, 1, 1);	
    		drawTexturedModalRect(guiX + 4 , guiY + 4 + (25 * i4), 1, server4V, buttonWidth, buttonHeight);
    		fontRendererObj.drawString( name5, guiX + 4 + 4 , guiY + 4 + 6 + (25 * i4), color);
    			//server 5 end
    
    	if(ServersOnPage < 6){
    		return;
    	}
    	//server 6
    		int i5 = 5;
    		int server5V;
    
    		if(clicked6){
    			server5V = 229;
    		}
    		else{
    			server5V = 207;
    		}
    
    		fontRendererObj.drawString( name6, guiX + 8 , guiY + 10 + (25 * i5), color);
    		mc.renderEngine.bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/gui.png"));
    		GL11.glColor4f(1, 1, 1, 1);	
    		drawTexturedModalRect(guiX + 4 , guiY + 4 + (25 * i5), 1, server5V, buttonWidth, buttonHeight);
    		fontRendererObj.drawString( name6, guiX + 4 + 4 , guiY + 4 + 6 + (25 * i5), color);
    			//server 6 end
    			if(ServersOnPage > 6){
    				return;
    			}
    
    
    }//serverButtons
    
    /*if(tabOfficial){
    				//tab1
    				drawTexturedModalRect(guiX + 203, guiY + 3,              237, 15,             3, 22);
    
    				//tab2
    				drawTexturedModalRect(guiX + 203, guiY + 27,             233, 15,             3, 22);
    
    				//tab3
    				drawTexturedModalRect(guiX + 203, guiY + 51,             233, 15,             3, 22);
    
    			}//tabO
    
    			if(tabCommunity){
    				//tab1
    				drawTexturedModalRect(guiX + 203, guiY + 3,              233, 15,             3, 22);
    
    				//tab2
    				drawTexturedModalRect(guiX + 203, guiY + 27,             237, 15,            3, 22);
    
    				//tab3
    				drawTexturedModalRect(guiX + 203, guiY + 51,             233, 15,             3, 22);
    
    			}//tabC
    
    			if(tabFavorites){
    				//tab1
    				drawTexturedModalRect(guiX + 203, guiY + 3,              233, 15,            3, 22);
    
    				//tab2
    				drawTexturedModalRect(guiX + 203, guiY + 27,             233, 15,             3, 22);
    
    				//tab3
    				drawTexturedModalRect(guiX + 203, guiY + 51,             237, 15,             3, 22);
    
    			}//tabF*/
    
    public void connectToServers(){
    
    	//server 1
    
    	if(clicked1){
    
    	}
    
    	//server 2
    	if(clicked1){
    
    	}
    
    	//server 3
    	if(clicked1){
    
    	}
    
    	//server 4
    	if(clicked1){
    
    	}//server 5
    
    	if(clicked1){
    
    	}
    
    	//server 6
    	if(clicked1){
    
    	}
    
    }//connectToServers
    
    
    
    public void drawSelectedTab(){
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    
    
    
    
    	int tabOU;
    
    	if(tabOfficial){
    		tabOU = 237;
    	}
    	else{
    		tabOU = 233;
    	}
    
    	//tab Official
    	drawTexturedModalRect(guiX + 203, guiY + 3,              tabOU, 15,             3, 22);
    
    
    	int tabCU;
    	if(tabCommunity){
    		tabCU = 237;
    	}
    	else{
    		tabCU = 233;
    	}
    	//tab Community
    	drawTexturedModalRect(guiX + 203, guiY + 27,             tabCU, 15,             3, 22);
    
    	int tabFU;
    	if(tabFavorites){
    		tabFU = 237;
    	}
    	else{
    		tabFU = 233;
    	}
    	//tab Favorites
    	drawTexturedModalRect(guiX + 203, guiY + 51,             tabFU, 15,             3, 22);	
    
    
    
    }
    	public boolean trueZone(int OffsX, int OffsY, int Width, int Height, int MouseX, int MouseY){
    	if(OffsX <= MouseX && MouseX <= OffsX + Width && OffsY <= MouseY && MouseY <= OffsY + Height ){
    		return true;
    	}
    	else{
    		return false;	
    	}
    
    
    }
    @Override
    protected void mouseClicked(int x, int y, int mouseButton) throws IOException {
    
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    
    	//tab Official
    	if(trueZone(guiX + 205, guiY + 3, 19, 22, x, y)){
    
    		tabOfficial = true;
    		tabCommunity = false;
    		tabFavorites = false;
    
    		if(tabOfficial){
    			System.out.println("Clicked tab Official");
    		}
    	}//tab Official
    
    	//tab Community
    	if(trueZone(guiX + 205, guiY + 27, 19, 22, x, y)){
    
    		tabOfficial = false;
    		tabCommunity = true;
    		tabFavorites = false;
    
    		if(tabCommunity){
    			System.out.println("Clicked tab Community");
    		}			
    	}//tab Community	
    
    	//tab Favorites
    	if(trueZone(guiX + 205, guiY + 51, 19, 22, x, y)){
    
    		tabOfficial = false;
    		tabCommunity = false;
    		tabFavorites = true;
    
    		if(tabFavorites){
    			System.out.println("Clicked tab Favorites");
    		}
    	}//tab Favorites
    
    
    
    
    	if(ServersOnPage < 1){
    		return;
    	}
    	//server1
    	if(guiX + 0 <= x && x <= guiX + 0 + buttonWidth && guiY + 0 <= y && y <= guiY + 0 + buttonHeight ){
    		System.out.println("Clicked Server 1");
    		clicked1 = true;
    		clicked2 = false;
    		clicked3 = false;
    		clicked4 = false;
    		clicked5 = false;
    		clicked6 = false;
    	}
    	if(ServersOnPage < 2){
    		return;
    	}
    	//server2
    	int i1 = 1;
    	if(guiX + 0 <= x && x <= guiX + 0 + buttonWidth && guiY + 0  + (25 * i1) <= y && y <= guiY + 0  + (25 * i1) + buttonHeight ){
    		System.out.println("Clicked Server 2");
    		clicked1 = false;
    		clicked2 = true;
    		clicked3 = false;
    		clicked4 = false;
    		clicked5 = false;
    		clicked6 = false;
    	}
    	if(ServersOnPage < 3){
    		return;
    	}
    	//server3
    	int i2 = 2;
    	if(guiX + 0 <= x && x <= guiX + 0 + buttonWidth && guiY + 0  + (25 * i2) <= y && y <= guiY + 0  + (25 * i2) + buttonHeight ){
    		System.out.println("Clicked Server 3");
    		clicked1 = false;
    		clicked2 = false;
    		clicked3 = true;
    		clicked4 = false;
    		clicked5 = false;
    		clicked6 = false;
    	}
    	if(ServersOnPage < 4){
    		return;
    	}
    	//server4
    	int i3 = 3;
    	if(guiX + 0 <= x && x <= guiX + 0 + buttonWidth && guiY + 0  + (25 * i3)<= y && y <= guiY + 0 + (25 * i3) + buttonHeight ){
    		System.out.println("Clicked Server 4");
    		clicked1 = false;
    		clicked2 = false;
    		clicked3 = false;
    		clicked4 = true;
    		clicked5 = false;
    		clicked6 = false;
    	}
    	if(ServersOnPage < 5){
    		return;
    	}
    	//server5
    	int i4 = 4;
    	if(guiX + 0 <= x && x <= guiX + 0 + buttonWidth && guiY + 0 + (25 * i4) <= y && y <= guiY + 0 + (25 * i4) + buttonHeight ){
    		System.out.println("Clicked Server 5");
    		clicked1 = false;
    		clicked2 = false;
    		clicked3 = false;
    		clicked4 = false;
    		clicked5 = true;
    		clicked6 = false;
    	}
    	if(ServersOnPage < 6){
    		return;
    	}
    	//server6
    	int i5 = 5;
    	if(guiX + 0 <= x && x <= guiX + 0 + buttonWidth && guiY + 0 + (25 * i5) <= y && y <= guiY + 0 + (25 * i5) + buttonHeight ){
    		System.out.println("Clicked Server 6");
    		clicked1 = false;
    		clicked2 = false;
    		clicked3 = false;
    		clicked4 = false;
    		clicked5 = false;
    		clicked6 = true;
    	}
    
    
    	super.mouseClicked(x, y, mouseButton);}//mouseclicked
    @Override
    protected void actionPerformed(GuiButton button) throws IOException {
    
    	switch(button.id){
    
    	case 666:
    
    		Minecraft.getMinecraft().displayGuiScreen(new GuiServerPicker());
    
    	break;
    
    	}
    
    	super.actionPerformed(button);}	
    @Override
    public void initGui() {
    	buttonList.clear();
    	buttonList.add(menuButton = new GuiButton(666, 0, 0, "NEG2013"));
    
    
    	super.initGui();
    }	
    @Override
    protected void keyTyped(char c, int key) throws IOException {
    
    	switch(key){
    	case Keyboard.KEY_E:
    		Minecraft.getMinecraft().displayGuiScreen(null);
    	break;
    
    
    
    
    	}//switch
    
    	super.keyTyped(c, key);
    }//keyTyped	
    @Override
    public boolean doesGuiPauseGame() {
    	return false;
    }//doesGuiPauseGame
    }//class
    
    
    

     

     

     

    If you want to see anything else please just ask.

     

     

  5. When I use a for loop to draw buttons the first ones draw normal and then the rest all draw weird

     

    heres the gui class

    package com.neg2013.main;
    
    import java.io.IOException;
    
    import org.lwjgl.input.Keyboard;
    import org.lwjgl.opengl.GL11;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.gui.GuiButton;
    import net.minecraft.client.gui.GuiScreen;
    import net.minecraft.util.ResourceLocation;
    
    public class GuiServerPicker extends GuiScreen{
    
    int tabWidth = 194;
    int tabHeight = 21;
    
    int guiWidth = 247;
    int guiHeight = 165;
    
    boolean clicked1 = false;
    boolean clicked2 = false;
    
    int id = 0;
    GuiButton serverButton;
    
    int serverV = 207;
    
    int ServersOnPage = 6;
    
    
    
    
    
    
    
    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    	mc.renderEngine.bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/gui.png"));
    
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    	GL11.glColor4f(1, 1, 1, 1);
    
    	if(clicked1){
    		serverV = 207;//229
    	}
    	else{
    		serverV = 207;
    	}
    
    
    	//the gui
    	drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
    
    
    
    
    	for(int i = 0; i < ServersOnPage; i++){
    	drawTexturedModalRect(guiX + 4 , guiY + 4+ (25 * i), 1, serverV, tabWidth, tabHeight);
    
    
    	fontRendererObj.drawString( "Server " + (i + 1),              guiX + 4 + 4 , guiY + 4 + 6 + (25 * i),          0X000000);
    	}
    
    
    
    
    
    	//drawDefaultBackground();
    
    
    
    	super.drawScreen(mouseX, mouseY, partialTicks);
    }//drawScreen
    
    
    
    
    @Override
    public void initGui() {
    
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    
    	buttonList.clear();
    	//buttonList.add(serverButton = new GuiButton(id, guiX, guiY, 194, 21, "ServerTest"));
    
    	super.initGui();
    }//initGui
    
    @Override
    protected void actionPerformed(GuiButton button) throws IOException {
    
    	switch(button.id){
    	case 0:
    
    
    	break;
    
    
    	}//switch
    
    
    	super.actionPerformed(button);
    }//acttionPerformed
    
    @Override
    protected void keyTyped(char c, int key) throws IOException {
    
    	switch(key){
    	case Keyboard.KEY_E:
    		Minecraft.getMinecraft().displayGuiScreen(null);
    	break;
    
    
    
    
    	}//switch
    
    	super.keyTyped(c, key);
    }//keyTyped
    
    
    //drawTexturedModalRect(guiX + 4, guiY + 4, 1, 229, tabWidth, tabHeight);
    
    
    
    
    
    
    @Override
    protected void mouseClicked(int x, int y, int mouseButton) throws IOException {
    
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    	if(guiX + 0 <= x && x <= guiX + 0 + tabWidth && guiY + 0 <= y && y <= guiY + 0 + tabHeight ){
    		System.out.println("clicked1");
    		clicked1 = true;
    		clicked2 = false;
    	}
    
    
    
    
    	super.mouseClicked(x, y, mouseButton);
    	}//mouseclicked
    
    
    
    @Override
    public boolean doesGuiPauseGame() {
    	return false;
    }//doesGuiPauseGame
    }//class
    
    

     

    and this is what it looks like

     

     

×
×
  • Create New...

Important Information

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