
Groxkiller
Members-
Posts
51 -
Joined
-
Last visited
Everything posted by Groxkiller
-
Updating a liquid block turns it into another
Groxkiller replied to Bogigaba's topic in Modder Support
But that's my point: you altered it to set to your stationary. That's not the default behavior. -
Add this into your mod's @init method: VillagerRegistry.instance().registerVillagerType(villagerNumberID, "path/to/villager/texture.png"); villagerNumberID has to be greater than 6 (as all ids below that are already taken), and it can go quite high so it's a good idea to start at 50 or something. Adding trades to this villager is a bit more difficult as Forge's trade adding system is a bit broken at the moment. If I find a quick way to do it i'll let ya know.
-
My question is blunt: How does one do this? From what I can tell, the traceback for data per-mod has to do with WorldAccessContainer, an interface. Certain ModContainers have implemented it to work with data, but I don't see a way to set the ModContainer of my mod to be a custom one to utilize that. Am I missing something stupid or is there another way to save NBT data per-mod?
-
Updating a liquid block turns it into another
Groxkiller replied to Bogigaba's topic in Modder Support
By default throughout liquid code it will assume the flowing liquid version is one id above the stationary version, not below. -
I like this one too; would let you make custom block helmets or custom armor that doesn't use ItemArmor as a parent class.
-
If this was an entityliving event I think it would be worth getting it. It could prevent healing if a certain item is in the inventory (perhaps something cursed or drains hp or something), make a potion that prevent healing, and if combined with an attack event could be used to balance out health depending on circumstances.
-
Not sure what you mean, as I can build a timer into an entity and it works with multiple instances (as in each one has a unique timer). To keep the timer in it's state, however, you would need the NBT tagging. (And ofc to have it for both server and client you need to datawatcher the value, but doing that with timers is a poor idea and should instead be done with what happens when the timer expires)
-
utilize Proxies for client- and server-specific stuff.
-
If you know what Reflection is you can do this easily. (In these examples I use a custom class I made called 'ReflectionManager', so you'll need to make your own to get these values) Clientside Proxy: public ChunkCoordinates getPlayerBreakingBlockCoords(EntityPlayer entityplayer) { int blockX = 0; int blockY = 0; int blockZ = 0; if(entityplayer instanceof EntityClientPlayerMP) { PlayerControllerMP controller = Minecraft.getMinecraft().playerController; boolean hasBlock = ReflectionManager.getPrivateBoolean(controller, "isHittingBlock", PlayerControllerMP.class); if(hasBlock) { blockX = ReflectionManager.getPrivateInt(controller, "currentBlockX", PlayerControllerMP.class); blockY = ReflectionManager.getPrivateInt(controller, "currentBlockY", PlayerControllerMP.class); blockZ = ReflectionManager.getPrivateInt(controller, "currentBlockZ", PlayerControllerMP.class); return new ChunkCoordinates(blockX, blockY, blockZ); } }else { return super.getPlayerBreakingBlockCoords(entityplayer); } return null; } Serverside Proxy: public ChunkCoordinates getPlayerBreakingBlockCoords(EntityPlayer entityplayer) { int blockX = 0; int blockY = 0; int blockZ = 0; if(entityplayer instanceof EntityPlayerMP) { ItemInWorldManager manager = ((EntityPlayerMP)(entityplayer)).theItemInWorldManager; boolean hasBlock = ReflectionManager.getPrivateBoolean(manager, "isDestroyingBlock", ItemInWorldManager.class); if(hasBlock) { blockX = ReflectionManager.getPrivateInt(manager, "partiallyDestroyedBlockX", ItemInWorldManager.class); blockY = ReflectionManager.getPrivateInt(manager, "partiallyDestroyedBlockY", ItemInWorldManager.class); blockZ = ReflectionManager.getPrivateInt(manager, "partiallyDestroyedBlockZ", ItemInWorldManager.class); return new ChunkCoordinates(blockX, blockY, blockZ); } } return null; } As with all reflection this comes with a performance cost if you use it constantly. Also note that here I use the actual names; When you go to reobfuscate you need to replace the names with the obfuscated names or this won't work.
-
It would be possible to render a model for a block via block rendering hooks, if only for one flaw, which is if you try and override the texture there then blocks rendered afterwards take on your texture in that chunk. it's quite weird. One way around this would be to save what texture is binded to openGL and then re-load it after you finish rendering the model, but that doesn't work perfectly all the time. And I never thought to just to use the tile entity as data, and not use a special renderer. Thanks for the tip!
-
Hook to update texture for Custom Falling Sand
Groxkiller replied to robustus's topic in Suggestions
There isn't much need for this if you can make your own entity for it. Is it more work? Yes. But having a hook to change the texture seems pointless to me if you can just make a clone of it. (plus then you can customize it, have it spawn particles or somesuch, or speed it up, give it properties. If you don't want any of that then just clone it.) -
I've had this before, but I don't think it's connected to Forge. Minecraft can (very, very, VERY rarely) create a map from a seed where there's no applicable biome nearby that's flagged as spawn-point-able. (ie deserts, mountains, mooshroom islands, swamps and oceans don't allow spawns) This especially happens when you have 'large biomes' turned on because it increases the chances of no spawn being found (but again this is really rare). All you need to do to fix it is use another seed.
-
hatch() sounds like it changes the entity state/places another entity. If so, it should be serverside-only and the value should be datawatcher'd. (ie the entity should have an 'isHatched' boolean and serverside updates the client one, etc.)
-
I found the problem: I was using the flowing water blockID instead of the stationary blockID, resulting in thousands of update packets sent for each one as it converted to stationary. Using the stationary ID instead completely wiped the lag out. Thanks for the help!
-
Normally I don't like to bump, but this problem still exists. Do you need more information?
-
Custom block render showing up as invisible.
Groxkiller replied to Waterdude's topic in Modder Support
How is the item rendering not causing an infinite loop? You call the method within the method...within the method...within the method...etc. Either way that's probably your problem so try commenting it out. (put '//' in front of it) Unless there's a 'super' in front of that you removed for some reason but I don't think that works either. -
If you mean there's going to be hiccups down the road for all these tileents then it takes a LOT of them all working at once to get lag, (you can have a crapton of pistons working overtime and the only lag you get is from the sound engine not real lag) so your fine in that respect. If you mean so many using the same class will have problems, that's not an issue either as each tile entity is a new instance (which is why this works in the first place) so unless you start using static variables you'll be fine. What WILL be a problem is that tile entities stop rendering past a certain distance. Your going to have to override that distance or your blocks will just dissapear relatively close to view. (I don't know exactly how to do it with tileents but I do know it has to do with how it's registered - Forge has a method to register Mod Entities, that might be what you want)
-
As everyone has said before me, look in EntityItem as there is a method to get an ItemStack (depending on Forge version it's either obfuscated (has func_###### as a name) or it's named getItem()), then compare it's itemID with the itemID if the item in your main mod file. the ItemStack itemId is easy to get: theItemstack.getItem().itemID; Your itemID is also easy (assuming you made the item refrence static, which you should): myMod.myItem.itemID; Unlike strings, you CAN use '==' with these are both are integers.
-
As the title states, I am making my own dimension and having some serious problems getting some simple generation to work. I do mean simple - there's no complicated math, there is a fair bit of blocks, but it's sending FAR too many chunk update packets than makes sense: I can get upwards of 30,000 packets sent if i'm flying in creative! Here is the code: Method that places blocks into the chunk: public void generateBasicTerrain(Chunk chunk, int par1, int par2) { ExtendedBlockStorage[] storageArrays = chunk.getBlockStorageArray(); for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { for(int y = 0; y < SEALEVEL; y++) { if (y >> 4 >= storageArrays.length || y >> 4 < 0) { continue; } else { int i = x + par1; int k = z + par2; ExtendedBlockStorage var4 = storageArrays[y >> 4]; if(var4 == null) { storageArrays[y >> 4] = new ExtendedBlockStorage(y >> 4 << 4, !theProvider.hasNoSky); } if(var4 != null) { if(y < SEALEVEL && y >= SEAGROUNDLEVEL) //ocean { var4.setExtBlockID(x, y & 15, z, BLOCK_WATER); }else if(y < SEAGROUNDLEVEL && y >= SEAGROUNDLEVEL - 4) //ocean dirt/stone layer { if(y == SEAGROUNDLEVEL - 1 || y == SEAGROUNDLEVEL - 2) { var4.setExtBlockID(x, y & 15, z, BLOCK_DIRT); }else { if(seedRandom.nextInt(Math.min(5, y) - 3) == 0) { var4.setExtBlockID(x, y & 15, z, BLOCK_DIRT); }else { var4.setExtBlockID(x, y & 15, z, BLOCK_STONE); } } }else if(y < SEAGROUNDLEVEL - 4 && y >= 3) //ocean stone layer { var4.setExtBlockID(x, y & 15, z, BLOCK_STONE); }else if(y < 3) //bedrock layer { if(y == 0) { var4.setExtBlockID(x, y & 15, z, Block.bedrock.blockID); }else { if(seedRandom.nextInt(y + 3) == 0){ var4.setExtBlockID(x, y & 15, z, Block.bedrock.blockID); }else { var4.setExtBlockID(x, y & 15, z, BLOCK_STONE); } } } } } //relightBlock and propagateSkylightOcclusion are reflection hacks to force update block lighting. //If I remove these, packet send count is cut down to about 20,000 but then all the blocks are fully lit and do not update when I place blocks unless said block produces light itself. try{ this.relightBlock.invoke(chunk, x, y, z); }catch(Exception e){ e.printStackTrace(); } if(y == SEALEVEL - 1) { try{ this.propagateSkylightOcclusion.invoke(chunk, x, z); }catch(Exception e){ e.printStackTrace(); } } } } } chunk.setStorageArrays(storageArrays); } ProvideChunk in my ChunkProvider: public Chunk provideChunk(int par1, int par2) { try { seedRandom.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L); Chunk chunk = new Chunk(worldObj, par1, par2); this.generateBasicTerrain(chunk, par1, par2); BiomeGenBase[] var5 = new BiomeGenBase[16 * 16]; Arrays.fill(var5, MyMod.myBiome); //hack for all-one-biome dimension byte[] var6 = chunk.getBiomeArray(); for (int var7 = 0; var7 < var6.length; ++var7) { var6[var7] = (byte)var5[var7].biomeID; } //chunk.generateSkylightMap(); //didn't seem to do anything on or off return chunk; }catch(Exception e) { e.printStackTrace(); return new Chunk(worldObj, par1, par2); } } I would really like help with this, because from what I understand straightforward chunk block editing is supposed to be *FASTER* than going through world, not slower. If nothing else, can someone tell me what of this is sending so many packets?
-
My question is pretty straightforward: How does one convert x, y, z block coordinates into the chunk byte array for blockIds? I've tried copypasting the way Chunk handles it when you do something like world.setBlock but it causes too much lag to be of use anymore. (I know this is the part of generation that lags because without it my FPS is much smoother.)
-
What I mean is you will have to move the position of the ears around because addChild moves them to a new place so the rotation point is the same as the head. To fix it, in Techne, just move both ears' rotation points to where the head is and then move the actual model back into position.
-
If you want the translated, readable version that appears in Guis:
-
[Solved] Particles are never semi-transparent
Groxkiller replied to Hunternif's topic in Modder Support
If your worried about it simply reverse what you did to get transparency working after you've called draw() ie if it's like GL11.glEnable(GL11.GL_BLEND); then after draw() just call the opposite: GL11.glDisable(GL11.GL_BLEND); -
Your not compensating for the rotation of the player; this will always place it in a specific corner instead of where the player happens to be looking when he/she right clicks. I would post code but it's getting late, but I reccomend you to find a way to convert the rotation of the player into proper coordinates.
-
How To Make Mobs Hold A Default Items
Groxkiller replied to SwiftyChickens's topic in Modder Support
If you do the above and it doesn't render it is because weapon rendering is only ever called if the mob's Render class extends/is RenderBiped. Simply refrence it in your own Render class if it doesn't extend RenderBiped. (It DOES have to extend at least RenderLiving to do this, however)