From a2e59259b49578caa188b852ef9687e729a4a0b4 Mon Sep 17 00:00:00 2001 From: Amnet Date: Fri, 31 May 2013 11:16:22 +0200 Subject: [PATCH] Fixed the Portal. Tweaked bounding boxes on grass. --- .../biomesoplenty/blocks/BlockBOPFoliage.java | 20 +++ .../helpers/TeleporterPromised.java | 164 +----------------- 2 files changed, 22 insertions(+), 162 deletions(-) diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java b/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java index 2d39c79b4..20dadff90 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPFoliage.java @@ -237,6 +237,12 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable { case ALGAE: return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.015625D, (double) z + 1.0D); + + case 1: // Short Grass + return AxisAlignedBB.getBoundingBox(x + 0.1D, y, z + 0.1D, (double) x + 0.9D, (double) y + 0.25D, (double) z + 0.9D); + + case 2: // Medium Grass + return AxisAlignedBB.getBoundingBox(x + 0.1D, y, z + 0.1D, (double) x + 0.9D, (double) y + 0.6D, (double) z + 0.9D); default: return AxisAlignedBB.getBoundingBox(x + 0.1D, y, z + 0.1D, (double) x + 0.9D, (double) y + 0.8D, (double) z + 0.9D); @@ -262,6 +268,20 @@ public class BlockBOPFoliage extends BlockFlower implements IShearable maxX = maxZ = 1.0F; maxY = 0.015625F; break; + + case 1: // Short grass + minX = minZ = 0.1F; + minY = 0.0F; + maxX = maxZ = 0.9F; + maxY = 0.25F; + break; + + case 2: // Medium grass + minX = minZ = 0.1F; + minY = 0.0F; + maxX = maxZ = 0.9F; + maxY = 0.6F; + break; default: minX = minZ = 0.1F; diff --git a/src/minecraft/biomesoplenty/helpers/TeleporterPromised.java b/src/minecraft/biomesoplenty/helpers/TeleporterPromised.java index a321c9fe6..a879541ac 100644 --- a/src/minecraft/biomesoplenty/helpers/TeleporterPromised.java +++ b/src/minecraft/biomesoplenty/helpers/TeleporterPromised.java @@ -2,7 +2,6 @@ package biomesoplenty.helpers; import java.util.ArrayList; import java.util.List; -import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -18,7 +17,6 @@ import biomesoplenty.api.Blocks; public class TeleporterPromised extends Teleporter { private final WorldServer worldServerInstance; - private final Random random; private final LongHashMap field_85191_c = new LongHashMap(); @SuppressWarnings("rawtypes") private final List field_85190_d = new ArrayList(); @@ -29,7 +27,6 @@ public class TeleporterPromised extends Teleporter super(worldServer); this.falling = false; this.worldServerInstance = worldServer; - this.random = new Random(worldServer.getSeed()); } public TeleporterPromised(WorldServer worldServer, boolean fall) @@ -37,7 +34,6 @@ public class TeleporterPromised extends Teleporter super(worldServer); this.falling = fall; this.worldServerInstance = worldServer; - this.random = new Random(worldServer.getSeed()); } @Override @@ -247,165 +243,9 @@ public class TeleporterPromised extends Teleporter @Override public boolean makePortal(Entity par1Entity) { - byte b0 = 16; - double d0 = -1.0D; int i = MathHelper.floor_double(par1Entity.posX); int j = 130; int k = MathHelper.floor_double(par1Entity.posZ); - int l = i; - int i1 = j; - int j1 = k; - int k1 = 0; - int l1 = this.random.nextInt(4); - int i2; - double d1; - double d2; - int j2; - int k2; - int l2; - int i3; - int j3; - int k3; - int l3; - int i4; - int j4; - int k4; - double d3; - double d4; - - for (i2 = i - b0; i2 <= i + b0; ++i2) - { - d1 = (double)i2 + 0.5D - par1Entity.posX; - - for (j2 = k - b0; j2 <= k + b0; ++j2) - { - d2 = (double)j2 + 0.5D - par1Entity.posZ; - label274: - - for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2) - { - if (this.worldServerInstance.isAirBlock(i2, k2, j2)) - { - while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2)) - { - --k2; - } - - for (i3 = l1; i3 < l1 + 4; ++i3) - { - l2 = i3 % 2; - k3 = 1 - l2; - - if (i3 % 4 >= 2) - { - l2 = -l2; - k3 = -k3; - } - - for (j3 = 0; j3 < 3; ++j3) - { - for (i4 = 0; i4 < 4; ++i4) - { - for (l3 = -1; l3 < 4; ++l3) - { - k4 = i2 + (i4 - 1) * l2 + j3 * k3; - j4 = k2 + l3; - int l4 = j2 + (i4 - 1) * k3 - j3 * l2; - - if (l3 < 0 && !this.worldServerInstance.getBlockMaterial(k4, j4, l4).isSolid() || l3 >= 0 && !this.worldServerInstance.isAirBlock(k4, j4, l4)) - { - continue label274; - } - } - } - } - - d4 = (double)k2 + 0.5D - par1Entity.posY; - d3 = d1 * d1 + d4 * d4 + d2 * d2; - - if (d0 < 0.0D || d3 < d0) - { - d0 = d3; - l = i2; - i1 = k2; - j1 = j2; - k1 = i3 % 4; - } - } - } - } - } - } - - if (d0 < 0.0D) - { - for (i2 = i - b0; i2 <= i + b0; ++i2) - { - d1 = (double)i2 + 0.5D - par1Entity.posX; - - for (j2 = k - b0; j2 <= k + b0; ++j2) - { - d2 = (double)j2 + 0.5D - par1Entity.posZ; - label222: - - for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2) - { - if (this.worldServerInstance.isAirBlock(i2, k2, j2)) - { - while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2)) - { - --k2; - } - - for (i3 = l1; i3 < l1 + 2; ++i3) - { - l2 = i3 % 2; - k3 = 1 - l2; - - for (j3 = 0; j3 < 4; ++j3) - { - for (i4 = -1; i4 < 4; ++i4) - { - l3 = i2 + (j3 - 1) * l2; - k4 = k2 + i4; - j4 = j2 + (j3 - 1) * k3; - - if (i4 < 0 && !this.worldServerInstance.getBlockMaterial(l3, k4, j4).isSolid() || i4 >= 0 && !this.worldServerInstance.isAirBlock(l3, k4, j4)) - { - continue label222; - } - } - } - - d4 = (double)k2 + 0.5D - par1Entity.posY; - d3 = d1 * d1 + d4 * d4 + d2 * d2; - - if (d0 < 0.0D || d3 < d0) - { - d0 = d3; - l = i2; - i1 = k2; - j1 = j2; - k1 = i3 % 2; - } - } - } - } - } - } - } - - int i5 = l; - int j5 = i1; - j2 = j1; - int k5 = k1 % 2; - int l5 = 1 - k5; - - if (k1 % 4 >= 2) - { - k5 = -k5; - l5 = -l5; - } boolean flag; @@ -415,13 +255,13 @@ public class TeleporterPromised extends Teleporter for (int iz = -2; iz < 3; iz++) { flag = ix == -2 || ix == 2 || iz == -2 || iz == 2 || iy == -1 || iy == 3; - this.worldServerInstance.setBlock(i5 + ix, j5 + iy, j2 + iz, flag ? Block.whiteStone.blockID : 0); + this.worldServerInstance.setBlock(i + ix, j + iy, k + iz, flag ? Block.whiteStone.blockID : 0); } for (int ix = -2; ix < 3; ix++) for (int iz = -2; iz < 3; iz++) { - this.worldServerInstance.notifyBlocksOfNeighborChange(i5 + ix, j5 + iy, j2 + iz, this.worldServerInstance.getBlockId(i5 + ix, j5 + iy, j2 + iz)); + this.worldServerInstance.notifyBlocksOfNeighborChange(i + ix, j + iy, k + iz, this.worldServerInstance.getBlockId(i + ix, j + iy, k + iz)); } }