add hanging vines below netherrack

This commit is contained in:
octarine-noise
2014-08-26 21:21:10 +02:00
parent 85b4880391
commit 4bba2b06c2
4 changed files with 84 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import mods.betterfoliage.client.render.impl.RenderBlockBetterGrass;
import mods.betterfoliage.client.render.impl.RenderBlockBetterLeaves;
import mods.betterfoliage.client.render.impl.RenderBlockBetterLilypad;
import mods.betterfoliage.client.render.impl.RenderBlockBetterMycelium;
import mods.betterfoliage.client.render.impl.RenderBlockBetterNetherrack;
import mods.betterfoliage.client.render.impl.RenderBlockBetterReed;
import mods.betterfoliage.client.render.impl.RenderBlocksBetterGrassSide;
import mods.betterfoliage.client.resource.LeafGenerator;
@@ -48,6 +49,7 @@ public class BetterFoliageClient {
BetterFoliage.log.info("Registering renderers");
registerRenderer(new RenderBlockBetterCactus());
registerRenderer(new RenderBlockBetterNetherrack());
registerRenderer(new RenderBlockBetterLilypad());
registerRenderer(new RenderBlockBetterMycelium());
registerRenderer(new RenderBlockBetterLeaves());

View File

@@ -0,0 +1,64 @@
package mods.betterfoliage.client.render.impl;
import mods.betterfoliage.BetterFoliage;
import mods.betterfoliage.client.ShadersModIntegration;
import mods.betterfoliage.client.render.IRenderBlockDecorator;
import mods.betterfoliage.client.render.IconSet;
import mods.betterfoliage.client.render.RenderBlockAOBase;
import mods.betterfoliage.common.config.Config;
import mods.betterfoliage.common.util.Double3;
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.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderBlockBetterNetherrack extends RenderBlockAOBase implements IRenderBlockDecorator {
public IconSet netherrackVineIcons = new IconSet("bettergrassandleaves", "better_netherrack_%d");
public boolean isBlockAccepted(IBlockAccess blockAccess, int x, int y, int z, Block block, int original) {
if (!Config.netherrackEnabled) return false;
if (block != Blocks.netherrack) return false;
if (!blockAccess.isAirBlock(x, y - 1, z)) return false;
return true;
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
blockAccess = world;
renderWorldBlockBase(1, world, x, y, z, block, modelId, renderer);
int iconVariation = getSemiRandomFromPos(x, y, z, 0);
IIcon renderIcon = netherrackVineIcons.get(iconVariation);
if (renderIcon == null) return true;
int heightVariation = getSemiRandomFromPos(x, y, z, 1);
double scale = Config.netherrackSize * 0.5;
double halfHeight = 0.5 * (Config.netherrackHeightMin + pRand[heightVariation] * (Config.netherrackHeightMax - Config.netherrackHeightMin));
// render netherrack vines
ShadersModIntegration.startGrassQuads();
Tessellator.instance.setBrightness(getBrightness(block, x, y - 1, z));
Tessellator.instance.setColorOpaque_I(block.colorMultiplier(blockAccess, x, y, z));
renderCrossedSideQuads(new Double3(x + 0.5, y, z + 0.5), ForgeDirection.DOWN, scale, halfHeight, pRot[iconVariation], Config.netherrackHOffset, renderIcon, 2, false);
return true;
}
@SubscribeEvent
public void handleTextureReload(TextureStitchEvent.Pre event) {
if (event.map.getTextureType() != 0) return;
netherrackVineIcons.registerIcons(event.map);
BetterFoliage.log.info(String.format("Found %d netherrack vine textures", netherrackVineIcons.numLoaded));
}
}

View File

@@ -26,7 +26,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class Config {
public enum Category {
blockTypes, extraLeaves, shortGrass, cactus, lilypad, reed, algae, coral, fallingLeaves, connectedGrass;
blockTypes, extraLeaves, shortGrass, cactus, lilypad, reed, algae, coral, netherrack, fallingLeaves, connectedGrass;
}
/** {@link Configuration} object bound to the config file */
@@ -88,6 +88,12 @@ public class Config {
public static double leafFXPerturb;
public static double leafFXLifetime;
public static boolean netherrackEnabled;
public static double netherrackHOffset;
public static double netherrackHeightMin;
public static double netherrackHeightMax;
public static double netherrackSize;
public static boolean ctxGrassClassicEnabled;
public static boolean ctxGrassAggressiveEnabled;
@@ -161,6 +167,13 @@ public class Config {
leafFXPerturb = getDouble(Category.fallingLeaves, "perturb", 0.25, 0.01, 1.0, "betterfoliage.fallingLeaves.perturb");
leafFXLifetime = getDouble(Category.fallingLeaves, "lifetime", 5.0, 1.0, 15.0, "betterfoliage.fallingLeaves.lifetime");
netherrackEnabled = getBoolean(Category.netherrack, "enabled", true, "betterfoliage.enabled");
netherrackHOffset = getDouble(Category.netherrack, "hOffset", 0.2, 0.0, 0.4, "betterfoliage.hOffset");
netherrackHeightMin = getDouble(Category.netherrack, "heightMin", 0.6, 0.1, 1.5, "betterfoliage.minHeight");
netherrackHeightMax = getDouble(Category.netherrack, "heightMax", 0.8, 0.1, 1.5, "betterfoliage.maxHeight");
netherrackSize = getDouble(Category.netherrack, "size", 1.0, 0.5, 1.5, "betterfoliage.size");
netherrackHeightMin = clampDoubleToMax(Category.netherrack, "heightMin", "heightMax");
ctxGrassClassicEnabled = getBoolean(Category.connectedGrass, "classic", true, "betterfoliage.connectedGrass.classic");
ctxGrassAggressiveEnabled= getBoolean(Category.connectedGrass, "aggressive", true, "betterfoliage.connectedGrass.aggressive");
@@ -182,6 +195,7 @@ public class Config {
setOrder(Category.reed, "enabled", "hOffset", "heightMin", "heightMax", "population", "biomeList");
setOrder(Category.algae, "enabled", "hOffset", "heightMin", "heightMax", "population");
setOrder(Category.coral, "enabled", "hOffset", "vOffset", "size", "crustSize", "population", "chance");
setOrder(Category.netherrack, "enabled", "hOffset", "heightMin", "heightMax", "size");
setOrder(Category.fallingLeaves, "enabled", "size", "chance", "lifetime", "speed", "windStrength", "stormStrength", "perturb");
setOrder(Category.connectedGrass, "classic", "aggressive");
}

View File

@@ -80,6 +80,9 @@ betterfoliage.coral.biomeList=Biome List
betterfoliage.coral.biomeList.tooltip=Configure which biomes coral is allowed to appear in
betterfoliage.coral.biomeSelectTooltip=Should coral appear in the %s biome?
betterfoliage.netherrack=Netherrack Vines
betterfoliage.netherrack.tooltip=Hanging Vines under netherrack
betterfoliage.fallingLeaves=Falling leaves
betterfoliage.fallingLeaves.tooltip=Falling leaf particle FX emitted from the bottom of leaf blocks
betterfoliage.fallingLeaves.speed=Particle speed