Abastro
Forge Modder-
Posts
1075 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Abastro
-
[1.7.10] Questions about Bounding boxes and World renderers
Abastro replied to Elix_x's topic in Modder Support
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. -
[1.7.10] Need my item to get the players display name
Abastro replied to HappyKiller1O1's topic in Modder Support
Yes, but there is World#getPlayerEntitybyUUID(UUID id) which is more appropriate. -
[1.7.10] Detect if player is looking at the sun.
Abastro replied to Tinker's topic in Modder Support
Note that just throwing 6000 to the parameter would break some custom dimension mods. -
Odd world.isRemote difference between two custom machines
Abastro replied to TrekkieCub314's topic in Modder Support
Basically this thread has something with container code, so it'll be okay to post here. -
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.
-
Odd world.isRemote difference between two custom machines
Abastro replied to TrekkieCub314's topic in Modder Support
What is this? itemStacks.writeToNBT(nbttagcompound1); -
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.
-
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().
-
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.
-
[1.7.10][Forge-10.13.2.1291] possible bug with ClientTickEvent
Abastro replied to N247S's topic in Modder Support
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. -
Something is blocking your internet connection to the download site. Do you have any suspects?
-
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; }
-
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.
-
[1.7.10] Player hitbox and hit mechanics - how to change stuff
Abastro replied to Thornack's topic in Modder Support
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? -
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; } }
-
[1.8]How to get PropertyInteger value from Blocks
Abastro replied to Madsthunder's topic in Modder Support
Please explain why do you need this and what block do you want to reference. -
[1.7.10] Changing the camera - how to force 3rd person view
Abastro replied to Thornack's topic in Modder Support
There is FOVUpdateEvent (or something similar), you can use that to change zoom. -
Is the block metadata-block with custom ItemBlock implementation?
-
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!
-
..Wait, do you only changes the texture via item metadata? Then ItemRenderer is not appropriate.
-
You should register those icons into the 'registerIcons' and Render them on 'renderItem'. Just setting texture name there should not work.
-
If you plan to purchase metadata or NBT items too, then you should create itemstack.
-
You cannot ever access to any Server-only fields on the Client side(Gui)! You should use Minecraft#thePlayer#worldObj instead.