NEG2013
-
Posts
123 -
Joined
-
Last visited
Posts posted by NEG2013
-
-
in all do respect im asking how to do it not where to look.
-
so how exactly do i do it correctly?
-
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
-
thank you, however it still doesnt orient right/at all
-
I have to no prevail.
-
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.
-
How do a make a block state change the texture based on an interger like metadata?
-
it doent change the sizee it changes what part of the textures being drawn from so that it changes in appearence
-
yes and i have other buttons just like these that work so idk what it is
-
It just says that the super must be at the bottom try it
-
It throws a error when I put it any where but the bottom
-
It should definitely be visible so idk
-
Okay good point ill try that but I'd still like to know why the way it setup now is not working.
-
because i cant give them custom texture if i use the default buttons
-
I already have it print out when there clicked and become truelike this
if(tabCommunity){
System.out.println("Clicked tab Community");
}
-
screen shot of what exactly?
this is the GUI in game:
-
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.
-
I need to add a button to the main menu how would i do this?
-
-
I changed the for loop so that it binds the texture back every iteration and now they're just solid black.
-
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
-
Ive got it working now
-
but how do i set the registry name??
-
that make no sense the section you quoted is old and works
[1.10.2] directional blocks
in Modder Support
Posted