MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / pushOutOfBlocks

Method pushOutOfBlocks

src/main/java/net/minecraft/entity/Entity.java:2320–2396  ·  view source on GitHub ↗
(double x, double y, double z)

Source from the content-addressed store, hash-verified

2318 }
2319
2320 protected boolean pushOutOfBlocks(double x, double y, double z)
2321 {
2322 BlockPos blockpos = new BlockPos(x, y, z);
2323 double d0 = x - (double)blockpos.getX();
2324 double d1 = y - (double)blockpos.getY();
2325 double d2 = z - (double)blockpos.getZ();
2326 List<AxisAlignedBB> list = this.worldObj.func_147461_a(this.getEntityBoundingBox());
2327
2328 if (list.isEmpty() && !this.worldObj.isBlockFullCube(blockpos))
2329 {
2330 return false;
2331 }
2332 else
2333 {
2334 int i = 3;
2335 double d3 = 9999.0D;
2336
2337 if (!this.worldObj.isBlockFullCube(blockpos.west()) && d0 < d3)
2338 {
2339 d3 = d0;
2340 i = 0;
2341 }
2342
2343 if (!this.worldObj.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3)
2344 {
2345 d3 = 1.0D - d0;
2346 i = 1;
2347 }
2348
2349 if (!this.worldObj.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3)
2350 {
2351 d3 = 1.0D - d1;
2352 i = 3;
2353 }
2354
2355 if (!this.worldObj.isBlockFullCube(blockpos.north()) && d2 < d3)
2356 {
2357 d3 = d2;
2358 i = 4;
2359 }
2360
2361 if (!this.worldObj.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3)
2362 {
2363 d3 = 1.0D - d2;
2364 i = 5;
2365 }
2366
2367 float f = this.rand.nextFloat() * 0.2F + 0.1F;
2368
2369 if (i == 0)
2370 {
2371 this.motionX = -f;
2372 }
2373
2374 if (i == 1)
2375 {
2376 this.motionX = f;
2377 }

Callers 2

onUpdateMethod · 0.45
onUpdateMethod · 0.45

Calls 12

getEntityBoundingBoxMethod · 0.95
westMethod · 0.95
eastMethod · 0.95
upMethod · 0.95
northMethod · 0.95
southMethod · 0.95
func_147461_aMethod · 0.80
isBlockFullCubeMethod · 0.80
getXMethod · 0.65
getYMethod · 0.65
getZMethod · 0.65
isEmptyMethod · 0.45

Tested by

no test coverage detected