Fix #1094 Leaves crash. Split decorative leaves into their own block

This commit is contained in:
mezz committed 2016-03-10 03:34:57 -08:00
1 parent ea64436f28
commit 43cf636096
34 files changed
+733 -338

No files matched your search

@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import forestry.api.genetics.IAlleleProperty;
/**
@@ -12,10 +14,13 @@ import forestry.api.genetics.IAlleleProperty;
*/
public interface IAlleleFruit extends IAlleleProperty<IAlleleFruit> {
@Nonnull
IFruitProvider getProvider();
@Nonnull
String getModelName();
@Nonnull
String getModID();
}
@@ -5,10 +5,12 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import java.util.Collection;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -20,42 +22,50 @@ import forestry.api.genetics.IFruitFamily;
public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleTreeSpecies> {
@Nonnull
@Override
ITreeRoot getRoot();
/**
* @return Native plant type of this species.
*/
@Nonnull
EnumPlantType getPlantType();
/**
* @return List of all {@link IFruitFamily}s which can grow on leaves generated by this species.
*/
@Nonnull
Collection<IFruitFamily> getSuitableFruit();
/**
* @return Tree generator for this species.
*/
@Nonnull
ITreeGenerator getGenerator();
/**
* @return The name of the model from the tree.
*/
@Nonnull
String getModelName();
/**
* @return The modid from the mod of the species.
*/
@Nonnull
String getModID();
/* MODELS AND OVERRIDES */
@SideOnly(Side.CLIENT)
@Nonnull
ILeafSpriteProvider getLeafSpriteProvider();
@SideOnly(Side.CLIENT)
int getGermlingColour(EnumGermlingType type, int renderPass);
@SideOnly(Side.CLIENT)
@Nonnull
ModelResourceLocation getGermlingModel(EnumGermlingType type);
@SideOnly(Side.CLIENT)
@@ -21,6 +21,9 @@ public interface IFruitProvider {
int getColour(ITreeGenome genome, IBlockAccess world, BlockPos pos, int ripeningTime);
/** return the color to use for decorative leaves. Usually the ripe color. */
int getDecorativeColor();
boolean markAsFruitLeaf(ITreeGenome genome, World world, BlockPos pos);
int getRipeningPeriod();
@@ -55,6 +58,9 @@ public interface IFruitProvider {
*/
short getSpriteIndex(ITreeGenome genome, IBlockAccess world, BlockPos pos, int ripeningTime, boolean fancy);
/** return the sprite index to display on decorative leaves */
short getDecorativeSpriteIndex();
/**
* @return true if this fruit provider requires fruit blocks to spawn, false otherwise.
*/
@@ -5,8 +5,11 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import forestry.api.core.IModelManager;
/**
@@ -17,5 +20,6 @@ import forestry.api.core.IModelManager;
public interface IGermlingModelProvider {
void registerModels(Item item, IModelManager manager);
@Nonnull
ModelResourceLocation getModel(EnumGermlingType type);
}
@@ -22,5 +22,5 @@ public interface ITreeGenerator {
void setLogBlock(ITreeGenome genome, World world, BlockPos pos, EnumFacing facing);
void setLeaves(ITreeGenome genome, World world, GameProfile owner, BlockPos pos, boolean decorative);
void setLeaves(ITreeGenome genome, World world, GameProfile owner, BlockPos pos);
}
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nonnull;
import java.util.EnumSet;
import net.minecraftforge.common.EnumPlantType;
@@ -19,6 +20,7 @@ public interface ITreeGenome extends IGenome {
@Override
IAlleleTreeSpecies getSecondary();
@Nonnull
IFruitProvider getFruitProvider();
IGrowthProvider getGrowthProvider();
@@ -8,6 +8,7 @@ package forestry.api.core;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -27,17 +28,17 @@ public interface IModelBaker {
void addBlockModel(Block block, BlockPos pos, TextureAtlasSprite sprites, int colorIndex);
void addFaceXNeg(BlockPos pos, TextureAtlasSprite sprite);
void addFaceXNeg(TextureAtlasSprite sprite);
void addFaceYNeg(BlockPos pos, TextureAtlasSprite sprite);
void addFaceYNeg(TextureAtlasSprite sprite);
void addFaceZNeg(BlockPos pos, TextureAtlasSprite sprite);
void addFaceZNeg(TextureAtlasSprite sprite);
void addFaceYPos(BlockPos pos, TextureAtlasSprite sprite);
void addFaceYPos(TextureAtlasSprite sprite);
void addFaceZPos(BlockPos pos, TextureAtlasSprite sprite);
void addFaceZPos(TextureAtlasSprite sprite);
void addFaceXPos(BlockPos pos, TextureAtlasSprite sprite);
void addFaceXPos(TextureAtlasSprite sprite);
IModelBakerModel getCurrentModel();
@@ -23,8 +23,6 @@ public interface ITreeGenData {
void setLeaves(World world, GameProfile owner, BlockPos pos);
void setLeavesDecorative(World world, GameProfile owner, BlockPos pos);
void setLogBlock(World world, BlockPos pos, EnumFacing facing);
boolean allowsFruitBlocks();