Jump to content

rich1051414

Forge Modder
  • Posts

    160
  • Joined

  • Last visited

Everything posted by rich1051414

  1. I raytraced from the block back to the player head, and then back to the players feet, to see if I ran into another block, manually. Seemed like the most direct way to the solution, but it is still expensive. I was hoping minecraft kept a list of non-skipped or skipped blocks, but it appears to only care if blocks are directly obstructed instead of not visible by foreground blocks not touching it. At the moment, I have simply delayed my lookup to twice a second to minimize performance impact, maybe I will think of something later.
  2. I am currently working on a mod which requires me to check if a block is currently visible to a player. Grabbing a collection of blocks within this area is not a performance issue, however, checking if each block within it is visible or not is. This check is done on an area of 16x16x16 so it needs to be optimized. Is there a list that forge keeps, for rendering purposes, that I could use to speed this process up? If not, does anyone have an idea of a trick to make the check faster?
  3. You are totally right. I never realized it made the actual player move side to side, and not just the camera, but it really became noticeable when the player was shrink. Disabling head bobbing stopped it.
  4. I am currently working on a mod which miniaturizes the player, but this causes certain things to get exaggerated, like move speed, and the usually subtle sway back and forth the player does when walking. I cannot seem to be able to locate the code responsible for the swaying, so maybe someone can point me in the right direction. What I mean by sway is, when the player is moving, the model moves slightly from left to right as he moves forward. It is also not directly related to the limbswing, as the swaying gets out of sync with the leg movement. I will have no difficulty correcting the issue if I could locate the code responsible, so I can cancel out part of that at render time.
  5. Couldn't you do something like this: public AxisAlignedBB rotateBoundingBox(AxisAlignedBB bb, int steps){ AxisAlignedBB ret = bb.copy(); for(int i = 0; i < steps; i++){ ret.minX = bb.maxZ; ret.maxX = bb.minX; ret.minZ = bb.maxX; ret.maxZ = bb.minZ; } return ret; } Not sure if I got the order of the dimension shifting right, but should be universal.
  6. So after updating and migrating my code to forge 1.8, I have noticed what I think is a bug with the DynamicTexture object, but I am not totally sure if I am just doing it wrong. Currently I have my own texture loading code for skinning, which uses the DynamicTexture object and fills the objects texture data manually. It will then call DynamicTexture.updateDynamicTexture() to bind the texture before drawing it. However, it now seems to not be binding properly. I have checked and the DynamicTexture is properly getting its image data, but updateDynamicTexture() does not seem to be binding now, and attempting to bind with the raw texture ID and rendering with the Tesselator also does not work. Anyone know if any changes that messed this up, and if I am just doing it wrong now? Edit: Nevermind, turns out it is that the new tesselator cannot be used to render to the gui. I used a different method and is working fine now.
  7. We already went through this idea -- the problem is that would block all entities, including players. He wants to only block certain mobs from crossing. Overriding the addCollisionBoxToList will allow you to selectively block things. Look at the code I posted. Also, the vanilla Pathfinding will path around the invisible blocks, as they are stacked 2 high, as well. The only real caveat is if you bury the block, in a hole, the mob could walk over the invisible blocks, but i would call that user error, as they aren't using the block right. You could even add a simple check for such a thing to prevent placing if their is no block 3 blocks above where it is placed or something.
  8. I think you may be making this harder on yourself. All you need is an invisible block to occupy the block position above the block. You would only need something like this in your actual block code: public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); if(par1World.isAirBlock(par2, par3 + 1, par4)){ par1World.setBlock(par2, par3 + 1, par4, MyBlocks.pathBlockingBlock); } if(par1World.isAirBlock(par2, par3 + 2, par4)){ par1World.setBlock(par2, par3 + 2, par4, MyBlocks.pathBlockingBlock); } } public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { if(par1World.isAirBlock(par2, par3 + 1, par4)){ par1World.setBlock(par2, par3 + 1, par4, MyBlocks.pathBlockingBlock); } if(par1World.isAirBlock(par2, par3 + 2, par4)){ par1World.setBlock(par2, par3 + 2, par4, MyBlocks.pathBlockingBlock); } } Then for your invisibly rendered path blocking block: //This is not a normal block. public boolean renderAsNormalBlock() { return false; } //Let all light pass through public int getLightOpacity(World world, int x, int y, int z) { return 0; } //Set block as replaceable. public boolean isBlockReplaceable(World world, int x, int y, int z) { return true; } //0 width length and height box so no wireframe rendered. public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return AxisAlignedBB.getAABBPool().getAABB((double)par2, (double)par3, (double)par4, (double)par2, (double)par3, (double)par4); } //Check if the invisible block needs to cleanup public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { if(par1World.getBlock(par2, par3 - 1, par4) != myBlock && par1World.getBlock(par2, par3 - 2, par4) != myBlock){ par1World.setBlockToAir(par2, par3, par4); } } //Only block specific mobs public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) { if(par7Entity instanceof EntityMob){//Or whichever mob you want to block super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); } } //So Raytracing passes through. public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) { return null; } //Nothing needs to be done here like there is no block here. public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) {} I wrote this off the top of my head so you may have to fill in the blanks, but that should make the vanilla path finding work.
  9. Line 89-90 of ModelRenderer: TextureOffset textureoffset = this.baseModel.getTextureOffset(par1Str); this.setTextureOffset(textureoffset.textureOffsetX, textureoffset.textureOffsetY); You need to set your texture offsets first.
  10. First of all, the model must be centered on the relative point 0,0,0. By that I mean, in your model rendering, the offset point x=0, y=0, z=0 is the center-most point in your model. Then any rotations will rotate at the center point in the model.
  11. gradlew cleancache --refresh-dependencies That fixed the issue for me.
  12. gradlew build The issue has also been recreated by others, and is on the ForgeGradle bug list.
  13. Everything seems good to go, except gradle fails everytime on the reobf stage: FAILURE: Build failed with an exception. * What went wrong: A problem was found with the configuration of task ':reobf'. > No value has been specified for property 'deobfFile'. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 5.909 secs Bit confused what i am missing Edit: Here is my build file: buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.1-SNAPSHOT' } } apply plugin: 'forge' version = "1.0.0" group= "DamageIndicatorsMod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "DamageIndicatorsMod" minecraft { version = "1.7.2-10.12.0.967" } processResources { // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' include 'version.properties' } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' exclude 'version.properties' } }
  14. It would be fairly easy to implement your own. First output your data into a byte array, then split it up into chunks the size you want and send them, then after sending the last part, send a small final packet so the client can know the packet is done, then merge those parts back together client side and then extract whatever data it holds.
  15. I assume you mean how do you get the end user to get the library loaded so you can use it? You can add the library to the mods folder too, but forge will give a warning since its not a real mod, but it will inject it, or you can simply extract the library jar and add it to your mod. That is if the distribution rules on the library allows for that.
  16. No, because when the entity receives a new potion effect, the server only tells the client the new particle color, not the entire potion effect. Well actually, the potion color is updated, but is not extractable into anything useful. The issue is, a mobs REAL potion effect is only applied when spawned, so if any potion effects change after spawning, it will never apply client side, only a particle effect is applied(which is a color set on the datawatcher server side) which as i said, cannot be used to accurately tell detailed information about the potions applied.
  17. Thanks for trying anyways, and yeah I am aware of this . I was hoping someone might know of, or have a stroke of genius and might give me a hint on how I might coax the Packet41EntityEffect out of the server, client side, on demand.
  18. That method is protected, and on top of that, would not do anything client side. Iterator iterator = this.activePotionsMap.keySet().iterator(); while (iterator.hasNext()) { Integer integer = (Integer)iterator.next(); PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(integer); if (!potioneffect.onUpdate(this)) { if (!this.worldObj.isRemote) { iterator.remove(); this.onFinishedPotionEffect(potioneffect); } } else if (potioneffect.getDuration() % 600 == 0) { this.onChangedPotionEffect(potioneffect, false); } } On the client side, activePotionsMap never changes from what it is when the mob originally spawned. So running this client side would not really do anything.
  19. I don't know if a simple way to accept a container item of any durability and return a lower durability version, however, you can make the recipe behave any way you want before and after crafting by making your own class and extending net.minecraft.item.crafting.IRecipe and using your own logic, then registering the completed recipe.
  20. Ok, so I am the author of Damage Indicators mod, and the client side health really benefited the mod as now a server mod is not needed, HOWEVER, some extras i threw in due to the server mod being previously required have been problematic. One being potion effects. When a living entity has a potion effect applied, a formula is applied to combine the colors of all current potion effects and applied to the datawatcher server side, which is then later delivered to the client, and I have deemed data extraction from this as not viable, as colors are somewhat generic and do not give details on exactly the strength duration etc of the potion effect, IF the generic effects could actually be accurately extracted. However, i have noticed that when a mob is first spawned via a chunk load, the client side actually receives the exact potion info, although it is never updated again. Does anyone know a way the client side might force the server to resend the initial spawn packet on demand? Is there a spawn info request packet, or is the initial spawn data packet sent only when the server wants it to? Any info on this would be much appreciated and would save me days of logic following.
  21. I know this problem has to do with optifine, but I am posting here so I could possible get an idea on how to achieve a little problem I am having using a different method in forge. Im my mod, damage indicators mod, I have particles that render in world but always on top. Currently, the way I achieve this is by setting the depth test to always and rendering on fx layer 3, which works excellent with just Forge, however, optifine changes the render order, and entities always seem to render after particles, causing my always on top renderings to get rendered over by entities(but not blocks). If a block is in front of the particle, it renders, and in just forge, if an entity is on top, it renders, but with optifine installed, if the entity is in front, it blocks the particle. I have tried Always glDisable(GL_DEPTH_TEST) and glDepthMask(false) and none of these work on rendering the particle in front. Of course, I could just ensure the particle spawns closer to the player, but if there are other entities in front of that, it blocks, and looks very odd, as only entities cause the particle to get blocked. I have thought about moving the rendering to my tick handler, and having the standard rendering do no rendering, however, I haven't thought of an elegant solution to apply the offsets for the rendering. If anyone has an idea, let me know Would using entities instead of particles be an alternative? Keep in mind, they would need to be client side only, as this ensures servers can allow players with and without the mod to be on the server at the same time.
  22. I know this problem has to do with optifine, but I am posting here so I could possible get an idea on how to achieve a little problem I am having using a different method in forge. Im my mod, damage indicators mod, I have particles that render in world but always on top. Currently, the way I achieve this is by setting the depth test to always and rendering on fx layer 3, which works excellent with just Forge, however, optifine changes the render order, and entities always seem to render after particles, causing my always on top renderings to get rendered over by entities(but not blocks). If a block is in front of the particle, it renders, and in just forge, if an entity is on top, it renders, but with optifine installed, if the entity is in front, it blocks the particle. I have tried Always glDisable(GL_DEPTH_TEST) and glDepthMask(false) and none of these work on rendering the particle in front. Of course, I could just ensure the particle spawns closer to the player, but if there are other entities in front of that, it blocks, and looks very odd, as only entities cause the particle to get blocked. I have thought about moving the rendering to my tick handler, and having the standard rendering do no rendering, however, I haven't thought of an elegant solution to apply the offsets for the rendering. If anyone has an idea, let me know Would using entities instead of particles be an alternative? Keep in mind, they would need to be client side only, as this ensures servers can allow players with and without the mod to be on the server at the same time.
  23. Error confirmed. Exactly the same thing happens here as well. Build 621 works fine, build 622 crashes with a nullpointer exception at: 'at cpw.mods.fml.common.Loader.getFMLBrandingProperties(Loader.java:832)' No mods running. Forge only.
  24. I reproduced the error as well. It does actually render, it just renders on the wrong side of the frame, walk behind the block it is mounted to and break it, you'll see the item is visible before the frame updates and realizes it needs to break.
  25. So after burying myself in this new Icon system, and figuring it all out, it is not so bad, and after everyone adjusts, i dont think it is that bad of a thing, but i have got met with some problems. The first is, if you have an item that does custom rendering, but doesn't sign up for custom inventory rendering, it only gets Icon check call backs on the damage version of getIcon, meaning if you have a dynamic texture based on use time, and has real durability, you cannot animate the texture(custom bows). This might also occur with all items, but I only tested on one with custom rendering. Also, the font renderer does not rebind it's texture properly, meaning drawing strings on the rendertick can be bugged, unless you bind default.png before drawing with the font renderer. Unicode mode is unaffected. (This may be a bug from another mod, but this did not happen before).
×
×
  • Create New...

Important Information

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