coolAlias
Members-
Posts
2805 -
Joined
-
Last visited
Everything posted by coolAlias
-
[1.7.2]KeyBinding.isPressed() Build:10.12.0.1024:
coolAlias replied to cruXcon's topic in Modder Support
That's a shame about the KeyHandler class being absent... it was pretty handy. Well, the KeyInputEvent should only be firing on the client side anyway, so you shouldn't need to bother with checking if the world is remote. Is it still giving the exact same error, that isPressed() method doesn't exist? Are you sure you are supposed to be registering the KeyHandler to the FMLCommonHandler, then? Perhaps it is registered to the EVENT_BUS or FMLClientHandler. Try changing it to something else. Sorry I haven't started modding for 1.7 yet, so I can't tell you for sure, but that would be my guess. -
[1.7.2]KeyBinding.isPressed() Build:10.12.0.1024:
coolAlias replied to cruXcon's topic in Modder Support
Post your KeyBinding class (assuming that's what 'mybinding' is). Why aren't you using a class that extends KeyHandler to handle your key presses, btw? Was that class removed in 1.7? -
[1.7.2]KeyBinding.isPressed() Build:10.12.0.1024:
coolAlias replied to cruXcon's topic in Modder Support
If that didn't fix it, then you are also accessing your key bindings indiscriminately somewhere. Look at the stack trace to see if you can't find the exact location that is posting the error; that will be where you need to add an 'if (world.isRemote)' with NO "!", because you want the client side. -
SHOOTER_DATAWATCHER_INDEX is just a static int I defined so if I need, I can quickly change the index (in case of a future conflict, for example). If you don't know how to use DataWatcher, I suggest checking out the excellent wiki tutorial: http://www.minecraftforge.net/wiki/Datawatcher Quick tip: the index comes first, then the value; and the value should initially be "" for no shooter. You set the shooter later.
-
[1.7.2]KeyBinding.isPressed() Build:10.12.0.1024:
coolAlias replied to cruXcon's topic in Modder Support
You register your client-side-only key handler class in your main mod class' load method, which doesn't differentiate between side... this is exactly why using Common and Client proxy is so highly recommended. -
[1.7.2]KeyBinding.isPressed() Build:10.12.0.1024:
coolAlias replied to cruXcon's topic in Modder Support
I typically encounter that error when I've accidentally tried to access a client-side only field or method from the server; key presses are all client-side only, so be sure that your method is never called, initialized, or otherwise accessed on the server side. If you run the server version inside of Eclipse, it should also crash on you with this error, though when you run only the client you will never notice. -
I was having the same problem, and it seemed to be that custom arrows don't receive the same services as regular arrows, so the shooting entity wasn't in sync / didn't recognize the player as the shooter. Now I have no idea why that would happen, but I at least fixed the issue by adding my own shooter DataWatcher object: /** * Returns the shooter of this arrow or null if none was available */ public Entity getShooter() { String name = dataWatcher.getWatchableObjectString(SHOOTER_DATAWATCHER_INDEX); return (name.equals("") ? shootingEntity : worldObj.getPlayerEntityByName(name)); } /** * Used to update the datawatcher shooting entity object */ public EntityArrowCustom setShooter(EntityPlayer player) { dataWatcher.updateObject(SHOOTER_DATAWATCHER_INDEX, player != null ? player.username : ""); return this; } Be sure to add the object during entityInit with the other datawatcher objects (add ""), and replace shootingEntity with getShooter() in your onUpdate and other non-constructor methods. Your arrow should no longer hit you.
-
I was wondering what replaced the deprecated ModLoader.isModLoaded method, thanks!
-
Are you certain it's a problem with your render code and not your entity?
-
[SOLVED] SMP particles not appearing for other clients
coolAlias replied to coolAlias's topic in Modder Support
Well, nothing else for it then Thanks for confirming my suspicions. -
Yeah, it was really annoying not being able to do anything with them outside the changing the radius. Feel free to use and modify that class however you need. It's pretty flexible already, but there's always room for improvement
-
You can see how I handle custom explosions in my mod. I wrote that class to allow all sorts of customization, but in your case I'd recommend using the explosion class' method of populating the affected block list, then instead of destroying the blocks, simply replace them with ice, either by creating a class that extends Explosion like I did, or simply re-using the vanilla code in an outside method and getting rid of the explosion entirely.
-
EDIT: Yep, MC doesn't seem to have any way to automatically notify other clients of particles. Too bad, but no big deal. Writing a custom packet or two solves the problem just as easily. Ok, I know I can send packets to spawn the particles (though Packet63WorldParticles doesn't seem to have a usable constructor?), but my question is why is it that particles told to spawn on the server don't show up for clients? Looking at the method: public void spawnParticle(String par1Str, double par2, double par4, double par6, double par8, double par10, double par12) { for (int i = 0; i < this.worldAccesses.size(); ++i) { ((IWorldAccess)this.worldAccesses.get(i)).spawnParticle(par1Str, par2, par4, par6, par8, par10, par12); } } It looks like it should run through all the client worlds to spawn the particles, no? For example, if I have spawned an entity, such as an arrow, everyone can see particles that it generates. But if I run a method from onItemRightClick that spawns particles, only the player clicking the item can see them, even though the method runs on both sides. I understand that a shell entity is spawned on every client, so that's obviously how those particles are visible, but I'm wondering if there isn't a good method already available for informing other clients of particles spawned, or if I must write it myself. Cheers.
-
Couldn't you use a custom IItemRenderer and bind textures manually based on the calendar / time? Might be a pain in the ass, but it should work.
-
Help playing mob sounds from tile entity (1.6.4)
coolAlias replied to Toblexson's topic in Modder Support
I usually use something like this: worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 1, zCoord + 0.5D, "soundfilename", 1.0F, 1.0F); where "soundfilename" is the name of the folder plus "." plus the sound's name (for vanilla sounds; custom sounds you can just define the file path yourself), so: "mob.hurt", "random.glass", whatever, just look in the resource folder in your Minecraft directory to find the correct sound paths. -
[Solved][1.5.2] GUI Slots misaligned from texture
coolAlias replied to wPatriot's topic in Modder Support
I'm guessing that you didn't set xSize and ySize for your gui class, and it's still using the default which would be the size for the player inventory screen. If you use the default texture, I bet you will see the slots align perfectly well, though maybe not since it looks like your gui is offset by quite a lot... what does your texture file look like when you are editing it? Does it start at pixel 0, 0? If you post your entire Gui code, it will be easier to spot what you need to change. -
So I made a custom bow with various arrow types. I have two different arrow classes, one for bomb arrows and one for elemental related arrows, both extending the same custom arrow class that extends EntityArrow. The bomb arrows work perfectly both in survival and creative, but for some unfathomable reason, the elemental arrows work perfectly in creative, but in survival they are all wonky, sometimes just bouncing off of the first air block or at best, the arrow is at a strange angle rather than straight on its trajectory. Yet it works perfectly in creative mode... This holds true for all 3 elemental arrows, just as all 3 bomb arrow types work exactly the same. Has anyone ever run across something like this before? The arrows are all instantiated and spawned exactly the same way, from the same bow, and registered exactly the same via to the entity tracker. Thanks in advance for any insights. EDIT: It's definitely a problem with the client side entity, as the arrow will show up on the ground in the position one would expect based on charge, but the arrow looks as though it bounces off the air until it appears on the ground. All the variables leading up to the spawning of the arrow are the same on both server and client side, though, so it must be something in the entity class itself. EDIT 2: So I 'fixed' it by adding a datawatcher for the shooting entity's id, as the problem was the arrow would collide with the player without recognizing the player as the shooting entity; I'm still very puzzled as to why one set of arrows worked perfectly and the other didn't, but at least I can see why it wasn't affected in creative mode (player disables damage, so won't collide). Also, I would have thought that the EntityArrow's shootingEntity field would by synchronized automatically, and it must have been for the bomb arrows as those worked perfectly well... I'd love to know where the difference lay between EntityArrowBomb and EntityArrowElemental that's causing this. EDIT: removed code. Fixed, but unresolved as to the cause of the discrepancy.
-
I made a custom bow; everything works great, but for some reason after switching the inventory slot that the bow is in using the number keys 1-9, it will not fire an arrow until I click on it (i.e. move even just back into the same slot) with the mouse, after which it functions again normally. Even more strange is that it correctly nocks an arrow and is set in use, but simply fails to fire the arrow. Here is the bow's code, and here is a step-by-step of what I did: 0. shoot bow, works great 1. open player inventory, highlight custom bow in action bar 2. press any number key, changing the bow's action bar slot to that index 3. scroll over to the bow with the mouse wheel or by pressing the number key again 4. right-click to use; arrow shows as nocked and animation / icon plays correctly 5. release right-click: no arrow is fired 6. left-click on bow, place back in slot, works just fine
-
Can you show us your entire InventoryMinerEC class? And perhaps update the OP with your current code, as it still looks like you're not saving the data properly in extended properties.
-
Well that's weird. Does it do it when you disable this inventory entirely? Perhaps you have a different problem.
-
I think the problem is in your inventory load from NBT method: public void loadInventoryFromNBT(NBTTagList par1NBTTagList) { int i; // You do not need to initialize all the slots to null // and if you do, certainly do NOT use the setInventorySlotContents method // as that may depend on the inventory already being fully constructed, // which it is not yet while loading from NBT for (i = 0; i < this.getSizeInventory(); ++i) { this.setInventorySlotContents(i, (ItemStack)null); } for (i = 0; i < par1NBTTagList.tagCount(); ++i) { NBTTagCompound nbttagcompound = (NBTTagCompound)par1NBTTagList.tagAt(i); int j = nbttagcompound.getByte("Slot") & 255; if (j >= 0 && j < this.getSizeInventory()) { this.setInventorySlotContents(j, ItemStack.loadItemStackFromNBT(nbttagcompound)); } } } [/code[
-
If nothing is changing and you are using TNT, are you sure your explosion code is getting called and not the regular TNT explosion code?
-
Have you tried starting a new world? You may have corrupted the save game with your nbt. @Draco - That wasn't meant to be code for him to use, I was explaining what he had already done and why it wasn't necessary, and what he should do instead, not in addition to. Sorry if I misunderstood your post.