Skip to content

Commit

Permalink
support for cactus, algae and coral rendering in TFC
Browse files Browse the repository at this point in the history
  • Loading branch information
octarine-noise committed Oct 22, 2015
1 parent a53e08a commit bcf7a52
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 6 deletions.
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.event.TextureStitchEvent;
Expand All @@ -36,7 +35,7 @@ public RenderBlockCactus() {
}

public boolean isBlockAccepted(IBlockAccess blockAccess, int x, int y, int z, Block block, int original) {
return Config.cactusEnabled && block == Blocks.cactus && getCameraDistance(x, y, z) <= Config.cactusDistance;
return Config.cactusEnabled && Config.cactus.matchesID(block) && getCameraDistance(x, y, z) <= Config.cactusDistance;
}

public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
Expand Down
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.util.ForgeDirection;
Expand All @@ -28,7 +27,7 @@ public RenderBlockLilypad() {
}

public boolean isBlockAccepted(IBlockAccess blockAccess, int x, int y, int z, Block block, int original) {
return Config.lilypadEnabled && block == Blocks.waterlily && getCameraDistance(x, y, z) <= Config.lilypadDistance;
return Config.lilypadEnabled && Config.lilypad.matchesID(block) && getCameraDistance(x, y, z) <= Config.lilypadDistance;
}

public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
Expand Down
Expand Up @@ -13,7 +13,6 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
Expand All @@ -31,7 +30,7 @@ public class RenderBlockSandWithCoral extends RenderBlockAOBase implements IRend

