Jump to content

Abastro

Forge Modder
  • Posts

    1075
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Abastro

  1. Do you mean this code? /** * Will update this chunk renderer */ public void updateRenderer(EntityLivingBase p_147892_1_) { if (this.needsUpdate) //needsUpdate { this.needsUpdate = false; //Rendering bound for Chunk. (posX~posX+16, ...) int i = this.posX; int j = this.posY; int k = this.posZ; int l = this.posX + 16; int i1 = this.posY + 16; int j1 = this.posZ + 16; for (int k1 = 0; k1 < 2; ++k1) { this.skipRenderPass[k1] = true; //Mark render pass to skip } Chunk.isLit = false; //isLit Determines if the chunk is lit or not at a light value greater than 0. HashSet hashset = new HashSet(); hashset.addAll(this.tileEntityRenderers); //Tileentity Renderer HashSet. this.tileEntityRenderers.clear(); Minecraft minecraft = Minecraft.getMinecraft(); EntityLivingBase entitylivingbase1 = minecraft.renderViewEntity; //The Viewing Entity. int l1 = MathHelper.floor_double(entitylivingbase1.posX); //l1 is posX int i2 = MathHelper.floor_double(entitylivingbase1.posY); // i2 is posY int j2 = MathHelper.floor_double(entitylivingbase1.posZ); // j2 is posZ byte b0 = 1; //gets chunk cache which is for rendering bound for Chunk. (posX~posX+16, ...). Regardless of viewing entity. ChunkCache chunkcache = new ChunkCache(this.worldObj, i - b0, j - b0, k - b0, l + b0, i1 + b0, j1 + b0, b0); if (!chunkcache.extendedLevelsInChunkCache()) //if(chunk.getAreLevelsEmpty) .. IDK { ++chunksUpdated; //Increases update count. //Gets RendeBlocks. RenderBlocks renderblocks = new RenderBlocks(chunkcache); //Forge Hook for setting world renderer. net.minecraftforge.client.ForgeHooksClient.setWorldRendererRB(renderblocks); this.bytesDrawn = 0; this.vertexState = null; for (int k2 = 0; k2 < 2; ++k2) //RenderPass loop { boolean flag = false; boolean flag1 = false; boolean flag2 = false; for (int l2 = j; l2 < i1; ++l2) //X axis loop { for (int i3 = k; i3 < j1; ++i3) //Y axis loop { for (int j3 = i; j3 < l; ++j3) //Z axis loop { Block block = chunkcache.getBlock(j3, l2, i3); //get block on the position to render if (block.getMaterial() != Material.air) //If it is not air, render the block. { if (!flag2) { //sets flag2 to true flag2 = true; //pre render blocks. this.preRenderBlocks(k2); } //Rendering TileEntity. if (k2 == 0 && block.hasTileEntity(chunkcache.getBlockMetadata(j3, l2, i3))) { TileEntity tileentity = chunkcache.getTileEntity(j3, l2, i3); if (TileEntityRendererDispatcher.instance.hasSpecialRenderer(tileentity)) { this.tileEntityRenderers.add(tileentity); } } //Gets render pass of a block. int k3 = block.getRenderBlockPass(); if (k3 > k2) { //blockpass is bigger than current pass, flag = true; } //Can render on RenderPass check. if (!block.canRenderInPass(k2)) continue; { //Render blocks by type flag1 |= renderblocks.renderBlockByRenderType(block, j3, l2, i3); if (block.getRenderType() == 0 && j3 == l1 && l2 == i2 && i3 == j2) { //Block Rendering Settings for Default Blocks at Player Location. renderblocks.setRenderFromInside(true); renderblocks.setRenderAllFaces(true); renderblocks.renderBlockByRenderType(block, j3, l2, i3); renderblocks.setRenderFromInside(false); renderblocks.setRenderAllFaces(false); } } } } } } if (flag1) { this.skipRenderPass[k2] = false; //Do not skip RenderPass } if (flag2) { //when pre render got called, , post render block. this.postRenderBlocks(k2, p_147892_1_); } else { //Set skip render pass. flag1 = false; } if (!flag) { break; } } //Forge Hooks (finalization?). net.minecraftforge.client.ForgeHooksClient.setWorldRendererRB(null); } //Some refreshing. HashSet hashset1 = new HashSet(); hashset1.addAll(this.tileEntityRenderers); hashset1.removeAll(hashset); this.tileEntities.addAll(hashset1); hashset.removeAll(this.tileEntityRenderers); this.tileEntities.removeAll(hashset); this.isChunkLit = Chunk.isLit; this.isInitialized = true; } } So basically one WorldRenderer renders a chunk.
  2. I think the flag 2 might cause the issue.
  3. Yes, but there is World#getPlayerEntitybyUUID(UUID id) which is more appropriate.
  4. Note that just throwing 6000 to the parameter would break some custom dimension mods.
  5. Basically this thread has something with container code, so it'll be okay to post here.
  6. I already said how to do it.. As long as for 'Forge 1.7.10-10.13.0.1160' there is a method: 'Slot#func_111238_b()' which disables highlighting when your mouse is on the slot. You can return false there, and return empty icon on the Slot#getBackgroundIconIndex(). And when someone tries to get some item into the slot, do not allow it using Slot#canTakeStack and Slot#putStack.
  7. What is this? itemStacks.writeToNBT(nbttagcompound1);
  8. Performance would not be a problem, since you just have to check nearby blocks and make them fall when some changes were made. What I cannot guarantee is whether the way could cover every circumstances or not.
  9. Of course you can make custom slot invisible. (Yes, your own custom slot is needed) In my dev env(Forge 1.7.10-10.13.0.1160) there is a method: 'Slot#func_111238_b()' which disables highlighting when your mouse is on the slot. You can return false there, and return empty icon on the Slot#getBackgroundIconIndex().
  10. I think this way would work, but it could be inappropriate. 1. Subscribe to PopulateChunkEvent.Post and BlockEvent.BreakEvent, PlaceEvent and MultiPlaceEvent. 2. When a chunk/block is populated/changed, remove the block or nearby block and spawn falling entity under some condition. You would have to create your own falling entity.
  11. It's not a bug, but just a feature which the client tick event has. Since client means everything related with gui/rendering, the feature should be reasonable one (at least to me). What I think is strange is that the client tick event is not called when the client main screen shows up.
  12. Something is blocking your internet connection to the download site. Do you have any suspects?
  13. onBlockHarvested: called directly before player tries to break the block. onBlockDestroyedByPlayer: called directly after player breaks the block. Not be called when Block#removedByPlayer(...) returns false. Also here is minecraft code related with block breaking mechanism: private boolean removeBlock(int p_73079_1_, int p_73079_2_, int p_73079_3_, boolean canHarvest) { Block block = this.theWorld.getBlock(p_73079_1_, p_73079_2_, p_73079_3_); int l = this.theWorld.getBlockMetadata(p_73079_1_, p_73079_2_, p_73079_3_); block.onBlockHarvested(this.theWorld, p_73079_1_, p_73079_2_, p_73079_3_, l, this.thisPlayerMP); boolean flag = block.removedByPlayer(theWorld, thisPlayerMP, p_73079_1_, p_73079_2_, p_73079_3_, canHarvest); if (flag) { block.onBlockDestroyedByPlayer(this.theWorld, p_73079_1_, p_73079_2_, p_73079_3_, l); } return flag; }
  14. 1. Please don't use SideOnly.. Instead, register it on client proxy 2. You should set up your own IMessage and IMessageHandler implementations, to process the key input packet.
  15. There is better way with FOVUpdateEvent(it could be slightly wrong name), you can use it for zooming.
  16. It is known that changing player hitbox is fairly hard. It might be easily done by changing some fields in EntityPlayer, which result in 'Player kicked by flying', so if you want that you have to allow flying to the player, and make your own way to detect flying. Another way is changing rendering, hitbox mechanism, and click position adjustment independently, which needs a lot of works and potential incompatibilities with many mods. So what way do you want to use?
  17. You're putting null to the field 'inventory' when getting items from a slot. It should be inventory. @Override public ItemStack decrStackSize(int i, int j) { if(inventory[i] != null) { if(inventory[i].stackSize <= j) { ItemStack itemstack = inventory[i]; inventory = null; return itemstack; } else { inventory[i].stackSize -= j; return new ItemStack(inventory[i].getItem(), j, inventory[i].getMetadata()); } } else { return null; } }
  18. Please explain why do you need this and what block do you want to reference.
  19. There is FOVUpdateEvent (or something similar), you can use that to change zoom.
  20. Is the block metadata-block with custom ItemBlock implementation?
  21. Then just use Item#getIconFromDamage(int damage). EDIT: Wait, you are just using metadata for tileentity! Then you should bind your texture yourself, in the TileEntitySpecialRenderer!
  22. ..Wait, do you only changes the texture via item metadata? Then ItemRenderer is not appropriate.
  23. You should register those icons into the 'registerIcons' and Render them on 'renderItem'. Just setting texture name there should not work.
  24. If you plan to purchase metadata or NBT items too, then you should create itemstack.
  25. You cannot ever access to any Server-only fields on the Client side(Gui)! You should use Minecraft#thePlayer#worldObj instead.
×
×
  • Create New...

Important Information

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