Jump to content

JohnyCilohokla

Members
  • Posts

    28
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Ireland
  • Personal Text
    I am new!

JohnyCilohokla's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. OK, I have managed to get it working. It's really confusing. I had problems with ClassWriter.COMPUTE_FRAMES (only in release environment) ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); after changing it to ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); it worked fine, but I'm not sure if it is right? Another thing is the obstructed classes, I have it hard-coded now, is there any API for getting the deobstructed - obstructed names? Or is there a common way of doing ASM stuff in forge? I was looking around but couldn't find anything. Also I have a question about reflection, the following code gives me exceptions (in dev environment): Class<?> EntityLivingClass = Class.forName("net.minecraft.entity.EntityLiving"); EntityLiving_isPlayer = EntityLivingClass.getDeclaredMethod("isPlayer"); (It works if I use the methods normally and move the class into net.minecraft.entity, but then forge complains) I was looking around and found info that it is recommended to use reflection instead of Access Transformers. The question is: is there a common API for reflection in forge?
  2. Thanks for the reply, The thing is that I'm using lightmaps as well + 2x standard textures(2 different icons). I need it to make sure no Z-Fighting occurs and to prevent other glitches. (Example of Z-Fighting in XYCraft: http://i.imgur.com/5X3v7.jpg) Maybe I have phrased the topic's title wrong, I need hooks in the beginning and at the end of the pre-rendering into DisplayLists code as I use custom rendering system that renders all of my blocks in a TextureArray that it then send to the graphics card. Doing so for each block is wasteful, on the other hand doing that per chuck increases the performance significantly. At the beginning of the pre-rendering I need to reset my buffers and before GL11.glEndList() I need to inject code to render my blocks for this to work the way it should. I was looking for it in 1.6.4 and now in 1.7.2 without success. I guess I will use ASM to inject the code, it shouldn't be too hard hopefully. Thanks for helping
  3. I want to render a Blocks using dual Texture (actually triple, base texture and overlay + lightmap). But I can't find anyway to make it efficient, as in swapping textures there and back(disabling and enabling the third texture + few other tweaks) take a good bit of CPU time, combining those calls would make a huge improvement. I was just looking at the source of WorldRenderer and I can't find a way to inject code in WorldRenderer .updateRenderer() or RenderGlobal.sortAndRender(). Is there anyway to make it? I can see few possible options: -preRender and postRender events in the rendering into displayLists code -onChunkRender events -even onWorldRender would be fine But I couldn't find any of those, if someone could help me I would appreciate it.
  4. I will be putting in some extra checking (that will be called from time to time): Probably: this.worldObj.loadedTileEntityList.contains(this); Or this: this.worldObj.getChunkProvider().chunkExists(this.xCoord >> 4, this.zCoord >> 4); But I will have to check this one.
  5. I'm sorry for the approach, I assumed they get invalidated after chunk unload and was wondering why is doesn't work for over 1 hour and got really pissed off because of it. I'm aware of the fact that TileEntity gets unloaded straight after chunk gets unloaded, so it is not necessary to call invalidate but it could help mods that store TileEntity instances. I'm implementing it as @Override method anyway, so that not much of a problem. I was just trying to suggest that it might be better to make it default or create another TileEntity class (such as CheckedTileEntity) I'm designing a multidimensional system working with inventories. It will be really complex and needs to be optimized in any possible way to work at any acceptable speed. Scanning through all TileEntities is not an option. As each time I would need to: -get item from list -check if it is instanceof -cast it if it is -then work with it Now all I do is: -invalidate on unload (only when chunk unloads) -cleanup (from time to time) -and when I'm calling I check for null pointer and isInvalid() to make sure it is valid Which works faster
  6. Sure... scanning through all of the entities and calling method only on specific ones makes more sense and is way faster than storing them in separate list and accessing them from there... Where all you need to do is call invalidate the TileEntity when chunk unload. (compare scanning through lots of entities[called each time] just to find few that you are interested in, to changing 1 variable on chunk unload[called only once]) Memory is not an issue. BTW: Any TileEntity in unloaded chunk is invalid and should be marked as such.
  7. Ok then tell me how would you call a method on all TileEntities of specific type? Should I scan all of the chunks for it?
  8. Not sure if this is a bug or not but TileEnity stays valid after chunk unloads. The code for TileEntity (onChunkUnload) /** * Called when the chunk this TileEntity is on is Unloaded. */ public void onChunkUnload() { } As you can see onChunkUnload() doesn't call invalidate() After overriding it with this code: @Override public void onChunkUnload() { // TODO Auto-generated method stub super.onChunkUnload(); this.invalidate(); } Everything works and calling isInvalid() for TileEntity returns true. As i load the TileEntity into List and the execute tick manually I get multiple TileEnities each time chunk reloads. Also as far as I can tell it could create problem is TileEntity is stored somewhere and unloaded if isInvalid(), as it ever happens if the chunk is unloaded.
×
×
  • Create New...

Important Information

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