Make glass panes and iron fences connect to block sides based on solidity. This does change IBlockAccess, so anything with a custom IBlockAccess may need to implement the new method.
This commit is contained in:
parent
47b5e28c91
commit
ebd22c3abd
|
@ -0,0 +1,51 @@
|
|||
--- ../src_base/minecraft/net/minecraft/block/BlockPane.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockPane.java
|
||||
@@ -13,6 +13,7 @@
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class BlockPane extends Block
|
||||
{
|
||||
@@ -90,10 +91,10 @@
|
||||
*/
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
- boolean flag = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 - 1));
|
||||
- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 + 1));
|
||||
- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 - 1, par3, par4));
|
||||
- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 + 1, par3, par4));
|
||||
+ boolean flag = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.NORTH);
|
||||
+ boolean flag1 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.SOUTH);
|
||||
+ boolean flag2 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.WEST);
|
||||
+ boolean flag3 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.EAST);
|
||||
|
||||
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
|
||||
{
|
||||
@@ -151,10 +152,10 @@
|
||||
float f1 = 0.5625F;
|
||||
float f2 = 0.4375F;
|
||||
float f3 = 0.5625F;
|
||||
- boolean flag = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 - 1));
|
||||
- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 + 1));
|
||||
- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 - 1, par3, par4));
|
||||
- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 + 1, par3, par4));
|
||||
+ boolean flag = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.NORTH);
|
||||
+ boolean flag1 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.SOUTH);
|
||||
+ boolean flag2 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.WEST);
|
||||
+ boolean flag3 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.EAST);
|
||||
|
||||
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
|
||||
{
|
||||
@@ -240,4 +241,10 @@
|
||||
this.blockIcon = par1IconRegister.registerIcon(this.field_94402_c);
|
||||
this.theIcon = par1IconRegister.registerIcon(this.sideTextureIndex);
|
||||
}
|
||||
+
|
||||
+ // FORGE START
|
||||
+ public boolean canPaneConnectTo(IBlockAccess access, int x, int y, int z, ForgeDirection dir)
|
||||
+ {
|
||||
+ return canThisPaneConnectToThisBlockID(access.getBlockId(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ)) || access.isBlockSolidOnSide(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, dir.getOpposite(), false);
|
||||
+ }
|
||||
}
|
|
@ -91,3 +91,18 @@
|
|||
{
|
||||
d5 = (double)par2 + 0.5D + 0.5D;
|
||||
d6 = (double)par2 + 0.5D - 0.5D;
|
||||
@@ -3050,10 +3053,10 @@
|
||||
double d17 = (double)par2 + 0.5D + 0.0625D;
|
||||
double d18 = (double)par4 + 0.5D - 0.0625D;
|
||||
double d19 = (double)par4 + 0.5D + 0.0625D;
|
||||
- boolean flag = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 - 1));
|
||||
- boolean flag1 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 + 1));
|
||||
- boolean flag2 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 - 1, par3, par4));
|
||||
- boolean flag3 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 + 1, par3, par4));
|
||||
+ boolean flag = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, NORTH);
|
||||
+ boolean flag1 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, SOUTH);
|
||||
+ boolean flag2 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, WEST);
|
||||
+ boolean flag3 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, EAST);
|
||||
boolean flag4 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1);
|
||||
boolean flag5 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0);
|
||||
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
--- ../src_base/minecraft/net/minecraft/world/ChunkCache.java
|
||||
+++ ../src_work/minecraft/net/minecraft/world/ChunkCache.java
|
||||
@@ -108,7 +108,15 @@
|
||||
@@ -8,6 +8,7 @@
|
||||
import net.minecraft.util.Vec3Pool;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class ChunkCache implements IBlockAccess
|
||||
{
|
||||
@@ -108,7 +109,15 @@
|
||||
{
|
||||
int l = (par1 >> 4) - this.chunkX;
|
||||
int i1 = (par3 >> 4) - this.chunkZ;
|
||||
|
@ -17,7 +25,7 @@
|
|||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -159,7 +167,12 @@
|
||||
@@ -159,7 +168,12 @@
|
||||
{
|
||||
int l = (par1 >> 4) - this.chunkX;
|
||||
int i1 = (par3 >> 4) - this.chunkZ;
|
||||
|
@ -31,7 +39,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -306,8 +319,7 @@
|
||||
@@ -306,8 +320,7 @@
|
||||
*/
|
||||
public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3)
|
||||
{
|
||||
|
@ -41,3 +49,26 @@
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -449,4 +462,22 @@
|
||||
int i1 = this.getBlockId(par1, par2, par3);
|
||||
return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingStrongPower(this, par1, par2, par3, par4);
|
||||
}
|
||||
+
|
||||
+ public boolean isBlockSolidOnSide(int x, int y, int z, ForgeDirection side, boolean _default)
|
||||
+ {
|
||||
+ if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000)
|
||||
+ {
|
||||
+ return _default;
|
||||
+ }
|
||||
+
|
||||
+ int blockId = getBlockId(x, y, z);
|
||||
+ Block block = Block.blocksList[blockId];
|
||||
+
|
||||
+ if (block != null)
|
||||
+ {
|
||||
+ return block.isBlockSolidOnSide(this.worldObj, x, y, z, side);
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
--- ../src_base/minecraft/net/minecraft/world/IBlockAccess.java
|
||||
+++ ../src_work/minecraft/net/minecraft/world/IBlockAccess.java
|
||||
@@ -6,6 +6,7 @@
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3Pool;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IBlockAccess
|
||||
{
|
||||
@@ -103,4 +104,16 @@
|
||||
* Is this block powering in the specified direction Args: x, y, z, direction
|
||||
*/
|
||||
int isBlockProvidingPowerTo(int i, int j, int k, int l);
|
||||
+
|
||||
+ /**
|
||||
+ * FORGE: isBlockSolidOnSide, pulled up from {@link World}
|
||||
+ *
|
||||
+ * @param x X coord
|
||||
+ * @param y Y coord
|
||||
+ * @param z Z coord
|
||||
+ * @param side Side
|
||||
+ * @param _default default return value
|
||||
+ * @return if the block is solid on the side
|
||||
+ */
|
||||
+ boolean isBlockSolidOnSide(int x, int y, int z, ForgeDirection side, boolean _default);
|
||||
}
|
|
@ -812,7 +812,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -4321,4 +4491,114 @@
|
||||
@@ -4321,4 +4491,115 @@
|
||||
{
|
||||
return this.worldLogAgent;
|
||||
}
|
||||
|
@ -856,6 +856,7 @@
|
|||
+ * @param _default The defult to return if the block doesn't exist.
|
||||
+ * @return True if the side is solid
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isBlockSolidOnSide(int x, int y, int z, ForgeDirection side, boolean _default)
|
||||
+ {
|
||||
+ if (x < -30000000 || z < -30000000 || x >= 30000000 || z >= 30000000)
|
||||
|
|
Loading…
Reference in New Issue