add connected grass
This commit is contained in:
@@ -29,6 +29,12 @@ public class BetterFoliageConfig extends ConfigBase {
|
||||
@CfgElement(category="coral", key="enabled")
|
||||
public boolean coralEnabled = true;
|
||||
|
||||
@CfgElement(category="connectedGrass", key="classic")
|
||||
public boolean ctxGrassClassicEnabled = true;
|
||||
|
||||
@CfgElement(category="connectedGrass", key="aggressive")
|
||||
public boolean ctxGrassAggressiveEnabled = true;
|
||||
|
||||
@CfgElement(category="fallingLeaves", key="enabled")
|
||||
public boolean fallingLeavesEnabled = true;
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package mods.betterfoliage.common.util;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3Pool;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/** {@link IBlockAccess} wrapper that applies an offset for a single target coordinate for all rendering-related methods.
|
||||
* Returns normal values for all other coordinates.
|
||||
* @author octarine-noise
|
||||
*
|
||||
*/
|
||||
public class OffsetBlockAccess implements IBlockAccess {
|
||||
|
||||
public IBlockAccess source;
|
||||
public int xTarget, yTarget, zTarget;
|
||||
public int xOffset, yOffset, zOffset;
|
||||
|
||||
public OffsetBlockAccess(IBlockAccess source, int x, int y, int z, int xOffset, int yOffset, int zOffset) {
|
||||
this.source = source;
|
||||
this.xTarget = x;
|
||||
this.yTarget = y;
|
||||
this.zTarget = z;
|
||||
this.xOffset = xOffset;
|
||||
this.yOffset = yOffset;
|
||||
this.zOffset = zOffset;
|
||||
}
|
||||
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
if (x == xTarget && y == yTarget && z == zTarget)
|
||||
return source.getBlock(x + xOffset, y + yOffset, z + zOffset);
|
||||
else
|
||||
return source.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity(int x, int y, int z) {
|
||||
if (x == xTarget && y == yTarget && z == zTarget)
|
||||
return source.getTileEntity(x + xOffset, y + yOffset, z + zOffset);
|
||||
else
|
||||
return source.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int min) {
|
||||
if (x == xTarget && y == yTarget && z == zTarget)
|
||||
return source.getLightBrightnessForSkyBlocks(x + xOffset, y + yOffset, z + zOffset, min);
|
||||
else
|
||||
return source.getLightBrightnessForSkyBlocks(x, y, z, min);
|
||||
}
|
||||
|
||||
public int getBlockMetadata(int x, int y, int z) {
|
||||
if (x == xTarget && y == yTarget && z == zTarget)
|
||||
return source.getBlockMetadata(x + xOffset, y + yOffset, z + zOffset);
|
||||
else
|
||||
return source.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
public boolean isAirBlock(int x, int y, int z) {
|
||||
if (x == xTarget && y == yTarget && z == zTarget)
|
||||
return source.isAirBlock(x + xOffset, y + yOffset, z + zOffset);
|
||||
else
|
||||
return source.isAirBlock(x, y, z);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BiomeGenBase getBiomeGenForCoords(int x, int z) {
|
||||
return source.getBiomeGenForCoords(x, z);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getHeight() {
|
||||
return source.getHeight();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean extendedLevelsInChunkCache() {
|
||||
return source.extendedLevelsInChunkCache();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Vec3Pool getWorldVec3Pool() {
|
||||
return source.getWorldVec3Pool();
|
||||
}
|
||||
|
||||
public int isBlockProvidingPowerTo(int x, int y, int z, int dir) {
|
||||
return source.isBlockProvidingPowerTo(x, y, z, dir);
|
||||
}
|
||||
|
||||
public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) {
|
||||
if (x == xTarget && y == yTarget && z == zTarget)
|
||||
return source.isSideSolid(x + xOffset, y + yOffset, z + zOffset, side, _default);
|
||||
else
|
||||
return source.isSideSolid(x, y, z, side, _default);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user