Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Ferrettomato

Members
  • Joined

  • Last visited

  1. If it's a delay you want, thread.sleep() definitely won't work as intended, as the post above says. The proper method would depend on what's playing the sounds; if it's an item, consider saving and adding to the countdown in its NBT data; if it's a tile entity, just create an integer in the tile entity's class and add to it in update(); if it's the player itself (or another entity), you might want to look into capabilities.
  2. Thanks a bunch! There is some weirdness with translucent tiles, but disabling glDepthMask more or less did exactly what I wanted.
  3. I'm making a custom particle that is partially semi-transparent. I want the alpha of the particles to combine (so that two low-alpha parts appear high-alpha when overlapping), instead of hiding the particles behind them. The particles do this, but only when the player is facing in the direction the particle is traveling. How can I get the particles to overlap regardless of the player's looking direction? My particle's render function: @Override public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { // this.theRenderEngine.bindTexture(rLocPortal); // super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); // int i = 1;//(int)(((float)this.life + partialTicks) * 15.0F / (float)this.lifeTime); // if (i <= 15) // { GlStateManager.enableAlpha(); GL11.glEnable(GL11.GL_BLEND); this.theRenderEngine.bindTexture(rLoc); float f = /*(float)(i % 4) /*/ (0.0f); float f1 = 1;//f + 0.24975F; float f2 = /*float)(i / 4) /*/ (0.0f); float f3 = 1;//f2 + 0.24975F; float f4 = 0.3F; float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); GlStateManager.color(0.0F, 0.0F, 0.0F, 1.0F); this.particleAlpha = 1F; this.particleRed = 1F; this.particleBlue = 1F; this.particleGreen = 1F; GlStateManager.disableLighting(); RenderHelper.disableStandardItemLighting(); worldRendererIn.begin(7, VERTEX_FORMAT); worldRendererIn.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); worldRendererIn.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); Tessellator.getInstance().draw(); GlStateManager.enableLighting(); GL11.glDisable(GL11.GL_BLEND); // } } Apologies if I'm using strange terminology. I'm new to rendering and such.
  4. If you need another example, the visible-source Wizardry mod has an easy-to-understand implementation of capabilities. I used it to figure out capabilities myself.
  5. I'm trying to hide (vanilla) mobs from players under certain conditions. Canceling RenderLivingEvent.Pre works fine for hiding the model itself, but their shadows are still visible. Is there any way to hide them client-side?
  6. Having a 20% chance of spreading every 5 ticks seems to work well enough. It actually makes the movement feel more natural. Thanks.
  7. I'm trying to make a grey goo-esque block that eats through plants. It works pretty well so far, but the massive amount of updates that happen every tick when it spreads to a thick forest cripples my FPS. How could I reduce this lag? I've tried disabling the particles, but that doesn't seem to help. TileEntity class: public class TileEntityLocust extends TileEntity implements ITickable { private int counter = 0; private int food = 6; private IBlockState state; @Override public void update() { Random rand = new Random(); counter++; state = worldObj.getBlockState(pos); if(counter >= 5 && !worldObj.isRemote) { for(int i = 0; i < 6; i++) { BlockPos target = pos.offset(EnumFacing.getFront(i)); int newFood = food - 3; boolean didSpread = false; Block block = worldObj.getBlockState(target).getBlock(); Material mat = block.getMaterial(worldObj.getBlockState(target)); if(mat.equals(Material.LEAVES) || mat.equals(Material.PLANTS) || mat.equals(Material.VINE)) { newFood = food + 1; worldObj.destroyBlock(target, !(block instanceof BlockCrops)); worldObj.setBlockState(target, state); didSpread = true; } else if(worldObj.getBlockState(target).getBlock().equals(Blocks.AIR) && newFood >= 0) { worldObj.setBlockState(target, state); didSpread = true; } if(didSpread) { NBTTagCompound tag = worldObj.getTileEntity(target).writeToNBT(new NBTTagCompound()); tag.setInteger("counter", 0); tag.setInteger("food", newFood); worldObj.getTileEntity(target).readFromNBT(tag); } } worldObj.setBlockToAir(pos); } worldObj.spawnParticle(EnumParticleTypes.SWEEP_ATTACK, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + rand.nextFloat()), (double)((float)pos.getZ() + rand.nextFloat()), (rand.nextDouble() - 0.5) / 5, (rand.nextDouble() - 0.5) / 5, (rand.nextDouble() - 0.5) / 5, new int[0]); } @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); counter = tag.getInteger("counter"); food = tag.getInteger("food"); } @Override public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag.setInteger("counter", counter); tag.setInteger("food", food); return super.writeToNBT(tag); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) { this.readFromNBT(packet.getNbtCompound()); } }
  8. It just applies a potion effect. I tried only doing that if worldObj.isRemote, but the effect isn't visible.
  9. Is there any way to render the spectral arrow's "Glowing" effect on a mob so that it's only visible on a certain player's client?
  10. I added that to the end of the file (since you didn't specify a location), but it's just replaced the unintelligible character with a '?' in a white square.
  11. I've been using the section sign (§) to make my item tooltips a bit more colorful. I've been doing this using Item#addInformation. The formatting works perfectly in the development environment, but whenever I build the mod and use it in the actual game, it bugs out and seems to replace all the section signs with another unintelligible symbol, resulting in no formatting taking place. What's wrong?
  12. Is there any way to prevent the player from emitting particles when they sprint/swim/fall/etc.? (when they've equipped a certain item.) I'm trying to make the player completely undetectable, and this is the last step.
  13. Thanks! The problem was that I forgot to cast event.entityLiving to a more specific type; it's rather misleading when it actually gives you an EntityLivingBase.
  14. I've already tried setting its target to null in the event, but the field is final, and the entity's saved target is private. I already have the item canceling damage, but that's not the point.
  15. I'm trying to make an armor item that, when worn, causes all mobs to ignore (not target) the player. I've tried removing EntityAITarget/EntityAINearestAttackableTarget, but I keep getting ConcurrentModificationExceptions. How would I go about doing this properly?

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.