Everything posted by Mew
-
Need Help With Making Content Packs For My Mod :( Please Help ???
It sounds like you are wanting to do something like what the actual Forge API does. It basically reads EVERYTHING in the /mods folder and if there is a class that has the annotation @Mod ( params ) then it loads it as a mod. So you would have to do the same thing. You would then use an annotation like @EsvDefconContentPack ( Same params as @Mod ) So yeah... That seems like an extremely hard way to do this. All you really need to do is just basically have it as a "core mod" ( not used in the literal sense of the term core mod ). Then every set of clothing mod would require that mod to be installed.
-
[1.5.2] How to make a block show the texture of the block it's touching?
Just out of curiosity. Do you check all the blocks that are in direct contact with the block? Because if you don't... That would be pretty sad to have the block represent what is [ insert side here ] to it. I would suggest doing a check against all the blocks touching the camo-block and then seeing which ID there is the most of, then use that as the texture-getter. If there is say, only one block touching the camp-block, then you just make the texture of the block the texture of that single block.
-
[RESOLVED!][HELP] Custom TileEntity Render not working!
Call it from the @Init method. And as a side note, my magical-code-viewing-device ( MCVD ) is broken, so I can't pull up your code... Sorry.
-
using onCrafting with a damage value.
I would do something like: if ( item.itemID == Item.compass.itemID && item.meta == Item.compass.meta && item.getDamage() < item.getMaxDamage() ) { player.addStat ( ExtraAchievments.craftCompass, 1 ); }
-
[1.6] Eat food without being hungry
Its the least we can do. We all uphold Minecraft Forge's reputation this way. It helps us feel a little important too
-
[1.6] Eat food without being hungry
Good programmers also debug... And like hearing people say WTF all the time @OP: I recall there being a method in the Item class that goes along the lines of onEaten( args )... Am I wrong? If it is there, then override it and add your effects, then consume one of that item
-
Imported OBJ is black but should be white
Umm.. I am sorry, but no. And also, that is MINECRAFT code not OpenGL code! ResourceLocations are just returning Icons in the end anyway I think... I am not entirely sure. But anyway. The extra slash is not needed.
-
Checking if a NBT exists?
if ( nbt != null ) { // do the code } OR something like that...
-
Generating Items in Chests
I find this hilarious... Because I was helping a friend with this last night... Here is the code: par1World.setBlock(i1, j1, k1, Block.chest.blockID, 0, 2); TileEntityChest tileentitychest = (TileEntityChest)par1World.getBlockTileEntity(i1, j1, k1); tileentitychest.setInventorySlotContents(0, new ItemStack (Block.anvil, 1));
-
Ideas for Fluid Coding
Couldn't you theoretically make it so that after a small amount of time, the original gas block splits into a 5th block ( so 1/5 the original block size ) and then each square adjacent to it get a 1/5 gas block generated on it etc. And you just break it down until it reaches a certain level that you want it to be at? That would be how I would do it.
-
How do I debug a server side mod?
In Eclipse next to the run button there should be a little down arrow ( right hand side of the button ). Click that and it will do a drop down menu with two options, Client and Server ( Note this is only when in the MCP environment ). All you have to do is click the Server option and it will launch the server. Then, once it is running, click that arrow again and run the client in debug mode ( using the arrow to the right of the debug option of course ) and then connect to the server. Easily done.
-
How do I debug a server side mod?
I believe that the server doesn't actually handle blocks/items and such... Don't quote me on that though.
-
Gui texture getting cut off?
Haha, he isn't the only one with some GUI tricks He at least can explain what they do though.... I just know how to implement them. Where are his tessellator tutorials exactly? Or an even better question... Where are good ones? ( That includes his ).
-
1.6 Entities and Attributes - My smart way wasn't so smart it seems?
Yeah wouldn't it mean that the EntityLivingBase constructor would be called before my parent constructor anyways, which in turn will call func_110147_ax() before I have any chance at doing anything. So the parent class's func_110147_ax() has to set the default values. And then in the parent's constructor it could change those values to the one passed into it's own constructor? Or did I misunderstand you completely? Thats what I got from it
-
Vanilla block behavoir
Do what you have been advised MUCH earlier. Make your new block etc., and just overwrite the recipe for a normal torch. That is in my opinion the easiest way to do it.
-
1.6.2 Model Texture not Working
Or better yet, look at the path you told the renderer to look in, and then look at where you said the file is stored. Then tell us whats wrong
-
[solved][1.6.2] item damaging while crafting
Well... Of course that won't work. You returning A NEW item stack. Try something like: @Override public ItemStack getContainerItemStack(ItemStack par1ItemStack){ par1ItemStack.damageItem(1, Minecraft.getMinecraft().thePlayer); return par1ItemStack; } I am not saying that will 100% work, but hey. Give it a try.
-
Making Blocks Drop Items
Nope. Sorry.
-
Set/Get word on a GUI to/from NBT
Man, Packets are confusing and complicated and took me almost 4 hours to figure that out, but I did it - I think - but when I set the name and close and then open the GUI it doesn't get the new name (unless I log out). Also, every Block was the same name and every block should have their own name. Here's my code if you need it: BlockIdentification.java public class BlockIdentification extends BlockContainer { public BlockIdentification(int id, Material material) { super(id, material); setHardness(2.0F); setStepSound(Block.soundStoneFootstep); setUnlocalizedName("identificationBlock"); setCreativeTab(UsefulBlocks.tabUsefulBlocks); } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) { TileEntityIdentification t = (TileEntityIdentification) world.getBlockTileEntity(x, y, z); t.update(world); player.openGui(UsefulBlocks.instance, 0, world, x, y, z); return true; } @Override public boolean hasTileEntity(int meta) { return true; } @Override public TileEntity createNewTileEntity(World world) { return new TileEntityIdentification(); } } TileEntity.java public class TileEntityIdentification extends TileEntity { private static String name; public TileEntityIdentification() { } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); if (PacketHandler.getIdentificationName() != null) { nbt.setString("name", PacketHandler.getIdentificationName()); } System.out.println("NBT - Write"); } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); TileEntityIdentification.name = nbt.getString("name"); System.out.println("NBT: " + TileEntityIdentification.name); PacketHandler.setIdentificationName(name); } public static String getName() { return name; } public void update(World world) { world.notifyBlockChange(xCoord, yCoord, zCoord, 2); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } GuiIdentification.java public class GuiIdentification extends GuiScreen { public final int xSize = 176; public final int ySize = 88; private GuiTextField name; private String nameString; public GuiIdentification(TileEntityIdentification tileEntity) { } @SuppressWarnings("unchecked") @Override public void initGui() { Keyboard.enableRepeatEvents(true); int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; this.buttonList.add(new GuiButton(0, posX + 7, posY + 60, 162, 20, "Set Player Name")); this.name = new GuiTextField(this.fontRenderer, posX + 8, posY + 35, 160, 20); this.name.setFocused(true); if (TileEntityIdentification.getName() != null) { this.name.setText(TileEntityIdentification.getName()); } } @Override public void drawScreen(int x, int y, float f) { this.drawDefaultBackground(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.func_110577_a(new ResourceLocation("usefulblocks:textures/gui/IdentificationBlock.png")); int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; this.drawTexturedModalRect(posX, posY, 0, 0, xSize, ySize); this.fontRenderer.drawString("Identification Block", posX + 40, posY + 15, 4210752); this.name.drawTextBox(); super.drawScreen(x, y, f); } @Override public boolean doesGuiPauseGame() { return false; } @Override public void onGuiClosed() { Keyboard.enableRepeatEvents(false); } @Override public void updateScreen() { name.updateCursorCounter(); } @Override protected void mouseClicked(int par1, int par2, int par3) { super.mouseClicked(par1, par2, par3); name.mouseClicked(par1, par2, par3); } protected void actionPerformed(GuiButton par1GuiButton) { if (par1GuiButton.enabled) { if (par1GuiButton.id == 0) { System.out.println("Name: " + nameString); if (nameString != null) { PacketHandler.setIdentificationName(nameString); } } } } @Override protected void keyTyped(char par1, int par2) { if (name.isFocused()) { name.textboxKeyTyped(par1, par2); nameString = name.getText(); } if (par2 == 1) { this.mc.thePlayer.closeScreen(); } } } } PacketHandler.java public class PacketHandler implements IPacketHandler { private static String identificationName; @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { ByteArrayDataInput reader = ByteStreams.newDataInput(packet.data); identificationName = reader.readUTF(); } public static void setIdentificationName(String name) { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); DataOutputStream dataStream = new DataOutputStream(byteStream); try { dataStream.writeUTF(name); } catch (IOException e) { System.err.append("Failed to send identification name packet"); } System.out.println("Packet: " + name); PacketDispatcher.sendPacketToServer(PacketDispatcher.getPacket(Reference.ModID, byteStream.toByteArray())); } public static String getIdentificationName() { System.out.println("Packet Read: " + identificationName); return identificationName; } } All blocks the same name? Easy fix. Don't make the variable static. A static variable means that every instance of that class will have the same value for that variable. The updating of the GUI? Fairly easy. You just need a string within the GUI that you use for sending the change. When the GUI get's opened, use a packet to tell the client what the server has as the string. So, something like: public GuiRandom ( TileEntityRandom theRandomTileEntity ) { RandomPacketThing.sendToPlayer ( Minecraft.getMinecraft ().thePlayer ); theStringThatHoldsThePlayerName =theRandomTileEntity.getTheString (); }
-
Help with replacing existing GUI
You couldn't find a good GUI tutorial for 1.6?!?!?!? I bet you didn't find mine Here it is: http://www.minecraftforge.net/wiki/Basic_GUI Just note that the tutorial is what it is... A basic GUI. I will be working on a more advanced one soon that covers buttons, text boxes etc. Asid from that, try looking for coolegooners ( I think ) tutorial on minecraft forums. Okay I followed your tutorial, It works, I think. Right now I have it be opened by right clicking a block, I think it is working because for a while I had an error saying something about not be a network mod, but I have fixed that and I have no errors. I don't know the code for adding the GUI's texture, and I need that for my GUI. Do you know how to do that? Thanks! Yeah, I will get to making my next GUI tutorial soon.. It will cover stuff like textures, buttons, etc.
-
[ help ] - How would you delete a portion of the HUD?
ez pz
-
Modify the health and position of an offline player
Okay. Thanks for clearing that up
-
Making a new Event?[SOLVED]
Whoops. Wrong post with that one... Sorta. But anyway. Just wait for hydroflame to get his hands on this, it will become a lot clearer then
-
Modify the health and position of an offline player
That seems "illegal" to me... The fact that you are trying to revive someone on a PURPOSELY made hardcore server... That just goes against the purpose of the server. So I would suggest leaving that alone... And besides, the server would have to install the mod for it to actually work anyway, and if they are wanting to be a hardcore server, then they won't install your mod. Go figure.
-
Making a new Event?[SOLVED]
An event is just a class called Event really... An event holds the information to do with the event, and then, to actually make the event get called, you have to instantiate the event where the event should be called, at the highest point also. The event also has to be registered with forge etc.
IPS spam blocked by CleanTalk.