Everything posted by Alexiy
-
Problem with setBlock
Send the coordinates where the block is placed, ID (and meta) to server and do setBlock in packet handler.
-
Problem with setBlock
If you set on client only, they will disappear.
-
Tile rendering bug (1.6.4)
I couldn't identify the issue, now I use ISimpleBlockRenderingHandler instead.
-
Tile rendering bug (1.6.4)
I have a Tile entity which sides can be "closed". When side is closed, it renders a rectangle at that side. But it doesn't render at certain angles, watch - http://www.youtube.com/watch?v=Lc0WRoUvs6c&feature=youtu.be. Renderer: public class HolderRenderer extends TileEntitySpecialRenderer { @SuppressWarnings("incomplete-switch") @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { TileeMover mover=(TileeMover) tileentity; glPushMatrix(); glTranslated(x, y, z); glColor3f(0.6f, 0.2f, 0.8f); for(ForgeDirection direction:mover.closedSides) { glBegin(GL_QUADS); switch(direction) { case NORTH: glVertex3f(0, 0, 0.01f); glVertex3f(0, 1f, 0.01f); glVertex3f(1f, 1f,0.01f); glVertex3f(1f, 0,0.01f); glVertex3f(0, 0, 0.01f); glVertex3f(1f, 0,0.01f); glVertex3f(1f, 1f,0.01f); glVertex3f(0, 1f, 0.01f); glEnd();break; case EAST: glVertex3f(0.99f, 0, 0f); glVertex3f(0.99f, 1f, 0f); glVertex3f(0.99f, 1f,1f); glVertex3f(0.99f, 0,1f); glVertex3f(0.99f, 0, 0f); glVertex3f(0.99f, 0,1f); glVertex3f(0.99f, 1f,1f); glVertex3f(0.99f, 1f, 0f); glEnd();break; case WEST: glVertex3f(0.01f, 0, 0f); glVertex3f(0.01f, 0 ,1f); glVertex3f(0.01f, 1f,1f); glVertex3f(0.01f, 1f, 0f); glVertex3f(0.01f, 0, 0f); glVertex3f(0.01f, 1f, 0f); glVertex3f(0.01f, 1f,1f); glVertex3f(0.01f, 0 ,1f); glEnd();break; case SOUTH: glVertex3f(0, 0, 0.99f); glVertex3f(1, 0, 0.99f); glVertex3f(1f, 1,0.99f); glVertex3f(0, 1,0.99f); glVertex3f(0, 0, 0.99f); glVertex3f(0, 1,0.99f); glVertex3f(1f, 1,0.99f); glVertex3f(1, 0, 0.99f); glEnd();break; case DOWN: glVertex3f(0,0.01f, 0f); glVertex3f(1, 0.01f, 0f); glVertex3f(1f, 0.01f,1f); glVertex3f(0, 0.01f,1f); glVertex3f(0,0.01f, 0f); glVertex3f(0, 0.01f,1f); glVertex3f(1f, 0.01f,1f); glVertex3f(1, 0.01f, 0f); glEnd();break; case UP: glVertex3f(0,0.99f, 0f); glVertex3f(0, 0.99f,1f); glVertex3f(1f, 0.99f,1f); glVertex3f(1, 0.99f, 0f); glVertex3f(0,0.99f, 0f); glVertex3f(1, 0.99f, 0f); glVertex3f(1f, 0.99f,1f); glVertex3f(0, 0.99f,1f); glEnd();break; } } glPopMatrix(); } }
-
Scaling GUI Overlays
I can't look at the code now, but yes, use Scaled resolution - create one every time before rendering and use its getScaledWidth, getScaledHeight.
-
[1.6.4] Instance in GuiHandler not registering
Will using player.openGui instead of FMLNetworkHandler.openGui change anything?
-
[1.5.2] Tile entity data on server gets reset
Did you override the onDataPacket and getDescriptionPacket methods in Tile entity?
-
Coding standards
One thing I found useful is if you have keybindings, it is better to prefix them with your mod name or alias. Because when there are many keybindings in controls list you have no idea what mod they come from since almost no mod prefixes them with its name.
-
Blocks/TileEntitys Not Acting Seperately
In minecraft there is only one Block instance for each type. So you have to change metadata for your goal. Use world.setBlockMetadataWithNotify.
-
Opening GuiScreen?
Does your @Mod class have @NetworkMod annotation? If not, then it must.
-
Custom Machine slot synch error?
I had this thing some time ago. It's likely because of getting wrong side TileEntity. You have to show your IGuiHandler.
-
Modify the keybindings
Looks like... *puts on glasses* ... you are confused.
-
Crashing in Minecraft, but not in Minecraft through Netbeans.
How did you fix the no-sound?
-
Any "best practices" for GUI design?
I didn't like the way how minecraft GUIs are written. Most people make GUI textures and align them with slots, buttons, etc. I decided to do it different way - I made it so Container's element positions are linked with GUI's element positions and I did textures only for slots. It resulted in fine minimalistic GUI which can be changed easier than original ones: As you know, GUIs have borders; when you click with an item outside its borders, it is dropped into world. Those lines are GUI's borders. Textures are drawn per each slot.
-
Error, trying to make a addon
Did you install "dev" version or not?
-
Trouble with recompiling a mod addon
I'm trying to make a Buildcraft addon. The buidcraft is in my project as a Jar. I have some classes that extend buidcraft classes. When I recompile, I get many errors: package finetechnology.buildcraftaddon; import org.lwjgl.opengl.GL11; import net.java.games.input.Keyboard; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.IInventory; import buildcraft.core.gui.BuildCraftContainer; import buildcraft.core.gui.GuiBuildCraft; import buildcraft.transport.TileGenericPipe; public class GUItextPipe extends GuiBuildCraft { public GUItextPipe(BuildCraftContainer container, IInventory inventory) { super(new ContainerTextPipe(0), inventory); // TODO Auto-generated constructor stub } String [] filters; byte yOffset=33; byte stringHeight=18; // PipeLogicText filter; byte xBetween=40; // GuiTextField addFilters[]=new gui; GuiTextField filter; String filterText; @Override public void initGui() { super.initGui(); String text="Add filter"; filter=new GuiTextField(fontRenderer,width/2-width/12,3,width/6,16); org.lwjgl.input.Keyboard.enableRepeatEvents(true); // GuiButton add=new GuiButton(0, xBetween,13, text.length(), stringHeight, tezt); for (byte side=0;side<6; side++) { String buttontext="Add here"; buttonList.add(new GuiButton(side,3+(width/6)*side,23,fontRenderer.getStringWidth(buttontext)+6,18,buttontext)); } } @Override public void drawScreen(int arg0, int arg1, float arg2) { super.drawScreen(arg0, arg1, arg2); filter.drawTextBox(); // filter. } @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { this. drawVerticalLine(guiLeft,guiTop+ySize, guiTop, -9408400); drawVerticalLine(guiLeft+xSize,guiTop+ySize,guiTop,-9408400); drawHorizontalLine(guiLeft,guiLeft+xSize,guiTop, -9408400); } @Override protected void mouseClicked(int par1, int par2, int mouseButton) { super.mouseClicked(par1, par2, mouseButton); filter.mouseClicked(par1,par2,mouseButton); } @Override protected void keyTyped(char par1, int par2) { if(filter.textboxKeyTyped(par1,par2)) { filterText=filter.getText(); } } @Override public void onGuiClosed() { // TODO Auto-generated method stub super.onGuiClosed(); org.lwjgl.input.Keyboard.enableRepeatEvents(false); } }
-
Some questions about GUI buttons...
The GUI width and height are .xSize and .ySize.
-
Center GUI button
Use the .xSize and .ySize (width and height).
-
Can't damage (reduce an item) an ItemStack
You have to get EntityPlayerMP instance and use .inventory.setInventorySlotContents(slotNumber, itemStack).
-
Ghost Items
You can just look at buildcraft source and copy it. Or you can import their code and use it.
-
A method which tells whether a blocks has GUI
As you said, it triggers stuff inside of onBlockActivated().
-
Item tooltip hook
Last time I checked, there is no way to modify the tooltip, because the list containg info is being created inside a method. But if you use NEI, it gives such possibility.
-
Custom tool- and armorset
http://www.minecraftforge.net/wiki/Basic_Items
-
getting TileEntity without its coordinates
How would you know which tile entity to get without coordinates?
-
EventHandler won't register
Why are using @EventHandler instead of @Init?
IPS spam blocked by CleanTalk.