Mecblader
Members-
Posts
225 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Mecblader
-
This forum is for questions about minecraft modding, and this question has nothing to do with that. So this is not the right place for that question!
-
Hello, I had made a mod that had a custom gui, it was kind of a mix between creative tab and enderChest. The gui was okay, except for three big problems. One, I needed to be able to store more than 1 stack in a slot. Two the code was messy and some parts were a bit hackish. Three, it was kind of tough on low end PC and that bothered me. So, then I saw a few posts on this forum that said that I would have to create some sort of special Item Handling to have more than 64 items in a slot because the default container uses ItemStack. So I was wondering If I created a custom container, with a custom ItemStack class, and tell the container to use my custom ItemStack class, that supports staclsizes greater than 64, then would that be enough or is it more complicated then that. Also my old gui also had 9 tabs that had 468 slot in each of them, I used a complicated system of packets and some slightly hackish stuff to get that too work, is there a better way to do it. I had the idea of having 9 separate guis and then when the player presses the tab buttons, it would open the new gui. I know that this is a long post, but I would appreciate if you could take the time to look over my ideas and tell me if they would work or not. All help is appreciated, Thank You!
-
Sorry, but you seem to be asking others tell you exactly how to do this. Personally I believe that part of the fun of making a mod is to overcome this obstacles and figure it out for your self. Also, you basically repeated what memcallen said when he said to scan along the cable until you find a block that accepts energy. Basically, you need to figure this out your self, because it is not that difficult and no one is going to give you the answer. PS: Sorry if I should a little harsh, but its the truth.
-
Again sorry for the delay, but is there some good ways to get the variable or keys that mod authors use for their entities in their mods. I can manage the sending to the client part, but I don't know how to specific variables to send across. For example, say that a mod adds a entity that is a random color and that color is stored in the nbt data or somthing like that, how would I be able to got that variable generically, without hardcodeing it in. I would like my mod to work with any mod that it installed with, as long as they don't setup their entities weird. Also I would like to know if the method bellow would work for spawning an entity that is part of a mod, if not then could someone tell me a way that could work. Method: EntityLiving entityLiving = (EntityLiving) EntityList.createEntityByName(this.getEntityData().getString("id"), this.worldObj); Basibally I have a variable that has an entities nbt data stored and in that nbt, there is a key that is labled id, that is the id of the entity. That variable comes from this method: EntityList.getEntityString();
-
Hello, I am making a mod were I have a block that scans an entity and copies its entity data. Then it uses the entities id to render it on the client side. The problem that I have been experiencing is that I want this to be generic so it would work with entities in other mods, but I'm not sure if there is a generic way to transfer nbt that controls the render of a entity. For example, a sheep, I believe uses nbt to determine what color it is going to render. I know I could hard code that in, but I want to see if there are other option before I do something like this. All help is appreciated, Thank You!
-
Oh, I just realized why it was giving me the message. For some reason when you return the message in the onMessage method it gives that message.
-
Then do you know of any open source mod that have an implementation of this so I can compare their code to mine to see what I am doing wrong?
-
This is the only packet I have in the mod. Could this be a bug in forge or do you think I am doing something stupid?
-
I am using Forge Version 1.7.10-10.13.0.1208.
-
[1.7.10] Give Player Item Every 5 Minecraft Days
Mecblader replied to Bugzoo's topic in Modder Support
You could use an event that detects when a player logs onto the game, I cannot remember what event it is though, then add a extended properties file, that has a variable that keeps track the number of tick the player has played, onto them and register then add them to some sort of list in a tick handler and if the number of ticks is less than the number of ticks required, in you case being 24,000 ticks ( refer to this link for conversions: http://minecraft.gamepedia.com/Day-night_cycle), then you increment the number or if then number is greater than or equal to to the number of ticks required then give the player the item and reset their counter. There are some flaws with this system, so you would need to iron those out. This system plan is not perfect, it is just something I came up with on the fly, but I hope that it at least helped you. -
I had a packet handling system that worked when I updated from 1.7.2 to 1.7.10, but a message started to appear, saying: Detected ongoing potential memory leak. 100 packets have leaked. Top offenders [07:50:36] [server thread/ERROR] [FML]: packetCageData : 100 So i googled a solution and I found this thread : http://www.minecraftforge.net/forum/index.php?topic=20567.0 It turns out I did follow the tutorial that Jabelar had posted a link to saying that this method of packetHandling causes memory leaks. So I used the other link posted in his post and I followed the tutorial, but I still end up with the message saying the same exact message. I'm not too good with this packet stuff, so I don't really know how to fix it. I would appreciate if someone can tell me what I am doing wrong. All help is appreciated, Thank You! PacketCode: Channel Init Code (is being called in the pre init event): The Code That Sends The Data:
-
Hello, I need tot be able to spawn an entity with existing nbt data. When I try to do this it crashes and says that it is a null pointer exception. More info: Basically I have a tile entity that scans for a random entity around it, and it saves that entity in its self. It then kills the entity and on game exit it saves the entity nbt by using these lines of code: Then when I load it I use these lines of code: I tried printing the compound2 var and the entity obj out and they seem to display normal data, but when I try to spawn the entity in the world it crashes ans says that is is a Null Pointer Exception. Full Code:
-
[1.7.10] Spawning Entities in world couses NullPointerException
Mecblader replied to Mecblader's topic in Modder Support
bump -
[1.7.10] Spawning Entities in world couses NullPointerException
Mecblader replied to Mecblader's topic in Modder Support
I tried what you said and it worked, but when I try and spawn the entity it gives an error. It points back to: this.worldObj.spawnEntityInWorld(this.capturedEntity); Error -
[1.7.10] Spawning Entities in world couses NullPointerException
Mecblader replied to Mecblader's topic in Modder Support
I edited my last post and it was the this.targetEntity = (EntityLiving) EntityList.createEntityFromNBT(compound2, this.worldObj); line that is returning null. Is there a better way to create an entity from nbt? -
[1.7.10] Spawning Entities in world couses NullPointerException
Mecblader replied to Mecblader's topic in Modder Support
@Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); NBTTagList list = compound.getTagList("Items", 10); this.cageContents = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < list.tagCount(); ++i) { NBTTagCompound compound1 = list.getCompoundTagAt(i); int j = compound1.getByte("Slot") & 255; if (j >= 0 && j < this.cageContents.length) { this.cageContents[j] = ItemStack.loadItemStackFromNBT(compound1); } } NBTTagCompound compound2 = (NBTTagCompound) compound.getTag("EntityData"); if(compound2 != null) { [b][u]this.targetEntity = (EntityLiving) EntityList.createEntityFromNBT(compound2, this.worldObj);[/u][/b] this.capturedEntity = this.targetEntity; } if(this.capturedEntity != null) { this.isCageClosed = true; System.out.println(this.capturedEntity); } } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagList list = new NBTTagList(); for (int i = 0; i < this.cageContents.length; ++i) { if (this.cageContents[i] != null) { NBTTagCompound compound1 = new NBTTagCompound(); compound1.setByte("Slot", (byte)i); this.cageContents[i].writeToNBT(compound1); list.appendTag(compound1); } } compound.setTag("Items", list); if(this.capturedEntity != null) { NBTTagCompound compound2 = new NBTTagCompound(); this.capturedEntity.writeToNBT(compound2); compound.setTag("EntityData", compound2); } } Here is my code and what you said was correct, but I am not able to to create a new instance of the entity by using the method in my code, it returns null; -
Hello, I am try to get an save the nbt data of an entity in a tile entity and I have the entity, but when i try to get the entity data by using this method: entity.getEntityData(), it returns empty. I know that the mobs is not null, and I tried spawning the mob then logging out and then logging in and then adding the mob to the tile entity via tile entity mechanics, and saving and loading and it still loads empty. Does anyone know why this is happening? All help is appreciated, Thank You!
-
Hello, I am making a block that has entity data store inside of it and I want to be able to render the entities model in the block. I know that I could hard code something, but I want this to be compatible with other mods, and with any new mobs that minecraft adds in future releases. Does any one have any ideas on how I could get the entities model and render it. If you feel that my description of my problem is too vague, then just ask me to be more clear. All help is appreciated, Thank You.
-
How do you create a forge fake player. Also what sort of things can I do with the fake player. A few questions about forge fake player --------------------------------------------------- Is it possible for me to kill it once its job is done? Can I add items into its hand, as in make it hold an item ? Can other entities detect that is an entity?
-
Hello, I am making a mod that will have a block that will have a block that certain mobs get attracted to and go near the block. The issue I am facing is that I need to be able to detect if a mob is within range of this block so I can add a task to its ai to come near the block. The issue is that for this to happen I need to know how to use aabb and I have not worked with them much, I know the basic functionality, but I have not worked with them. So I was wondering if there is a tutorial that could help me with aabbs in Minecraft. I have googled this before, but the implementations of aabb seem different than the way it is implemented in Minecraft. (Note I could be stupid and be wrong, but that was my first impression of this) All help is appreciated, Thank You.