Merge branch master-MC1.10 into master-MC1.11

This commit is contained in:
payonel 2017-12-10 03:53:14 -08:00
commit c0eefc152e

View File

@ -102,18 +102,15 @@ class MotionSensor(val host: EnvironmentHost) extends prefab.AbstractManagedEnvi
// is pseudo-infrared driven (it only works for *living* entities, after // is pseudo-infrared driven (it only works for *living* entities, after
// all), so I think it makes more sense for it to work in the dark, too. // all), so I think it makes more sense for it to work in the dark, too.
/* entity.getBrightness(0) > 0.2 && */ { /* entity.getBrightness(0) > 0.2 && */ {
var ox = x + 0.5 var origin = new Vec3d(x, y, z)
var oy = y + 0.5
var oz = z + 0.5
val target = new Vec3d(entity.posX, entity.posY, entity.posZ) val target = new Vec3d(entity.posX, entity.posY, entity.posZ)
// Start trace outside of this block. val path = origin.subtract(target).normalize()
if (entity.posX < x) ox -= 0.75 origin = origin.addVector(
if (entity.posX > x + 1) ox += 0.75 path.xCoord * 0.75,
if (entity.posY < y) oy -= 0.75 path.yCoord * 0.75,
if (entity.posY > y + 1) oy += 0.75 path.zCoord * 0.75
if (entity.posZ < z) oz -= 0.75 )
if (entity.posZ > z + 1) oz += 0.75 world.rayTraceBlocks(origin, target) == null
world.rayTraceBlocks(new Vec3d(ox, oy, oz), target) == null
} }
private def sendSignal(entity: EntityLivingBase) { private def sendSignal(entity: EntityLivingBase) {