public boolean isBlockAccepted(IBlockAccess blockAccess, int x, int y, int z, Block block, int original) {
if (!Config.coralEnabled) return false;
if (block != Blocks.sand) return false;
if (!Config.sand.matchesID(block)) return false;
if (getCameraDistance(x, y, z) > Config.coralDistance) return false;
if (!Config.coralBiomeList.contains(blockAccess.getBiomeGenForCoords(x, z).biomeID)) return false;
int terrainVariation = MathHelper.floor_double((noise.func_151605_a(x * 0.1, z * 0.1) + 1.0) * 32.0);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/mods/betterfoliage/common/config/Config.java
Expand Up @@ -38,6 +38,9 @@ public enum Category {
public static BlockMatcher dirt = new BlockMatcher();
public static BlockMatcher grass = new BlockMatcher();
public static BlockMatcher logs = new BlockMatcher();
public static BlockMatcher sand = new BlockMatcher();
public static BlockMatcher lilypad = new BlockMatcher();
public static BlockMatcher cactus = new BlockMatcher();

// extracted config values
public static boolean globalEnabled;
Expand Down Expand Up @@ -269,6 +272,9 @@ public static void updateValues() {
updateBlockMatcher(leaves, Category.blockTypes, "leavesWhitelist", "betterfoliage.blockTypes.leavesWhitelist", "leavesBlacklist", "betterfoliage.blockTypes.leavesBlacklist", new ResourceLocation("betterfoliage:classesLeavesDefault.cfg"));
updateBlockMatcher(crops, Category.blockTypes, "cropWhitelist", "betterfoliage.blockTypes.cropWhitelist", "cropBlacklist", "betterfoliage.blockTypes.cropBlacklist", new ResourceLocation("betterfoliage:classesCropDefault.cfg"));
updateBlockMatcher(logs, Category.blockTypes, "logWhitelist", "betterfoliage.blockTypes.logWhitelist", "logBlacklist", "betterfoliage.blockTypes.logBlacklist", new ResourceLocation("betterfoliage:classesLogDefault.cfg"));
updateBlockMatcher(sand, Category.blockTypes, "sandWhitelist", "betterfoliage.blockTypes.sandWhitelist", "sandBlacklist", "betterfoliage.blockTypes.sandBlacklist", new ResourceLocation("betterfoliage:classesSandDefault.cfg"));
updateBlockMatcher(lilypad, Category.blockTypes, "lilypadWhitelist", "betterfoliage.blockTypes.lilypadWhitelist", "lilypadBlacklist", "betterfoliage.blockTypes.lilypadBlacklist", new ResourceLocation("betterfoliage:classesLilypadDefault.cfg"));
updateBlockMatcher(cactus, Category.blockTypes, "cactusWhitelist", "betterfoliage.blockTypes.cactusWhitelist", "cactusBlacklist", "betterfoliage.blockTypes.cactusBlacklist", new ResourceLocation("betterfoliage:classesCactusDefault.cfg"));

rawConfig.getCategory(Category.extraLeaves.toString()).get("skewMode").setConfigEntryClass(AlternateTextBooleanEntry.class);
rawConfig.getCategory(Category.extraLeaves.toString()).get("dense").setConfigEntryClass(AlternateTextBooleanEntry.class);
Expand Down
@@ -0,0 +1,5 @@
// Vanilla
net.minecraft.block.BlockCactus

// TerraFirmaCraft
com.bioxx.tfc.Blocks.Vanilla.BlockCustomCactus
@@ -0,0 +1,5 @@
// Vanilla
net.minecraft.block.BlockLilyPad

// TerraFirmaCraft
com.bioxx.tfc.Blocks.Vanilla.BlockCustomLilyPad
@@ -0,0 +1,5 @@
// Vanilla
net.minecraft.block.BlockSand

// TerraFirmaCraft
com.bioxx.tfc.Blocks.Terrain.BlockSand
13 changes: 13 additions & 0 deletions src/main/resources/assets/betterfoliage/lang/en_US.lang
Expand Up @@ -35,6 +35,13 @@ betterfoliage.blockTypes.cropWhitelist=Crop Whitelist
betterfoliage.blockTypes.cropBlacklist=Crop Blacklist
betterfoliage.blockTypes.logWhitelist=Wood Log Whitelist
betterfoliage.blockTypes.logBlacklist=Wood Log Blacklist
betterfoliage.blockTypes.sandWhitelist=Sand Whitelist
betterfoliage.blockTypes.sandBlacklist=Sand Blacklist
betterfoliage.blockTypes.lilypadWhitelist=Lilypad Whitelist
betterfoliage.blockTypes.lilypadBlacklist=Lilypad Blacklist
betterfoliage.blockTypes.cactusWhitelist=Cactus Whitelist
betterfoliage.blockTypes.cactusBlacklist=Cactus Blacklist


betterfoliage.blockTypes.dirtWhitelist.tooltip=Blocks recognized as Dirt. Has an impact on Reeds, Algae, Connected Grass
betterfoliage.blockTypes.dirtBlacklist.tooltip=Blocks never accepted as Dirt. Has an impact on Reeds, Algae, Connected Grass
Expand All @@ -46,6 +53,12 @@ betterfoliage.blockTypes.cropWhitelist.tooltip=Blocks recognized as crops. Crops
betterfoliage.blockTypes.cropBlacklist.tooltip=Blocks never accepted as crops. Crops will render with tallgrass block ID in shader programs
betterfoliage.blockTypes.logWhitelist.tooltip=Blocks recognized as wooden logs. Has an impact on Rounded Logs
betterfoliage.blockTypes.logBlacklist.tooltip=Blocks never accepted as wooden logs. Has an impact on Rounded Logs
betterfoliage.blockTypes.sandWhitelist.tooltip=Blocks recognized as Sand. Has an impact on Coral
betterfoliage.blockTypes.sandBlacklist.tooltip=Blocks never accepted Sand. Has an impact on Coral
betterfoliage.blockTypes.lilypadWhitelist.tooltip=Blocks recognized as Lilypad. Has an impact on Better Lilypad
betterfoliage.blockTypes.lilypadBlacklist.tooltip=Blocks never accepted Lilypad. Has an impact on Better Lilypad
betterfoliage.blockTypes.cactusWhitelist.tooltip=Blocks recognized as Cactus. Has an impact on Better Cactus
betterfoliage.blockTypes.cactusBlacklist.tooltip=Blocks never accepted Cactus. Has an impact on Better Cactus

betterfoliage.extraLeaves=Extra Leaves
betterfoliage.extraLeaves.tooltip=Extra round leaves on leaf blocks
Expand Down

0 comments on commit bcf7a52

Please sign in to comment.