Jump to content

UberAffe

Forge Modder
  • Posts

    316
  • Joined

  • Last visited

Everything posted by UberAffe

  1. Right. Somehow I managed to ignore the face that I was using the add method to get the new position, which resulted in the players position getting effectively doubled. Second question stands: is there a way to get only the nearest entity that intersects without checking the distance of all of them?
  2. I'm guessing that means it gets all entities in the cube created by the two positions and not just entities that intersect the line between the two positions.
  3. It should get me a tPos that is the distance of range away from pPos in the x direction. Unless I misunderstood what look.xCoord is returning it should be a double that is in the range of -1 to 1.
  4. This is what I am doing currently int range = myItem.getRange(); BlockPos pPos = player.getPosition(); Vec3d look = player.getLookVec(); BlockPos tPos = pPos.add(new Vec3i(pPos.getX() + look.xCoord*range, pPos.getY()+ (look.yCoord*range), pPos.getZ() + (look.zCoord*range))); List<Entity> targets = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, new AxisAlignedBB(pPos, tPos)); but it only seems to work when I am facing a certain direction, I think it's north-east. So two questions: Any idea why this only seems to work in 1 general direction? Is there another method or ordering to the entities returned that would allow me to get just the closest entity without doing a bunch of other calculations.
  5. does anyone know of any resources I could look at that might help me figure this out?
  6. I'm pretty sure that internally it get treated like a hashmap of <String, NBTBase> and hashmaps do not guarantee an order.
  7. You don't have a common proxy in the code on github. which I assume is where the variable ModEntities is declared, which makes it hard to find what is happening when you call renderEntities.
  8. I don't know why I always assume things must be more complicated than my first impression. Since the library isn't getting built into their mod I assume I can just do something like github.com/UberAffe/Light-Drafter/API/LightDrafter-1.9-1.0-api.jar and as long as I don't change those classes then anything they build against that jar will work with the current version of my mod. Do I need to do anything to check for a minimum api version?
  9. So if someone was making an addon for my mod what would they use while programming. Do they just add my jar as a library in their build path or would I need to have something else for them to use?
  10. I have not made an api before and I'm not really finding anything useful for what kind of things need to be availabe and how to make them available. In my case I have a few interfaces and classes that I want an addon to be able to interact with. //implement or extend these abstract class PartType interface IDraftable interface ILuxin //use static methods from these classes PartReg#RegisterPart(PartType part) CoreReg#RegisterCore(IDraftable core) LuxinReg#RegisterLuxin(ILuxin newLuxin) What would I need to do to make these available?
  11. Your best bet would probably to be to give the entity a capability that has a value specialFireTick. Anything that applies your special fire will set the entity on fire using the vanilla fire but it will also make sure that they have your capability and you will assign it some number of ticks. Then subscribe to a tick event (entityTickEvent?) and if the entity has the capability and they specialFireTick is greater than 0 make sure they are on fire.
  12. Not sure exactly what I need to do for this to work. I am trying to dynamically create a model during run-time (after postInit). Here is what I have current: DraftableModelLoader implements ICustomModelLoader DraftableModel implements IModel DraftableBakedModel implements IBakedModel DraftableOverrideList extends ItemOverrideList //used by DraftableBakedModel IDraftable#GetParts returns List<IPartType> IPartType#GetBakedQuadsWithOffset(int offX, int offY, int offZ) returns List<BakedQuad> //used by IPartType ILuxin#GetColor() return int[] It is at the point where I believe my model is getting used in-game. However my model seems to be invisible(textureless). Here is an example of how I create the BakedQuads in the IPartType GetBakedQuadsWithOffset(int offX, int offY, int offZ){ List<BakedQuad> list = new ArrayList<BakedQuad>(); BakedQuad quad; //North quad = new BakedQuad(applyOffset(getVertices(EnumFacing.NORTH),offX,offY,offZ), 0, EnumFacing.NORTH, null, true, new VertexFormat()); list.add(quad); } private int[] getVertices(EnumFacing face) { switch(face) { case NORTH: return north(); } } private int[] north() { int[] vertices = new int[28]; //top left vertices[0] = 0; //x vertices[1] = 0; //y vertices[2] = 0; //z vertices[3] = asInt(luxin.GetColor()); // rrggbbaa vertices[4] = 0; //u vertices[5] = 0; //v vertices[6] = 0; //unused return vertices } private int asInt(int[] color) { return (color[0]&0x0ff)<<24|(color[1]&0x0ff)<<16|(color[2]&0x0ff)<<8|(color[3]&0x0ff);//0 is r, 1 is g, 2 is b, 3 is a, &0x0ff limits each to 1 byte } This code is clipped because it is very repetitive but that should be enough to see what I am doing. Each IPartType is supposed to be only a single color (rgba) which is specified by the luxin#GetColor. Is there some way for me to specify the color per BakedQuad without the use of a texture file or a custom renderer?
  13. I'll be diving into minecraft code when I get home but I think I just need to figure out what minecraft does with the tint value. If they don't use it I may need to write my own ItemRenderer, if I do need to do you have any suggested resources to help me accomplish that?
  14. Ok so I have it using my models now, I need to compare the modelResourceLocations with .equals not ==, I hate when that is the problem. Anyways my Models seem to be completely transparent, so on to how I am creating the models. public DraftableBakedModel(IDraftable draft){ DraftableMap parts = draft.GetPartArray(); for(int xPos = 0; xPos < parts.GetWidth(); xPos++){ for(int yPos = 0; yPos < parts.GetHeight(); yPos++){ for(int zPos = 0; zPos < parts.GetDepth(); zPos++){ if(parts.GetPart(xPos + "," + yPos + "," + zPos) != null) quads.addAll(parts.GetPart(xPos + "," + yPos + "," + zPos).GetQuadsAt(xPos, yPos, zPos)); } } } } in the IPartType implementation and in my ILuxin implementations public int[] GetColor() { return new int[]{0,0,255,127}; }
  15. in my ICustomModelLoader#accepts I put this @Override public boolean accepts(ResourceLocation modelLocation) { if(Refs.modelResourceLocation == modelLocation) Refs.NOP(); return Refs.modelResourceLocation == modelLocation; } when I put a breakpoint on the nop it never gets triggered. which means that ModelLoader.setCustomModelResourceLocation(MeleeCore.meleeCore, 0, Refs.modelResourceLocation); isn't doing what I thought it was.
  16. None of the methods in those 4 classes are getting called when the item is on screen. Given the way I am registering it and with the code available can you see why this isn't working?
  17. It is from my DraftableMap class which is basically just a wrapper for a HashMap public NBTTagCompound SaveAsNBT() { NBTTagCompound toReturn = new NBTTagCompound(); for(Entry<String, IPartType> set : map.entrySet()) toReturn.setTag(set.getKey(), set.getValue().SaveAsNBT()); return toReturn; } Diving down the Rabit hole for IPartType#SaveAsNBT public NBTTagCompound SaveAsNBT() { NBTTagCompound toReturn = new NBTTagCompound(); toReturn.setString("purity", purity.toString()); toReturn.setString("luxin", luxin.GetName()); toReturn.setString("partType", PartType.EDGE.toString()); return toReturn; } ... Well first I'm dumb. My IPartType implementation was return null instead of toReturn and the error is no longer happening ... but that raises a new question of why wasn't this making other things crash ...
  18. return new RenderFireball(manager, 1); You probably want something like this instead: private static int fbCount = 0; return new RenderFireball(manager, fbCount++); or to pass in the value to use because each renderer you register needs to have a unique value.
  19. ICustomModelLoader IModel IBakedModel ItemOverrideList I have this in my ClientProxy#preInit ModelLoader.setCustomModelResourceLocation(MeleeCore.meleeCore, 0, Refs.modelResourceLocation); ModelLoaderRegistry.registerLoader(new DraftableModelLoader()); and this in my CommonProxy#preInit GameRegistry.registerItem(MeleeCore.meleeCore, Refs.MODID + "_" + MeleeCore.meleeCore.GetName());
  20. I ended up updating to 1.9 but I am getting an NPE on NBTTagCompound.copy and I believe it is happening when I give the player the ItemStack created here: public ItemStack CreateItem() { LogHelper.info("creating " + name); ItemStack toReturn = new ItemStack(meleeCore, 1, 0); toReturn.setTagInfo(Refs.MODID, SaveAsNBT()); return toReturn; } I know that SaveAsNBT is returning a valid-non-NULL NBT because I use in other places with this object. This is how I am giving the player the ItemStack ItemStack drafted = toDraft.CreateItem(); LogHelper.info(((IDraftable)drafted.getItem()).GetName() + " Created"); player.setHeldItem(EnumHand.MAIN_HAND, drafted); This only gets run serverside and there are checks to make sure that nothing is null. here is the full crash My guess is that something is wrong with how I am creating the ItemStack. Update: If I remove the setTagInfo line the crash goes away. Am I doing something wrong with how I am adding nbt information?
  21. And it is still getting tied to the item using the custom model loader right?
  22. Alright so I now have gotten rid of all the obvious errors in code after updateing to 1.9 and I am essentially at the same point again. So for custom item model in 1.9 do I use a similar process as what you described but only using IBakedModel or is it something else?
  23. well since I'm doing a large amount of refactoring right now anyways I guess I might as well update.
  24. Actually they weren't I was able to have multiple different MeleeCore variants and they would each use the correct damage values. Although I might have realized the problem sooner if what you said had been the case.
  25. Hurray for mass refactoring! Thanks for the help!
×
×
  • Create New...

Important Information

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