mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-25 14:34:33 +00:00
Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2
This commit is contained in:
commit
62a4efaa53
33 files changed
+582
-588
No files matched your search
@@ -3,14 +3,30 @@ package binnie.botany.api;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumSoilType implements IStringSerializable {
|
||||
SOIL,
|
||||
LOAM,
|
||||
FLOWERBED;
|
||||
SOIL(TextFormatting.DARK_GRAY),
|
||||
LOAM(TextFormatting.GOLD),
|
||||
FLOWERBED(TextFormatting.LIGHT_PURPLE);
|
||||
|
||||
final TextFormatting color;
|
||||
|
||||
EnumSoilType() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
EnumSoilType(TextFormatting color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public String getTranslated(boolean withColor){
|
||||
return (withColor && color != null ? color : "") + I18n.translateToLocal("botany.soil." + getName());
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,5 @@ public interface IFlowerColour {
|
||||
|
||||
int getID();
|
||||
|
||||
String getName();
|
||||
String getColourName();
|
||||
}
|
||||
@@ -2,21 +2,36 @@ package binnie.botany.ceramic;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
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.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCeramic extends Block implements IBlockMetadata {
|
||||
public class BlockCeramic extends Block implements IBlockMetadata, IColoredBlock, IColoredItem, IItemModelRegister {
|
||||
public static final PropertyEnum<EnumFlowerColor> COLOUR = PropertyEnum.create("color", EnumFlowerColor.class);
|
||||
public BlockCeramic() {
|
||||
super(Material.ROCK);
|
||||
this.setHardness(1.0f);
|
||||
@@ -24,33 +39,56 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
||||
this.setRegistryName("ceramic");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
manager.registerItemModel(item, c.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Adding Meta
|
||||
/*@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, COLOUR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(COLOUR).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(COLOUR, EnumFlowerColor.values()[meta]);
|
||||
}*/
|
||||
|
||||
// @Override
|
||||
// public ArrayList<ItemStack> getDrops(final World world, final BlockPos pos, final int blockMeta, final int fortune) {
|
||||
// return BlockMetadata.getBlockDropped(this, world, pos, blockMeta);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
// }
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean hasTileEntity(final int meta) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
// super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
// final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
// return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
// }
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) {
|
||||
super.eventReceived(state, worldIn, pos, id, param);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity == null ? false : tileentity.receiveClientEvent(id, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, BlockPos pos, final EnumFacing clickedBlock) {
|
||||
@@ -73,63 +111,32 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final BlockPos pos, final ItemStack drop) {
|
||||
//TODO IMPLEMENT
|
||||
// this.dropBlockAsItem(world, pos, drop);
|
||||
public void dropAsStack(final World world, final BlockPos pos, final ItemStack itemStack) {
|
||||
spawnAsEntity(world, pos, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item itemIn, final CreativeTabs par2CreativeTabs, final List<ItemStack> itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getIcon(side, tile.getTileMetadata());
|
||||
// }
|
||||
// return super.getIcon(world, x, y, z, side);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getIcon(final int side, final int meta) {
|
||||
// return this.blockIcon;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(final IIconRegister register) {
|
||||
// this.blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getRenderColor(tile.getTileMetadata());
|
||||
// }
|
||||
// return 16777215;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
// super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
// par1World.removeTileEntity(par2, par3, par4);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getRenderColor(final int meta) {
|
||||
// return EnumFlowerColor.get(meta).getColor(false);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, pos);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
return EnumFlowerColor.get(stack.getMetadata()).getColor(false);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
|
||||
return EnumFlowerColor.get(getMetaFromState(state)).getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,40 @@
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.botany.ceramic.BlockCeramicBrick.BlockType;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import forestry.api.core.ISpriteRegister;
|
||||
import forestry.api.core.ITextureManager;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.render.TextureManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock {
|
||||
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock<BlockType>, IColoredBlock, ISpriteRegister {
|
||||
public BlockCeramicBrick() {
|
||||
super(Material.ROCK);
|
||||
this.setHardness(1.0f);
|
||||
@@ -31,34 +46,34 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
private static BlockType getType(final int meta) {
|
||||
return new BlockType(meta);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
// return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean hasTileEntity(final int meta) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
// super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
// final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
// return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) {
|
||||
super.eventReceived(state, worldIn, pos, id, param);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity == null ? false : tileentity.receiveClientEvent(id, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
@@ -80,9 +95,8 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final BlockPos pos, final ItemStack drop) {
|
||||
//TODO IMPLEMENT
|
||||
//this.dropBlockAsItem(world, pos, drop);
|
||||
public void dropAsStack(World world, BlockPos pos, ItemStack itemStack) {
|
||||
spawnAsEntity(world, pos, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,56 +139,24 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getRenderColor(tile.getTileMetadata());
|
||||
// }
|
||||
// return 16777215;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
// super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
// par1World.removeTileEntity(par2, par3, par4);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getRenderColor(final int meta) {
|
||||
// return this.colorMultiplier(meta);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public int getNumberOfPasses() {
|
||||
return 3;
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, pos);
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(final int meta) {
|
||||
final BlockType type = getType(meta);
|
||||
// if (MultipassBlockRenderer.getLayer() == 0) {
|
||||
// return 16777215;
|
||||
// }
|
||||
// if (MultipassBlockRenderer.getLayer() == 1) {
|
||||
// return type.color1.getColor(false);
|
||||
// }
|
||||
return type.color2.getColor(false);
|
||||
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
|
||||
BlockType type = getType(getMetaFromState(state));
|
||||
if(tintIndex == 0){
|
||||
return 16777215;
|
||||
}if(tintIndex == 1){
|
||||
return type.color1.getColor(false);
|
||||
}
|
||||
return type.color2.getColor(false);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int getRenderType() {
|
||||
// return BinnieCore.multipassRenderID;
|
||||
// }
|
||||
|
||||
public enum TileType {
|
||||
Tile("tile", "Ceramic Tile"),
|
||||
Brick("brick", "Ceramic Bricks"),
|
||||
@@ -189,10 +171,10 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
|
||||
String id;
|
||||
String name;
|
||||
//IIcon[] icons;
|
||||
TextureAtlasSprite[] sprites;
|
||||
|
||||
TileType(final String id, final String name) {
|
||||
//this.icons = new IIcon[3];
|
||||
this.sprites = new TextureAtlasSprite[3];
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
@@ -205,7 +187,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
return this != TileType.Tile;
|
||||
}
|
||||
|
||||
public ItemStack getRecipe(final List<ItemStack> stacks) {
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
switch (this) {
|
||||
case Tile: {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -493,8 +475,42 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
||||
return this.color1.ordinal() + this.color2.ordinal() * 256 + this.type.ordinal() * 256 * 256;
|
||||
}
|
||||
|
||||
// public IIcon getIcon(final int layer) {
|
||||
// return this.type.icons[layer];
|
||||
// }
|
||||
public TextureAtlasSprite getSprite(int pass) {
|
||||
return this.type.sprites[pass];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderPasses() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockType getInventoryKey(ItemStack stack) {
|
||||
return getType(stack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockType getWorldKey(IBlockState state) {
|
||||
return getType(getMetaFromState(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSprite(BlockType type, int pass) {
|
||||
return type.getSprite(pass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerSprites(ITextureManager manager) {
|
||||
for (final TileType type : TileType.values()) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
type.sprites[i] = TextureManager.registerSprite(new ResourceLocation(Constants.BOTANY_MOD_ID + ":blocks/ceramic." + type.id + "." + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,22 +2,36 @@ package binnie.botany.ceramic;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStained extends Block implements IBlockMetadata {
|
||||
import org.apache.logging.log4j.core.net.Facility;
|
||||
|
||||
public class BlockStained extends Block implements IBlockMetadata, IColoredBlock {
|
||||
public BlockStained() {
|
||||
super(Material.GLASS);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
@@ -28,58 +42,53 @@ public class BlockStained extends Block implements IBlockMetadata {
|
||||
public int quantityDropped(final Random p_149745_1_) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isOpaqueCube() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderAsNormalBlock() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getRenderBlockPass() {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public boolean shouldSideBeRendered(final IBlockAccess p_149646_1_, final int p_149646_2_, final int p_149646_3_, final int p_149646_4_, final int p_149646_5_) {
|
||||
// final Block block2 = p_149646_1_.getBlock(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]);
|
||||
// final Block block3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
// return block3 != this && block3 != ExtraTrees.blockStained && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
// return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
Block block2 = blockAccess.getBlockState(pos.offset(side)).getBlock();
|
||||
Block block3 = blockAccess.getBlockState(pos).getBlock();
|
||||
return block3 != this && block3 != ExtraTrees.blockStained && super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean hasTileEntity(final int meta) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
// super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
// final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
// return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
// }
|
||||
//
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) {
|
||||
super.eventReceived(state, worldIn, pos, id, param);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity == null ? false : tileentity.receiveClientEvent(id, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
@@ -101,15 +110,11 @@ public class BlockStained extends Block implements IBlockMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World p0, BlockPos pos, ItemStack p4) {
|
||||
public void dropAsStack(World world, BlockPos pos, ItemStack itemStack) {
|
||||
spawnAsEntity(world, pos, itemStack);
|
||||
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
// this.dropBlockAsItem(world, x, y, z, drop);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item itemIn, final CreativeTabs par2CreativeTabs, final List<ItemStack> itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
@@ -137,51 +142,34 @@ public class BlockStained extends Block implements IBlockMetadata {
|
||||
// public void registerBlockIcons(final IIconRegister register) {
|
||||
// this.blockIcon = Botany.proxy.getIcon(register, "stained");
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getRenderColor(tile.getTileMetadata());
|
||||
// }
|
||||
// return 16777215;
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
// super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
// par1World.removeTileEntity(par2, par3, par4);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isWood(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
// return 20;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isFlammable(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
// return 5;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getRenderColor(final int meta) {
|
||||
// return EnumFlowerColor.get(meta).getColor(false);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
|
||||
return EnumFlowerColor.get(getMetaFromState(state)).getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,29 @@
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSoilMeter extends Item {
|
||||
// @Override
|
||||
// public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
||||
// Block block = world.getBlock(x, y, z);
|
||||
// if (!Gardening.isSoil(block)) {
|
||||
// --y;
|
||||
// block = world.getBlock(x, y, z);
|
||||
// }
|
||||
// if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
||||
// final IBlockSoil soil = (IBlockSoil) block;
|
||||
// final EnumSoilType type = soil.getType(world, x, y, z);
|
||||
// final EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
||||
// final EnumAcidity pH = soil.getPH(world, x, y, z);
|
||||
// String info = "Type: ";
|
||||
// info = info + "§" + (new char[] { '8', '6', 'd' })[type.ordinal()] + Binnie.Language.localise(type) + "§f";
|
||||
// info += ", Moisture: ";
|
||||
// info = info + "§" + (new char[] { 'e', '7', '9' })[moisture.ordinal()] + Binnie.Language.localise(moisture) + "§f";
|
||||
// info += ", pH: ";
|
||||
// info = info + "§" + (new char[] { 'c', 'a', 'b' })[pH.ordinal()] + Binnie.Language.localise(pH) + "§f";
|
||||
// final IChatComponent chat = new ChatComponentText(info);
|
||||
// player.addChatMessage(chat);
|
||||
// }
|
||||
// return super.onItemUse(stack, player, world, x, y, z, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
||||
// }
|
||||
public class ItemSoilMeter extends Item implements IItemModelRegister {
|
||||
|
||||
public ItemSoilMeter() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
@@ -41,6 +31,53 @@ public class ItemSoilMeter extends Item {
|
||||
this.setMaxStackSize(1);
|
||||
setRegistryName("soilMeter");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (!Gardening.isSoil(block)) {
|
||||
pos = pos.down();
|
||||
block = world.getBlockState(pos).getBlock();
|
||||
}
|
||||
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
String info = Binnie.Language.localise("botany.soil.type") + ": ";
|
||||
info = info + soil.getType(world, pos).getTranslated(true);
|
||||
info += ", " + TextFormatting.WHITE + Binnie.Language.localise("botany.moisture") + ": ";
|
||||
info = info + soil.getMoisture(world, pos).getTranslated(true);
|
||||
info += ", " + TextFormatting.WHITE + Binnie.Language.localise("botany.ph") + ": ";
|
||||
info = info + soil.getPH(world, pos).getTranslated(true);
|
||||
ITextComponent chat = new TextComponentString(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
public static String getPH(ItemStack stack, boolean withColor, boolean byNeutralNone) {
|
||||
EnumAcidity ph = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
if(byNeutralNone){
|
||||
if(ph == EnumAcidity.Neutral){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.Language.localise("botany.ph") + ": " + ph.getTranslated(withColor);
|
||||
}
|
||||
|
||||
public static String getMoisture(ItemStack stack, boolean withColor, boolean byNormalNone) {
|
||||
EnumMoisture moisure = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
if(byNormalNone){
|
||||
if(moisure == EnumMoisture.Normal){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.Language.localise("botany.moisture") + ": " + moisure.getTranslated(withColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
|
||||
@@ -31,9 +31,9 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ModuleGardening implements IInitializable {
|
||||
public static HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
|
||||
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
|
||||
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
|
||||
public static final HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
|
||||
public static final HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
|
||||
public static final HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
@@ -262,5 +262,4 @@ public class ModuleGardening implements IInitializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public class AlleleColor implements IAlleleInteger {
|
||||
String uid;
|
||||
boolean dominant;
|
||||
String name;
|
||||
int value;
|
||||
EnumFlowerColor color;
|
||||
|
||||
public AlleleColor(final EnumFlowerColor color, final String uid, final String name, final int value) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.color.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public EnumFlowerColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,9 @@ import binnie.botany.Botany;
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumFlowerColor implements IFlowerColour, IAlleleInteger {
|
||||
public enum EnumFlowerColor implements IFlowerColour, IAlleleInteger, IStringSerializable {
|
||||
Aquamarine("aquamarine", 8388564),
|
||||
Black("black", 2631720),
|
||||
Blue("blue", 255),
|
||||
@@ -2944,9 +2945,14 @@ public enum EnumFlowerColor implements IFlowerColour, IAlleleInteger {
|
||||
addMix(EnumFlowerColor.YellowGreen, EnumFlowerColor.Yellow, EnumFlowerColor.Khaki, 110);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColourName() {
|
||||
return Botany.proxy.localise("colour." + getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Botany.proxy.localise("colour." + this.name().toLowerCase());
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public static EnumFlowerColor get(final int i) {
|
||||
|
||||
@@ -1,36 +1,24 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.core.BotanyGUI;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDictionary extends Item {
|
||||
// IIcon iconMaster;
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
||||
// this.iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIconFromDamage(final int par1) {
|
||||
// return (par1 == 0) ? this.itemIcon : this.iconMaster;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
super.getSubItems(par1, par2CreativeTabs, par3List);
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
|
||||
public ItemDictionary() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
@@ -38,17 +26,30 @@ public class ItemDictionary extends Item {
|
||||
this.setMaxStackSize(1);
|
||||
setRegistryName("database");
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
|
||||
// if (itemstack.getItemDamage() == 0) {
|
||||
// Botany.proxy.openGui(BotanyGUI.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
// }
|
||||
// else {
|
||||
// Botany.proxy.openGui(BotanyGUI.DatabaseNEI, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
// }
|
||||
// return itemstack;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
super.getSubItems(par1, par2CreativeTabs, par3List);
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0, "botanistDatabase");
|
||||
manager.registerItemModel(item, 1, "masterBotanistDatabase");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player, EnumHand hand) {
|
||||
if(itemStack.getMetadata() == 0){
|
||||
Botany.proxy.openGui(BotanyGUI.Database, player, player.getPosition());
|
||||
}else{
|
||||
Botany.proxy.openGui(BotanyGUI.DatabaseNEI, player, player.getPosition());
|
||||
}
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
|
||||
@@ -1,36 +1,31 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemEncyclopedia extends Item {
|
||||
public class ItemEncyclopedia extends Item implements IItemModelRegister {
|
||||
boolean reinforced;
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "encylopedia" + (this.reinforced ? "Iron" : ""));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIconFromDamage(final int par1) {
|
||||
// return this.itemIcon;
|
||||
// }
|
||||
|
||||
public ItemEncyclopedia(final boolean reinforced) {
|
||||
this.reinforced = false;
|
||||
public ItemEncyclopedia(boolean reinforced) {
|
||||
this.reinforced = reinforced;
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("encylopedia" + (reinforced ? "Iron" : ""));
|
||||
this.setUnlocalizedName("encylopedia" + (reinforced ? "Reinforced" : ""));
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(reinforced ? 480 : 120);
|
||||
setRegistryName("encylopedia" + (reinforced ? "Iron" : ""));
|
||||
setRegistryName("encylopedia" + (reinforced ? "Reinforced" : ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0, "encylopedia" + (this.reinforced ? "Reinforced" : ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return (this.reinforced ? "Reinforced " : "") + "Florist's Encyclopaedia";
|
||||
public String getItemStackDisplayName(ItemStack itemStack) {
|
||||
return Binnie.Language.localise("item.botany.encylopedia" + (this.reinforced ? "_reinforced" : ""));
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package binnie.botany.items;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -10,21 +13,27 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPigment extends Item {
|
||||
public class ItemPigment extends Item implements IItemModelRegister, IColoredItem{
|
||||
public ItemPigment() {
|
||||
this.setUnlocalizedName("pigment");
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
setRegistryName("pigment");
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
// final int damage = stack.getItemDamage();
|
||||
// return EnumFlowerColor.get(damage).getColor(false);
|
||||
// }
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
manager.registerItemModel(item, c.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
return EnumFlowerColor.get(stack.getItemDamage()).getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
@@ -38,10 +47,4 @@ public class ItemPigment extends Item {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "pigment");
|
||||
// }
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return getBlockDropped(this, world, pos, state.getBlock().getMetaFromState(state));
|
||||
return getBlockDropped(this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,7 +76,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getBlockDropped(final IBlockMetadata block, final IBlockAccess world, final BlockPos pos, final int blockMeta) {
|
||||
public static ArrayList<ItemStack> getBlockDropped(final IBlockMetadata block, final IBlockAccess world, final BlockPos pos) {
|
||||
final ArrayList<ItemStack> array = new ArrayList<>();
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, pos);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
package binnie.core.block;
|
||||
|
||||
public interface IMultipassBlock {
|
||||
int getNumberOfPasses();
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
int colorMultiplier(final int p0);
|
||||
public interface IMultipassBlock<K> {
|
||||
@SideOnly(Side.CLIENT)
|
||||
int getRenderPasses();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
K getInventoryKey(ItemStack stack);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
K getWorldKey(IBlockState state);
|
||||
|
||||
/**
|
||||
* pass -1 = particle Sprite
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSprite(K key, int pass);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package binnie.core.block;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.models.ModelLeaves;
|
||||
import forestry.core.models.ModelBlockCached;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ModelMutlipass<B extends Block & IMultipassBlock<K>, K> extends ModelBlockCached<B , K> {
|
||||
|
||||
public ModelMutlipass(Class<B> blockClass) {
|
||||
super(blockClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected K getInventoryKey(ItemStack stack) {
|
||||
return ((B)Block.getBlockFromItem(stack.getItem())).getInventoryKey(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected K getWorldKey(IBlockState state) {
|
||||
return ((B)state.getBlock()).getWorldKey(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bakeBlock(B block, K key, IModelBaker baker, boolean inventory) {
|
||||
for(int pass = 0;pass < block.getRenderPasses();pass++){
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, block.getSprite(key, pass), 0);
|
||||
}
|
||||
|
||||
// Set the particle sprite
|
||||
baker.setParticleSprite(block.getSprite(key, -1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package binnie.core.block;
|
||||
|
||||
public class MultipassBlockRenderer //implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
// public static MultipassBlockRenderer instance;
|
||||
// private static int layer;
|
||||
//
|
||||
// public MultipassBlockRenderer() {
|
||||
// MultipassBlockRenderer.instance = this;
|
||||
// }
|
||||
//
|
||||
// private void setColour(final Tessellator tess, final int colour) {
|
||||
// final float var6 = (colour >> 16 & 0xFF) / 255.0f;
|
||||
// final float var7 = (colour >> 8 & 0xFF) / 255.0f;
|
||||
// final float var8 = (colour & 0xFF) / 255.0f;
|
||||
// GL11.glColor3f(var6, var7, var8);
|
||||
// }
|
||||
//
|
||||
// public static int getLayer() {
|
||||
// return MultipassBlockRenderer.layer;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void renderInventoryBlock(final Block block, final int meta, final int modelID, final RenderBlocks renderer) {
|
||||
// block.setBlockBoundsForItemRender();
|
||||
// renderer.setRenderBoundsFromBlock(block);
|
||||
// GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
// MultipassBlockRenderer.layer = 0;
|
||||
// while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
// this.renderItem(block, renderer, meta);
|
||||
// ++MultipassBlockRenderer.layer;
|
||||
// }
|
||||
// MultipassBlockRenderer.layer = 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
|
||||
// boolean r = true;
|
||||
// MultipassBlockRenderer.layer = 0;
|
||||
// while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
// r = renderer.renderStandardBlock(block, x, y, z);
|
||||
// ++MultipassBlockRenderer.layer;
|
||||
// }
|
||||
// MultipassBlockRenderer.layer = 0;
|
||||
// return r;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldRender3DInInventory(final int i) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getRenderId() {
|
||||
// return BinnieCore.multipassRenderID;
|
||||
// }
|
||||
//
|
||||
// public void renderItem(final Block block, final RenderBlocks renderer, final int meta) {
|
||||
// this.setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||
// final Tessellator tessellator = Tessellator.instance;
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
// renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
|
||||
// tessellator.draw();
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
// renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
|
||||
// tessellator.draw();
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
// renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
|
||||
// tessellator.draw();
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
// renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
|
||||
// tessellator.draw();
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
// renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
|
||||
// tessellator.draw();
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
// renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
|
||||
// tessellator.draw();
|
||||
// }
|
||||
//
|
||||
// public void setColor(final int l) {
|
||||
// final float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
// final float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
// final float f3 = (l & 0xFF) / 255.0f;
|
||||
// GL11.glColor3f(f, f2, f3);
|
||||
// }
|
||||
//
|
||||
// static {
|
||||
// MultipassBlockRenderer.layer = 0;
|
||||
// }
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package binnie.core.block;
|
||||
|
||||
public class MultipassItemRenderer// implements IItemRenderer
|
||||
{
|
||||
// private void render(final RenderBlocks renderer, final ItemStack item, final float f, final float g, final float h) {
|
||||
// GL11.glTranslatef(f, g, h);
|
||||
// final Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
// GL11.glEnable(3008);
|
||||
// if (block.getRenderBlockPass() != 0) {
|
||||
// GL11.glAlphaFunc(516, 0.1f);
|
||||
// GL11.glEnable(3042);
|
||||
// OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
// }
|
||||
// else {
|
||||
// GL11.glAlphaFunc(516, 0.5f);
|
||||
// GL11.glDisable(3042);
|
||||
// }
|
||||
// MultipassBlockRenderer.instance.renderInventoryBlock(block, TileEntityMetadata.getItemDamage(item), 0, renderer);
|
||||
// if (block.getRenderBlockPass() == 0) {
|
||||
// GL11.glAlphaFunc(516, 0.1f);
|
||||
// }
|
||||
// GL11.glTranslatef(-f, -g, -h);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
// switch (type) {
|
||||
// case ENTITY: {
|
||||
// return true;
|
||||
// }
|
||||
// case EQUIPPED: {
|
||||
// return true;
|
||||
// }
|
||||
// case INVENTORY: {
|
||||
// return true;
|
||||
// }
|
||||
// case EQUIPPED_FIRST_PERSON: {
|
||||
// return true;
|
||||
// }
|
||||
// default: {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
// switch (type) {
|
||||
// case ENTITY: {
|
||||
// this.render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
// break;
|
||||
// }
|
||||
// case EQUIPPED:
|
||||
// case EQUIPPED_FIRST_PERSON: {
|
||||
// this.render((RenderBlocks) data[0], item, 0.5f, 0.5f, 0.5f);
|
||||
// break;
|
||||
// }
|
||||
// case INVENTORY: {
|
||||
// this.render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package binnie.core.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.genetics.AlleleColor;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.ManagerBase;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -199,7 +199,7 @@ public class ManagerGenetics extends ManagerBase {
|
||||
if (o1 instanceof IAlleleFloat && o2 instanceof IAlleleFloat) {
|
||||
return Float.valueOf(((IAlleleFloat) o1).getValue()).compareTo(((IAlleleFloat) o2).getValue());
|
||||
}
|
||||
if (o1 instanceof IAlleleInteger && o2 instanceof IAlleleInteger && !(o1 instanceof AlleleColor)) {
|
||||
if (o1 instanceof IAlleleInteger && o2 instanceof IAlleleInteger && !(o1 instanceof EnumFlowerColor)) {
|
||||
return Integer.valueOf(((IAlleleInteger) o1).getValue()).compareTo(((IAlleleInteger) o2).getValue());
|
||||
}
|
||||
if (o1.getName() != null && o2.getName() != null) {
|
||||
|
||||
@@ -32,6 +32,6 @@ public class ControlColourDisplay extends Control implements IControlValue<IFlow
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltip) {
|
||||
super.getTooltip(tooltip);
|
||||
tooltip.add(this.value.getName());
|
||||
tooltip.add(this.value.getColourName());
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public class ControlColourOption extends ControlTextOption<IFlowerColour> {
|
||||
IPoint boxPosition;
|
||||
|
||||
public ControlColourOption(final ControlList<IFlowerColour> controlList, final IFlowerColour option, final int y) {
|
||||
super(controlList, option, option.getName(), y);
|
||||
super(controlList, option, option.getColourName(), y);
|
||||
this.setSize(new IPoint(this.getSize().x(), 20.0f));
|
||||
(this.controlBee = new ControlColourDisplay(this, 2.0f, 2.0f)).setValue(option);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
|
||||
@@ -7,6 +7,8 @@ import binnie.extratrees.block.PlankType;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BlockCarpentry extends BlockDesign {
|
||||
@@ -28,5 +30,4 @@ public class BlockCarpentry extends BlockDesign {
|
||||
public String getBlockName(final DesignBlock design) {
|
||||
return Binnie.Language.localise(ExtraTrees.instance, "block.woodentile.name", design.getDesign().getName());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.IToolHammer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -89,12 +91,12 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
|
||||
return ModuleCarpentry.getDesignBlock(this.getDesignSystem(), TileEntityMetadata.getTileMetadata(world, pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(int p0) {
|
||||
//@Override
|
||||
//public int colorMultiplier(int p0) {
|
||||
// final DesignBlock block = this.getCarpentryBlock(world, pos);
|
||||
// return (MultipassBlockRenderer.getLayer() > 0) ? block.getSecondaryColour() : block.getPrimaryColour();
|
||||
return 0;
|
||||
}
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
|
||||
// @Override
|
||||
@@ -153,8 +155,27 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfPasses() {
|
||||
public int getRenderPasses() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInventoryKey(ItemStack stack) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getWorldKey(IBlockState state) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getSprite(Object key, int pass) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class GlassType implements IDesignMaterial {
|
||||
GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.colour));
|
||||
}
|
||||
for (final EnumFlowerColor c2 : EnumFlowerColor.values()) {
|
||||
GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getName(), c2.getColor(false)));
|
||||
GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getColourName(), c2.getColor(false)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user