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.

TLHPoE

Members
  • Joined

  • Last visited

Everything posted by TLHPoE

  1. Here's some updated code: package fans.tileentity; import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import fans.block.BlockFan; public class TileEntityFan extends TileEntity { @Override public void updateEntity() { if(BlockFan.isPowered(worldObj, xCoord, yCoord, zCoord)) { int current = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); switch(current) { case (0): { //Front System.err.println("CURRENT: " + current); List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 9)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionZ += ((BlockFan) this.getBlockType()).getPower(); } } } break; } case (1): { //Right System.err.println("CURRENT: " + current); List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 9, yCoord + 1, zCoord + 1)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionX += ((BlockFan) this.getBlockType()).getPower(); } } } break; } case (2): { //Back System.err.println("CURRENT: " + current); List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord - ); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionZ -= ((BlockFan) this.getBlockType()).getPower(); } } } break; } case (3): { //Left System.err.println("CURRENT: " + current); List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord - 8, yCoord + 1, zCoord + 1)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionX -= ((BlockFan) this.getBlockType()).getPower(); } } } break; } case (4): { //Top System.err.println("CURRENT: " + current); List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 9, zCoord + 1)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionY += ((BlockFan) this.getBlockType()).getPower(); } } } break; } case (5): { //Bottom System.err.println("CURRENT: " + current); List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord - 8, zCoord + 1)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionY -= ((BlockFan) this.getBlockType()).getPower(); } } } break; } } } } } I got the bug fixed, I forgot to add breaks in the cases. My new problem is that the front, right, and top code work, but not he back, left, and bottom code.
  2. Oh, I just used my own meta data. It orientates itself properly.
  3. In my dimension, I have it set so that it's dark 24/7. I'm getting the same effect, the closer I get to a light source, the brighter the sky is.
  4. I'm not sure if this is the best way, but you could do this: 1. Set up a tick event for players 2. Check if they're in the air/jumping 3. Add to motionY To make a tick event handler thing: 1. Create class 2. Create method with TickEvent.PlayerTickEvent as an argument 3. Add the SubscribeEvent annotation 4. Register the class in FMLCommonHandler
  5. TLHPoE replied to Dawars's topic in Suggestions
    This would be helpful. Maybe even allow us to see what the enchantments are and edit the values?
  6. First, you would need to set the max damage of an item. For the crafting part, I don't really know how to do that. Maybe there's an event?
  7. I've tried using the knockback method, nothing.
  8. I'm making a block that acts like a fan, and uses meta data to orientate itself. package fans.tileentity; import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import fans.block.BlockFan; public class TileEntityFan extends TileEntity { @Override public void updateEntity() { if(BlockFan.isPowered(worldObj, xCoord, yCoord, zCoord)) { int current = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); switch(current) { case (0): { List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + ); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionZ += ((BlockFan) this.getBlockType()).getPower(); } } } } case (1): { List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 8, yCoord + 1, zCoord - 1)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionX += ((BlockFan) this.getBlockType()).getPower(); } } } } case (2): { List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord - ); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionZ -= ((BlockFan) this.getBlockType()).getPower(); } } } } case (3): { List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord - 8, yCoord + 1, zCoord - 1)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionX -= ((BlockFan) this.getBlockType()).getPower(); } } } } case (4): { List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 8, zCoord + 1)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionY += ((BlockFan) this.getBlockType()).getPower(); } } } } case (5): { List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord - 8, zCoord + 1)); if(!entities.isEmpty()) { for(Object obj : entities) { if(obj instanceof Entity && !((Entity) obj).isSneaking()) { ((Entity) obj).motionY -= ((BlockFan) this.getBlockType()).getPower(); } } } } } } } } For some reason, when its oriented in a horizontal position and I'm standing on top of it, it slows me down. Also, when I jump, I get launched as if the fan oriented upwards.
  9. I have an entity that extends EntitySmallFireball, and I override the onImpact method. package realmoffera.entity.projectile; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntitySmallFireball; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityDreamFloaterShotRF extends EntitySmallFireball { public static final int KB = 2; public EntityDreamFloaterShotRF(World par1World) { super(par1World); } public EntityDreamFloaterShotRF(World par1World, EntityLivingBase par2EntityLivingBase, double par3, double par5, double par7) { super(par1World, par2EntityLivingBase, par3, par5, par7); } public EntityDreamFloaterShotRF(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) { super(par1World, par2, par4, par6, par8, par10, par12); } @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if(par1MovingObjectPosition.entityHit != null) { System.err.println("Entity hit!"); par1MovingObjectPosition.entityHit.motionX = motionX * KB; par1MovingObjectPosition.entityHit.motionY = motionY * KB; par1MovingObjectPosition.entityHit.motionZ = motionZ * KB; par1MovingObjectPosition.entityHit.posY += 10; } this.setDead(); } } For some reason, it prints the message, but doesn't do any of the motion or position changes.
  10. The bounding box works by having a set minimum x, y, and z, and a maximum x, y, and z. The center of the bounding box is between the min x and max x, the min y and the max y, etc. I'm pretty sure it doesn't rotate.
  11. When the player uses the /sethome command, I would store the current player's coordinates in the player's persistent nbt tag, and then teleport the player to those coordinates when they do the /home command. Same goes with /back. When the player dies, I would store the player's coordinates in the player's persistent nbt tag, and then teleport the player to those coordinates when they do the /back command. For the /bed command, just get the bed's coordinates through the player.
  12. Could you post your full updateEntity method?
  13. I mean as in the icon when opening your inventory.
  14. Hello, I'd like a way to set the resource location from which a potion gets its icon from.
  15. Thanks, I was unaware that you could already add potion effects. Is there anyway to use your own icon sheet?
  16. Is there any hook for adding potions yet? (Not sure if this is the right section for this)
  17. I have this entity that extends EntitySmallFireball. The entity is supposed to be shot from a mob, and on collision with another mob, it knocks the collided mob back. I used some code from EntityArrow for the knock back. It's being called, but there are no visible changes to the collided mob. package realmoffera.entity.projectile; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntitySmallFireball; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityDreamFloaterShotRF extends EntitySmallFireball { public static final int KB = 2; public EntityDreamFloaterShotRF(World par1World) { super(par1World); } public EntityDreamFloaterShotRF(World par1World, EntityLivingBase par2EntityLivingBase, double par3, double par5, double par7) { super(par1World, par2EntityLivingBase, par3, par5, par7); } public EntityDreamFloaterShotRF(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) { super(par1World, par2, par4, par6, par8, par10, par12); } @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if(!this.worldObj.isRemote) { if(par1MovingObjectPosition.entityHit != null) { float f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if(f4 > 0.0F) { par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double) KB * 0.6000000238418579D / (double) f4, 0.1D, this.motionZ * (double) KB * 0.6000000238418579D / (double) f4); } } this.setDead(); } } } I have also tried setting the added velocity to a static number like 10.
  18. I think this should fix it, since I have the red exclamation mark frequently when updating. (For me, it means that the forgeBin is missing) 1. gradlew --refresh-dependenceis 2. gradlew eclispe 3. gradlew setupDevWorkspace 4. gradlew setupDecompWorkspace
  19. You could make the block a tile entity and save the string to the tile entity's nbt.
  20. I'm trying to spawn an arrow that does a lot of knock back, but no damage what so ever. If I set the damage to 0, it bounces off the player. @Override public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) { EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 1.6F, (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); entityarrow.setDamage(0); entityarrow.setKnockbackStrength(3); entityarrow.canBePickedUp = 0; //play sound this.worldObj.spawnEntityInWorld(entityarrow); }
  21. Sorry, I need to reword the problem. How do I reset the default sky light level? Like the sun's brightness. Tweaking the float makes shadows darker and stuff.
  22. There's a knockBack method in EntityLivingBase.
  23. There's a NPE in your model class. I can't help you since you posted your main class twice.
  24. Is there a way to edit the default light level of a dimension? Like making the sun slightly dimmer, in a way. I found this method, but I'm not sure what to tweak. @Override protected void generateLightBrightnessTable() { float f = 0.1F; for(int i = 0; i <= 15; ++i) { float f1 = 1.0F - (float) i / 15.0F; this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f; } }

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.