Merge pull request #2120 from 7pheonix/master

Tinted Vegetation
This commit is contained in:
HbmMods 2025-05-01 11:42:30 +02:00 committed by GitHub
commit 13b862d14e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 91 additions and 1 deletions

View File

@ -11,6 +11,7 @@
* Flamethrower turrets and chemthrower now use the green fire effect when using balefire fuel
* Flamethrower turret projectile damage is now capped to 20
* Balefire fuel should no longer instantly vaporize bosses
* Tobacco and Hemp plants are now biome tinted and are no longer radioactive green
* Most chemthrower ammo types with variable damage output are now capped to 15 damage per shot (that is still a ton)
* Chemthrower combustible liquids now use SEDNA type fire particles
* Halved recoil on the zebra rifle

View File

@ -30,6 +30,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemColored;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;

View File

@ -9,6 +9,8 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockDeadPlant.EnumDeadPlantType;
import com.hbm.blocks.generic.BlockTallPlant.EnumTallFlower;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
@ -16,6 +18,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
@ -98,7 +101,7 @@ public class BlockNTMFlower extends BlockEnumMulti implements IPlantable, IGrowa
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
return 1;
@ -198,6 +201,43 @@ public class BlockNTMFlower extends BlockEnumMulti implements IPlantable, IGrowa
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
}
@SideOnly(Side.CLIENT)
public int getRenderColor(int meta)
{
if (meta == 1 || meta == 3) {
return ColorizerGrass.getGrassColor(0.5D, 1.0D);
} else return 0xFFFFFF;
}
// if you need to make another tinted plant just throw the metadata value
// into the if statements above and below i really do not want to make this more
// complicated than it needs to be
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
{
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = -1; k1 <= 1; ++k1)
{
for (int l1 = -1; l1 <= 1; ++l1)
{
int i2 = world.getBiomeGenForCoords(x + l1, z + k1).getBiomeFoliageColor(x + l1, y, z + k1);
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
}
}
int meta = world.getBlockMetadata(x, y, z);
if (meta == 1 || meta == 3) {
return ((l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255);
} else return 0xFFFFFF;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { }

View File

@ -24,6 +24,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
@ -300,6 +301,43 @@ public class BlockTallPlant extends BlockEnumMulti implements IPlantable, IGrowa
return world.getBlockMetadata(x, y, z);
}
@SideOnly(Side.CLIENT)
public int getRenderColor(int meta)
{
if (meta == 0 || meta == 8) {
return ColorizerGrass.getGrassColor(0.5D, 1.0D);
} else return 0xFFFFFF;
}
// if you need to make another tinted plant just throw the metadata value
// into the if statements above and below i really do not want to make this more
// complicated than it needs to be
// the second meta value is for the top of the plant
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
{
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = -1; k1 <= 1; ++k1)
{
for (int l1 = -1; l1 <= 1; ++l1)
{
int i2 = world.getBiomeGenForCoords(x + l1, z + k1).getBiomeFoliageColor(x + l1, y, z + k1);
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
}
}
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0 || meta == 8) {
return ((l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255);
} else return 0xFFFFFF;
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {

View File

@ -102,4 +102,5 @@ public class ItemEnumMulti extends Item {
return super.getUnlocalizedName(stack);
}
}
}

View File

@ -20,9 +20,12 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
public class ItemBlockBase extends ItemBlock {
private Block block;
public ItemBlockBase(Block block) {
super(block);
this.block = block;
if(block instanceof IBlockMulti) {
this.setMaxDamage(0);
@ -88,4 +91,10 @@ public class ItemBlockBase extends ItemBlock {
return EnumRarity.common;
}
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
return this.block.getRenderColor(stack.getItemDamage());
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 267 B