mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 11:19:28 +00:00
Fix some missing overlay colors and greenhouse color multiplier
This commit is contained in:
1 parent
686e2799ad
commit
62ddd7bafc
3 files changed
+40
-31
No files matched your search
@@ -13,6 +13,7 @@ package forestry.core.items;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -36,7 +37,7 @@ import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public class ItemLiquidContainer extends ItemForestry {
|
||||
public class ItemLiquidContainer extends ItemForestry implements IItemColor {
|
||||
private final EnumContainerType type;
|
||||
private final int color;
|
||||
|
||||
@@ -139,15 +140,14 @@ public class ItemLiquidContainer extends ItemForestry {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: liquid container coloring
|
||||
// @Override
|
||||
// public int getColorFromItemstack(ItemStack itemstack, int j) {
|
||||
// if (j > 0) {
|
||||
// return color;
|
||||
// } else {
|
||||
// return 0xffffff;
|
||||
// }
|
||||
// }
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack itemstack, int j) {
|
||||
if (j > 0) {
|
||||
return color;
|
||||
} else {
|
||||
return 0xffffff;
|
||||
}
|
||||
}
|
||||
|
||||
public EnumContainerType getType() {
|
||||
return type;
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.core.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,7 +23,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.config.Config;
|
||||
|
||||
public class ItemOverlay extends ItemForestry {
|
||||
public class ItemOverlay extends ItemForestry implements IItemColor {
|
||||
|
||||
public interface IOverlayInfo {
|
||||
String getUid();
|
||||
|
||||
@@ -80,9 +82,15 @@ public class ItemOverlay extends ItemForestry {
|
||||
return super.getUnlocalizedName(stack) + "." + overlays[stack.getItemDamage()].getUid();
|
||||
}
|
||||
|
||||
public int getColorFromItemStack(ItemStack itemstack, int j) {
|
||||
IOverlayInfo overlayInfo = overlays[itemstack.getItemDamage()];
|
||||
if (j == 0 || overlayInfo.getSecondaryColor() == 0) {
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
int meta = stack.getMetadata();
|
||||
if (meta < 0 || meta >= overlays.length) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
IOverlayInfo overlayInfo = overlays[meta];
|
||||
if (tintIndex == 0 || overlayInfo.getSecondaryColor() == 0) {
|
||||
return overlayInfo.getPrimaryColor();
|
||||
} else {
|
||||
return overlayInfo.getSecondaryColor();
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -67,7 +68,7 @@ import forestry.greenhouse.tiles.TileGreenhouseSprinkler;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseValve;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
public abstract class BlockGreenhouse extends BlockStructure implements ISpriteRegister {
|
||||
public abstract class BlockGreenhouse extends BlockStructure implements ISpriteRegister, IBlockColor {
|
||||
private static final AxisAlignedBB SPRINKLER_BOUNDS = new AxisAlignedBB(0.3125F, 0.25F, 0.3125F, 0.6875F, 1F, 0.6875F);
|
||||
public static final PropertyEnum<State> STATE = PropertyEnum.create("state", State.class);
|
||||
|
||||
@@ -211,22 +212,22 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: greenhouse color
|
||||
// @Override
|
||||
// public int colorMultiplier(IBlockAccess world, BlockPos pos, int renderPass) {
|
||||
// TileEntity tile = world.getTileEntity(pos);
|
||||
// if (tile instanceof ICamouflagedBlock) {
|
||||
// ItemStack camouflageStack = CamouflageUtil.getCamouflageBlock(world, pos);
|
||||
//
|
||||
// if (renderPass < 100 && camouflageStack != null) {
|
||||
// return Block.getBlockFromItem(camouflageStack.getItem()).colorMultiplier(world, pos, renderPass);
|
||||
// }
|
||||
//
|
||||
// return super.colorMultiplier(world, pos, renderPass);
|
||||
// } else {
|
||||
// return super.colorMultiplier(world, pos, renderPass);
|
||||
// }
|
||||
// }
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
/* MODELS */
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user