Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. ah just one thing - brain fade on my part.... sorry about that... Random random = new Random(); int ticksTillConversion = MIN_TICKS_TILL_CONVERSION + random.nextInt(MAX_TICKS_TILL_CONVERSION - MIN_TICKS_TILL_CONVERSION); or int ticksTillConversion = (int)(MIN_TICKS_TILL_CONVERSION + Math.random() * (MAX_TICKS_TILL_CONVERSION - MIN_TICKS_TILL_CONVERSION)); -TGG
  2. Hi The answer lies in the vanilla code... ChunkProviderClient:: /** * loads or generates the chunk at the chunk location specified */ public Chunk loadChunk(int p_73158_1_, int p_73158_2_) { Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); this.chunkListing.add(chunk); net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); chunk.isChunkLoaded = true; return chunk; } Chunk:: /** * Called when this Chunk is loaded by the ChunkProvider */ public void onChunkLoad() { this.isChunkLoaded = true; this.worldObj.func_147448_a(this.chunkTileEntityMap.values()); for (int i = 0; i < this.entityLists.length; ++i) { Iterator iterator = this.entityLists[i].iterator(); while (iterator.hasNext()) { Entity entity = (Entity)iterator.next(); entity.onChunkLoad(); } this.worldObj.addLoadedEntities(this.entityLists[i]); } MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); } ...it depends on what is triggering the load event... -TGG
  3. Hi I reckon you could also schedule a scheduled tick to occur at a random time after creation. for example int ticksTillConversion = MIN_TICKS_TILL_CONVERSION + Random(MAX_TICKS_TILL_CONVERSION - MIN_TICKS_TILL_CONVERSION); world.scheduleBlockUpdate(wx, wy, wz, block, ticksTillConversion); which later calls Block.updateTick() -TGG
  4. Hi this link has some more relevant info http://www.minecraftforge.net/forum/index.php/topic,21963.msg111491.html#msg111491 -TGG
  5. Check out line 207. -TGG
  6. Hi Please post your ScienceCraft.java:362. It appears to be trying to register the Block incorrectly. -TGG
  7. Ah, I think I understand what you're saying now. Looking at the vanilla, I doubt there is another way. Perhaps you could make it Material.water, figure out what is stopping the block from being placed on top of itself, and work around that. -TGG
  8. Hi Yes- shouldSideBeRendered() http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-transparent-blocks.html -TGG
  9. Hi You might find these links interesting. They were for 1.6.4 but are still mostly accurate. http://greyminecraftcoder.blogspot.com.au/2013/10/client-side-class-linkage-map.html http://greyminecraftcoder.blogspot.com.au/2013/10/server-side-class-linkage-map.html Most places you need a world, the method will give it to you as a parameter. If not, you can get world from Server side you can access the worlds from MinecraftServer.getServer().worldServerForDimension or DimensionManager.getWorld() Client side you can access the world from Minecraft.theworld This page might also be helpful for background info http://greyminecraftcoder.blogspot.com.au/2013/07/blocks.html -TGG
  10. Hi Show your full error log? Are you registering items or blocks with a fixed ID, by any chance? -TGG
  11. Hi It looks to me like you are running code on the server side which is trying to create or reference vanilla client-side-only classes (Render or a class inheriting from Render, probably RenderFemaleCreeper). Perhaps a static client-side-only field? Where are you creating your RenderFemaleCreeper instance? You shouldn't have to add @SideOnly(Side.Client) in front of your classes (at least - I've never had to). You just need to make sure that none of your server-side code ever refers to vanilla client-side-only classes. ClientProxy: rendering etc; client side only CommonProxy: things that happen both on client and server. If you're still not sure, this link might help (what sequituri said, with a bit more detail) http://greyminecraftcoder.blogspot.com.au/2013/11/how-forge-starts-up-your-code.html -TGG PS this is dodgy, delete it.... private static final String __OBFID = "CL_00000837";
  12. Post your code? I gather by "animation" you mean the model "ball X offset position" Vinther is right, you have only one instance of FrictionRender, so when you change its model animation during one call to renderTileEntityAt(), it affects other TileEntities, since you update your this.model.Ball.offsetX after the model render not before. Although, that would just make the animation wrong, not the same for all TileEntities, so I'm not certain I have understood the symptoms properly. I also think it's a bad idea to update the animation in renderTileEntityAt(), i.e. entity.ballX += 0.1; As the framerate changes, the animation speed will change too (and will be jerky). Much better to either update the animation parameters in the TileEntity tick update (fixed at 20 ticks per second), or to calculate the animation from the system time eg System.nanoTime. for example in updateEntity() ballX += BALL_X_CHANGE_PER_TICK; or in renderTileEntityAt() final double BALL_X_SPEED = 1.0; // metres per second final double NS_PER_SECOND = 1e9; ballX = ballStartX + BALL_X_SPEED * System.nanoTime() / NS_PER_SECOND; The major difference is whether the animation continues while the game is paused or not. -TGG
  13. For example: src/main/resources/assets/yourmodname/textures/blocks for blocks src/main/resources/assets/yourmodname/textures/entity for entities etc -TGG
  14. Hi You could try world.removeTileEntity(wx, wy, wz); before your setBlock to air -TGG
  15. Looks to me like tileEntityInterChest.PlayerName is null when this GuiInterChest.initGui is called. If you can figure why, you'll have your answer... -TGG
  16. Hi Show your ModelFemaleCreeper class? You haven't prefixed it with @SideOnly(Side.Client) by any chance? -TGG
  17. Hi I think that if you're using the Tessellator you should change settings on the Tessellator, not using OpenGL. For example tess.startDrawingQuads(); //Starts drawing int brightness = myBlock.getMixedBrightnessForBlock(world, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord); tess.setBrightness(brightness); tess.setColorOpaque_F(1.0F, 1.0F, 1.0F); To be honest, I'm not sure that's the actual problem. The intermittent loss of texture is pretty strange since you're using addVertexWithUV() and from memory that should turn on texturing every time. You might also find this class useful; https://github.com/TheGreyGhost/SpeedyTools/blob/master/src/speedytools/common/utilities/OpenGLdebugging.java I've used it in the past to check what the OpenGL settings are; it's not complete, but dumpAllIsEnabled() works and has showed up problems for me before- dump for a good render, dump for a bad render, and spot the difference. Not sure it is likely to help you in this case, but it might be worth a go. -TGG
  18. Unfortunately, I'm not experienced with it either, never had to use it This tutorial will probably help http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing It's for 1.6.2, I imagine the concepts are the same but you may need to do some more research to adapt it to 1.7. And to learn some bytecode, which will either be really interesting or a major headache depending on your reaction to something like this: 0: iconst_2 1: istore_1 2: iload_1 3: sipush 1000 6: if_icmpge 44 9: iconst_2 10: istore_2 11: iload_2 12: iload_1 13: if_icmpge 31 I used to code in assembly so it looks like fun to me, but you might not agree -TGG
  19. Hi Yes I think there is a way; use ASM + Reflection to edit the vanilla handler for the packet you're interested in. Apart from that, I don't know of any way to intercept packets before vanilla gets hold of them for processing. -TGG
  20. Hi My general approach is to code it in a way that is easy to understand and maintain. Then I do some performance testing, find the slow parts, refactor them, and test again. So I reckon the answer to your question is "test it under typical operating conditions and find out". Some general rules I personally apply- 1) Simple and easy to understand; no fancy tricks 2) Minimise network traffic. 3) Don't worry about memory unless it's more than a MB or so. 4) Don't worry about doing any optimisations on CPU usage at all, beyond choosing the right type of data structure for the operations you're doing (say LinkedList vs HashMap) 5) Always ask the question "will the user notice the difference?" 6) Test, then optimise. Don't "optimise" first. -TGG
  21. Hi Why are you using your own saved "render" variable, which may be invalid if initialised too early, or may become invalid if the player teleports to another dimension or restarts the game? You should use the one passed to your render method (renderer) public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) -TGG
  22. Hi It should be relatively straightforward; I imagine your attack code just needs to spawn an EntityLightningBolt at the right location (of the enemy) - on the server side only From WorldServer: this.theProfiler.endStartSection("thunder"); int i1; int j1; int k1; int l1; if (provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) { this.updateLCG = this.updateLCG * 3 + 1013904223; i1 = this.updateLCG >> 2; j1 = k + (i1 & 15); k1 = l + (i1 >> 8 & 15); l1 = this.getPrecipitationHeight(j1, k1); if (this.canLightningStrikeAt(j1, l1, k1)) { this.addWeatherEffect(new EntityLightningBolt(this, (double)j1, (double)l1, (double)k1)); } } this.theProfiler.endStartSection("iceandsnow"); -TGG
  23. Hi I think there might be several problems causing your error (assuming it's an ArrayOutOfBounds and not a NullPointerException) - the first is that array counting starts from 0 not 1 like Whov said. the second is - what happens if path.listFiles() doesn't return any entries, perhaps because the directory is empty? the third is that all those static variable initialisations might occur before mcDataDir has been initialised, so the directory may be invalid. Better to initialise them in the constructor, and construct the object in your preInitialisation phase. If you fix those things and it still doesn't work, show us your error log? -TGG
×
×
  • Create New...

Important Information

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