-
Building a mod with referenced libraries
Hi; I have been trying to work out a method by which I can build a mod that uses an external library (in this case I am using LuaJ). I have everything running fine from eclipse; however, of course the provided forge build scripts do not know about the referenced library, and as such fail to build the mod. What should I do to build this mod for distribution? **EDIT:** Ok, so having looked through the "build.gradle" file I realised I simply wanted to put the referenced library's jar file into "./libs", which has worked.
-
Block "name" from Block object.
Yep, that's it, thanks!
-
Block "name" from Block object.
I've been doing some stuff with using Lua for making Scriptable item effects, but I've hit a bit of a peculiar issue. I'd thought that it would be sensible to use the "name" format (eg: "minecraft:dirt") for blocks in the Lua scripts, and I have found it easy to obtain the Block from the name using the following: Block.getBlockFromName("minecraft:dirt"); However I cannot find a sensible way to do the reverse; obtaining the "name" from the Block instance. Thanks in advance!
-
Making an add-on mod / Using an API
After a bit of experimentation, I've found a method that works somewhat. What I have done is put the de-obfuscated mod jar in "/run/mods/" so that the mod is included when running, and the API source in "/src/main/java/" so it shows up in eclipse Unfortunately some APIs (such as the Thaumcraft API) have compile-time missing-reference errors that I am not sure what to do about. Presumably there is a way to make Eclipse ignore these errors, but I have no idea how.
-
Making an add-on mod / Using an API
Thanks for the reply, but I'm unable to make much use of that tutorial.
-
Making an add-on mod / Using an API
Hi, All the information that I can find about using APIs for other mods is incredibly unclear, and I was hoping someone could clarify things for me. It is obvious that I need two things: the API, and the De-obfuscated Jar for the mod, but no-where I have looked seems to distinguish between the two, making it unclear as to what I am expected to do with them. EDIT: I am trying to do so for 1.8 if that makes much difference.
-
Entity Syncronisation
I've now hit a related issue. Put simply, I don't know how to synchronize variables inside the entity, (which usually would not be an issue unless they are used for rendering, which this is). In this particular case the variable is set when the entity is created and will never be changed.
-
Entity Syncronisation
Ok, changing that has worked, thanks a bunch! for the sake of anyone wondering about my final solution: EntityRegistry.registerModEntity(EntityQuantumEssentia.class, "qfthaum_essentia", 0, this, 64, 1, true);
-
Entity Syncronisation
Yes I have registered the entity in the init phase (do I need to do it in a specific phase?) EntityRegistry.registerGlobalEntityID(EntityQuantumEssentia.class, "qfthaum_essentia", EntityRegistry.findGlobalUniqueEntityId());
-
Entity Syncronisation
At the moment, the entity only exists server-side. Is it that I am entering it into the world wrong? At the moment what I am doing is this: worldObj.spawnEntityInWorld(entity); Which only occurs server-side, and the entity is definitely ticking server-side so it definitely gets this far at the least.
-
Entity Syncronisation
So, I am fairly sure that you only need to create/spawn entities server-side (to avoid having client-side "ghost" entities), but I don't know how to then make the client aware of the entities that are spawned server-side. (Note that I am not referring to mobs, just entities that inherit from the base entity class) Thanks in advance for any help!
-
[1.5.2][SOLVED] Simple Entity hit / interact not occuring
Put simply, the interact and attackEntityFrom methods appear to never be called. public class EntityMagicBuffer extends Entity implements IMagicEnergyProvider { protected float storedEnergy; public EntityMagicBuffer(World world) { super(world); setSize(1, 1); } @Override public boolean doesEntityNotTriggerPressurePlate() { return true; } @Override public boolean canBeCollidedWith() { return false; } @Override public AxisAlignedBB getBoundingBox() { return boundingBox; } @Override public AxisAlignedBB getCollisionBox(Entity par1Entity) { // TODO Auto-generated method stub return boundingBox; } @Override public void onEntityUpdate() { worldObj.spawnParticle("magiccrit", posX, posY, posZ, 0, 0, 0); super.onEntityUpdate(); } @Override public boolean interact(EntityPlayer par1EntityPlayer) { System.out.println("clicked!"); return true; } @Override public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { System.out.println("poke!"); return super.attackEntityFrom(par1DamageSource, par2); } @Override protected void entityInit() { } [... other code relating purely to my interface ...] } I think it may be a bounding box related issue since arrows fly straight through the entity, although using F3+B still makes it show the bounding box I was expecting. EDIT: as a most likely unrelated problem, the entity appears to sometimes glitch up/down about half a block, (but always remaining in one of the two up/down states, never going any further) EDIT2: making canBeCollidedWith() return true fixed it entirely, the getBoundingBox() and getCollisionBox() functions can freely return null without preventing this.
-
Strange Itemstack NBT behaviour
I have a staff item that I want to have drain energy on usage, the current way I have it set up is that this function in the staff class is called via a tickhandler: public float doDrawEnergy(ItemStack item, EntityPlayer player, float energy) { if(item.getTagCompound().getFloat("charge") > energy) { item.setTagInfo("charge", new NBTTagFloat("charge",item.getTagCompound().getFloat("charge") - energy)); return energy; } else { float out = item.getTagCompound().getFloat("charge"); item.setTagInfo("charge", new NBTTagFloat("charge",0)); return out; } } The problem is that the "charge" nbt value doesn't always change, specifically it only that the getFloat function only returns the latest set value after opening a GUI (ie: it only seems to upate the value after opening a GUI), and I have absoluetly no idea why or how this happens.
-
[SOLVED] GUI Items in player inventory behaving awkwardly
I decided to use a few break points to see what actually happens when I open the gui, and I found that it wasn't opening the gui handler server-side because my @Mod file didn't have an @NetworkMod annotation, simply adding @NetworkMod after the @Mod annotation and it's parameters seems to have fixed it for me.
-
[SOLVED] GUI Items in player inventory behaving awkwardly
I just updated my latest post in the other thread, it appears that (with my mod at least) the server thinks that the player has their regular inventory open while the client thinks that the tile inventory is open. (which explains all of these oddities, since the player inventory has nine additional slots, 4 armour, 4 crafting, and the crafting output, and adding more slots in the custom container class will move the slots that the client closer to those the server uses) As such; I guess there must be something we are both missing for the opening of the GUI. EDIT: here is the code used for opening the GUI for me: @Override public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int a, float b, float c, float d) { TileEntity tileEntity = world.getBlockTileEntity(i, j, k); if (tileEntity == null || player.isSneaking()) { return false; } player.openGui(Alchemagic.instance, 0, world, i, j, k); return true; }
IPS spam blocked by CleanTalk.