Everything posted by TLHPoE
-
[1.7.2] Motion and AABB
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.
-
[1.7.2] Motion and AABB
Oh, I just used my own meta data. It orientates itself properly.
-
[1.7.2] [Solved] SkyRender and WorldProvider
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.
-
[1.7.2] Making the gravity like Mars.
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
-
onEnchantedEvent
This would be helpful. Maybe even allow us to see what the enchantments are and edit the values?
-
Item with Damage
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?
-
[1.7.2] Extending EntitySmallFireball
I've tried using the knockback method, nothing.
-
[1.7.2] Motion and AABB
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.
-
[1.7.2] Extending EntitySmallFireball
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.
-
Bounding Box Qs
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.
-
Command Modding Help
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.
-
[1.6.4] Altering item NBT from a Tile Entity
Could you post your full updateEntity method?
-
Setting resource location for potion
- Setting resource location for potion
I mean as in the icon when opening your inventory.- Setting resource location for potion
Hello, I'd like a way to set the resource location from which a potion gets its icon from.- [1.7.2] Potions
Thanks, I was unaware that you could already add potion effects. Is there anyway to use your own icon sheet?- [1.7.2] Potions
Is there any hook for adding potions yet? (Not sure if this is the right section for this)- [1.7.2] Knock Back Entity
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.- [Solved] Red exclamation
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- [1.7.2] How I can save a String in a block?
You could make the block a tile entity and save the string to the tile entity's nbt.- [1.7.2] No Damage Arrow
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); }- [1.7.2] Setting Dimension Default Light Level
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.- How to give a projectile knockback?
There's a knockBack method in EntityLivingBase.- [1.6.4] crashing on loading mod
There's a NPE in your model class. I can't help you since you posted your main class twice.- [1.7.2] Setting Dimension Default Light Level
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; } } - Setting resource location for potion
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.