mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 04:22:32 +00:00
1 parent
92d8b020db
commit
4c83209eae
2 files changed
+19
-4
No files matched your search
@@ -12,6 +12,7 @@ import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.farming.blocks.BlockFarm;
|
||||
import forestry.farming.blocks.EnumFarmBlockType;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
@@ -39,9 +40,15 @@ public class ModelFarmBlock extends ModelBlockDefault<BlockFarm> {
|
||||
@Override
|
||||
public void bakeWorldBlock(@Nonnull BlockFarm blockFarm, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IExtendedBlockState stateExtended, @Nonnull IModelBaker baker) {
|
||||
|
||||
TileFarm farm = (TileFarm) world.getTileEntity(pos);
|
||||
TileFarm farm = TileUtil.getTile(world, pos, TileFarm.class);
|
||||
|
||||
TextureAtlasSprite[] textures = getSprites(farm.getFarmBlockTexture());
|
||||
EnumFarmBlockTexture texture = EnumFarmBlockTexture.BRICK;
|
||||
|
||||
if(farm != null){
|
||||
texture = farm.getFarmBlockTexture();
|
||||
}
|
||||
|
||||
TextureAtlasSprite[] textures = getSprites(texture);
|
||||
|
||||
// Add the plain block.
|
||||
baker.addBlockModel(blockFarm, Block.FULL_BLOCK_AABB, pos, textures, 0);
|
||||
|
||||
@@ -22,7 +22,9 @@ import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -215,14 +217,20 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
|
||||
if(pos == null){
|
||||
return 0xffffff;
|
||||
}
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof ICamouflagedTile) {
|
||||
ItemStack camouflageStack = CamouflageUtil.getCamouflageBlock(worldIn, pos);
|
||||
|
||||
if (tintIndex < 100 && camouflageStack != null) {
|
||||
Block block = Block.getBlockFromItem(camouflageStack.getItem());
|
||||
if (block instanceof IBlockColor) {
|
||||
return ((IBlockColor) block).colorMultiplier(state, worldIn, pos, tintIndex);
|
||||
IBlockState camouflageState = block.getStateFromMeta(camouflageStack.getItemDamage());
|
||||
|
||||
int color = Minecraft.getMinecraft().getBlockColors().colorMultiplier(camouflageState, worldIn, pos, tintIndex);
|
||||
if(color != -1){
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user