Jump to content

stucuk

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by stucuk

  1. It doesn't say where in your code the error is. It just states that your in some GUI and its trying to render an item either in your inventory or in the GUI's but its causing a Null Pointer error. This points to it being an ItemStack that is null, or where you set its item to null, etc. Something is null in that ItemStack that its trying to render. Only you know what you were doing at the time. The button with Sp does spoilers... all you have to do is hover your mouse over the buttons to see what they do.
  2. Btw you code doesn't need to be as complex. The ForgeDirection class has XYZ offset values and it also has a getOpposite() property. The following would work on any side sent (You may want to check for the UNKNOWN side): ((TileEntityLiquid) worldObj.getTileEntity(xCoord + from.offsetX, yCoord + from.offsetY, zCoord + from.offsetZ)).fill(from.getOpposite(), resource.copy(), doFill);
  3. Its not likely to be Drivers or because of an intel card or he wouldn't be able to play minecraft in any situation (And would then unlikely be trying to mod it). If it only happens with Debug (Which i have never personally used) and not with the normal way of running it then its likely a configuration error with the Debug "profile".
  4. You can have more than one config. You just use more than one Configuration (net.minecraftforge.common.config) variable.
  5. I think your wording is a bit confusing. The word "Type" generally in programming means the type of object/variable (As in what class it is or if its an integer/string/etc). There is only ever one single instance of each Block/Item Class which is what you register. Every Block/Item in the world only uses that one single instance (Which is why you can never store any information in the Block/Item class directly since its shared). With TileEntities on the other hand you have one instance per Block in the world which exists(Which is why you can store information in them directly since it isn't shared). So in short, you only need 1 instance of a Block which you then give to other code which requires a block as an input. The Block is just a shared instance that contains no personal information about the block.
  6. Are you sure your texture is 16x16? The image is not blury. You can get that effect (Slanted image) if the width of the texture you send to the graphics card is a number that isn't divisible by 4(As it expects it to be 16x16 and you have sent a say 15x16 so it uses the first pixel of the 2nd line as the last pixel of the first line, etc). All of the icon textures in your mod should be 16x16.
  7. isNormalCube is a bad way to determine if a block is solid. Blocks like Fence would return false even though you would consider them to be solid.
  8. The simple solution would be to start again. Just make sure to backup the src/main folder so your mods source is saved (Just copy it back once everything is setup again). One issue you can have with eclipse is that the commands for gradle don't always clean everything, so you can have a situation where eclipse saves some IDE file which the gradle comands never reset (One example is if you try and copy/paste the whole lot to a different hard drive, eclipse will have saved the old location in some IDE file which is never reset with gradle).
  9. @Ernio: IMClPacketHandler_String is just an interface. It has nothing to do with mod communication. I = Interface. MCI = shorthand for my mod (MCI Craft) and "PacketHandler" is because its for a block handling the packet data that has just been received. Its an interface. Its just a helper that allows you to treat a class as if it was just that interface. If a class implements the interface then it has to have all the members of that interface. It basically allows you to easily use generic code for multiple classes without them having to inherit from a specific class. It also allows you to check if a class has a specific interface (You can make dummy interfaces that have no members) so that you can treat it differently. The following is an example of using an interface. You add them after the word "implements": public class BlockSound extends BlockContainer implements IMCIPacketHandler_String, IMCIPacketHandler_XYZ, IMCIPacketHandler_Float, INoMCILocation { IMCIPacketHandler_String.java You could however change the handlePacket to be hardcoded and just update your block/tile directly (Though a generic solution is more future proof) There is two ways to do it. You can either use getDescriptionPacket() and onDataPacket() on the TileEntity (Which then sends clients data when they are in range or if you have called markDirty() which sends it again if the client already has received data from the server for that tile already) or you can send the data via individual packets (using detectAndSendChanges in your gui's container class). The advantage to the first method is that its simple, its basically just sending a NBT to the client from the server. The advantage of individual packets is that you can send the GUI a smaller amount of information and only when your in the GUI. For your needs the first method is likely the best as your data won't be constantly being updated (Like if you had energy levels which you wanted on the GUI which could fluctuate oftern). You would need to check in your GUI if the blocks TileEntity had a different name to what it was before so that the GUI could be updated with the current name. So you just need to add the following to your TileEntity to make it send data to the client. You need to make sure your string is being saved/loaded in the writeToNBT and readFromNBT. @Override public Packet getDescriptionPacket() { NBTTagCompound tagCompound = new NBTTagCompound(); writeToNBT(tagCompound); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tagCompound); } @Override public void onDataPacket(NetworkManager networkManager, S35PacketUpdateTileEntity packet) { readFromNBT(packet.func_148857_g()); } When the string is updated on the server(When you receive a packet from a client), you need to use markDirty() so that it then updates all clients near the tileentity. Example code for handing the packet on a block that implements IMCIPacketHandler_String: @Override public void HandlePacket(EntityPlayer player, int x, int y, int z, String value, byte extra) { TileEntity te = player.worldObj.getTileEntity(x,y,z); if (te == null || !(te instanceof TileSound)) return; ((TileSound)te).name = value; ((TileSound)te).markDirty(); }
  10. Each time something changes in a GUI you need to send it to the server like others have stated. You also should have the server update the client in the detectAndSendChanges() bit of the container. Below is code for sending a String as a Packet with 1.0.7.10 taken from my mod (As a result it will need modification) as an Example. MCIBasicPacket.java PacketMCI_String.java MCIPacketSystem.java In the mods class: public static final MCIPacketSystem mcipacketsystem = new MCIPacketSystem("yourmodname"); In PreInit of the mod: mcipacketsystem.registerPacket(PacketMCI_String.class, PacketMCI_String.class, Side.SERVER); The Side.SERVER is the destination. In your GUI for your block you would use the following when the string changed: PacketMCI_String.send(xCoord,yCoord,zCoord,"The Text",(byte)0) The handlePacket section of the PacketMCI_String would need to be modified to set the string on the block.
  11. The way that i did it with my mod is to use the Block Event system. The Block Event system will send the block event to all clients that are near. You then play the sound on each client that receives it. //When its turned on private void setActive() { markDirty(); if (theSound != "" && !soundloc.isNull()) this.worldObj.addBlockEvent(xCoord, yCoord, zCoord, MCICraft.blockSound.getBlock(),0,0); //<---- Important line } //Code on the Block @Override public boolean onBlockEventReceived(World world, int x, int y, int z, int eventid, int eventparam) { TileEntity te = world.getTileEntity(x,y,z); if (!(te instanceof TileSound)) return true; TileSound ts = (TileSound) te; if (ts.getSound() != "") world.playSoundEffect(ts.getX(),ts.getY(),ts.getZ(), ts.getSound(), ts.getFullVolume(), ts.getFullPitch()); //<-- Important Line return true; } Note: While my code uses a TileEntity you don't need to use one (If you did you would have to send all the information to the clients tile entity using getDescriptionPacket() and onDataPacket()).
  12. MCI Craft currently contains 4 parts: Core, Farming, Machines and Redstone. Both Farming, Machines and Redstone are optional. All parts require Forge. Core adds Uranium Ore, Plutonium, Nuclear Bomb (10x more powerful than TNT) and the Mineshaft Mole, a digging machine and more. Farming adds Auto Farmer and Trough. Machines adds PHW reactors, Solar Panels, Power Storage, a Electronic Furnace that can smelt 3 items at the same time and more. Redstone adds all the standard gates (AND, OR, NOT and there variants) as well as others like the Zero Delay Repeater and Redstone Crossover (Allows 2 separate redstone signals to pass through it from different sides: North/South & East/West). A full description of all added Blocks/Items can be found Here. Crafting recipes can be found Here. Videos [flash=420,315]http://www.youtube.com/watch?v=cBD_bCUYMyU?hd=1 [flash=420,315]http://www.youtube.com/watch?v=ikb-eFd3h2k?hd=1 [flash=420,315]http://www.youtube.com/watch?v=ps9C4D4nn1s?hd=1 [flash=420,315]http://www.youtube.com/watch?v=IU_QpylJOpk?hd=1
×
×
  • Create New...

Important Information

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