mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
terrible hacks, part 2
This commit is contained in:
parent
108b581df2
commit
152de687f2
@ -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;
|
||||
@ -2810,8 +2811,8 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(deco_pipe_quad_green_rusted, ItemBlockBase.class, deco_pipe_quad_green_rusted.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_pipe_quad_red, ItemBlockBase.class, deco_pipe_quad_red.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_pipe_quad_marked, ItemBlockBase.class, deco_pipe_quad_marked.getUnlocalizedName());
|
||||
register(plant_flower);
|
||||
register(plant_tall);
|
||||
GameRegistry.registerBlock(plant_flower, ItemBlockBaseColored.class, plant_flower.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(plant_tall, ItemBlockBaseColored.class, plant_tall.getUnlocalizedName());
|
||||
register(plant_dead);
|
||||
register(reeds);
|
||||
register(vine_phosphor);
|
||||
|
||||
@ -202,27 +202,19 @@ 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 getBlockColor()
|
||||
{
|
||||
double d0 = 0.5D;
|
||||
double d1 = 1.0D;
|
||||
return ColorizerGrass.getGrassColor(d0, d1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the color this block should be rendered. Used by leaves.
|
||||
*/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta)
|
||||
{
|
||||
return meta == 0 ? 16777215 : ColorizerGrass.getGrassColor(0.5F, 1F);
|
||||
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
|
||||
|
||||
/**
|
||||
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
|
||||
* when first determining what to render.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
@ -241,8 +233,11 @@ public class BlockNTMFlower extends BlockEnumMulti implements IPlantable, IGrowa
|
||||
}
|
||||
}
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return meta == 0 ? 16777215 : ((l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255);
|
||||
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) { }
|
||||
|
||||
@ -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) {
|
||||
|
||||
23
src/main/java/com/hbm/items/block/ItemBlockBaseColored.java
Normal file
23
src/main/java/com/hbm/items/block/ItemBlockBaseColored.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.hbm.items.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockBaseColored extends ItemBlockBase {
|
||||
|
||||
private Block block;
|
||||
|
||||
public ItemBlockBaseColored(Block block) {
|
||||
super(block);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int p_82790_2_)
|
||||
{
|
||||
return this.block.getRenderColor(stack.getItemDamage());
|
||||
}
|
||||
|
||||
}
|
||||
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 |
Loading…
x
Reference in New Issue
Block a user