mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Fan force falloff
Previously, with two fans facing into each other, either one of them would completely overpower the other, or they'd cancel each other out. Now the force is inversely proportional to the distance, so the items end up in the middle
This commit is contained in:
parent
8a7934d274
commit
3733a8bee9
@ -18,6 +18,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -103,10 +104,13 @@ public class MachineFan extends BlockContainer implements IToolable, ITooltipPro
|
||||
List<Entity> affected = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5 + Math.min(x, 0), yCoord + 0.5 + Math.min(y, 0), zCoord + 0.5 + Math.min(z, 0), xCoord + 0.5 + Math.max(x, 0), yCoord + 0.5 + Math.max(y, 0), zCoord + 0.5 + Math.max(z, 0)).expand(0.5, 0.5, 0.5));
|
||||
|
||||
for(Entity e : affected) {
|
||||
|
||||
double dist = e.getDistance(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
|
||||
double coeff = push * (1 - dist / range / 2);
|
||||
|
||||
e.motionX += dir.offsetX * push;
|
||||
e.motionY += dir.offsetY * push;
|
||||
e.motionZ += dir.offsetZ * push;
|
||||
e.motionX += dir.offsetX * coeff;
|
||||
e.motionY += dir.offsetY * coeff;
|
||||
e.motionZ += dir.offsetZ * coeff;
|
||||
}
|
||||
|
||||
if(worldObj.isRemote && worldObj.rand.nextInt(30) == 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user