mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 11:49:14 +00:00
First 1.8.9 Version
This commit is contained in:
1 parent
d35cc1df09
commit
5a3850c264
1657 files changed
+26844
-13269
No files matched your search
@@ -12,21 +12,17 @@ package forestry.arboriculture;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
public class FruitProviderPod extends FruitProviderNone {
|
||||
@@ -40,17 +36,9 @@ public class FruitProviderPod extends FruitProviderNone {
|
||||
EnumPodType(short stage1, short stage2, short stage3) {
|
||||
uids = new short[]{stage1, stage2, stage3};
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
if (this == COCOA) {
|
||||
return;
|
||||
}
|
||||
|
||||
String name = toString().toLowerCase(Locale.ENGLISH);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
TextureManager.registerTexUID(register, uids[i], "pods/" + name + "." + i);
|
||||
}
|
||||
|
||||
public String getModelName(){
|
||||
return toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +59,7 @@ public class FruitProviderPod extends FruitProviderNone {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getFruits(ITreeGenome genome, World world, int x, int y, int z, int ripeningTime) {
|
||||
public ItemStack[] getFruits(ITreeGenome genome, World world, BlockPos pos, int ripeningTime) {
|
||||
if (drop == null || drop.length == 0) {
|
||||
return DUMMY;
|
||||
}
|
||||
@@ -88,29 +76,32 @@ public class FruitProviderPod extends FruitProviderNone {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trySpawnFruitBlock(ITreeGenome genome, World world, int x, int y, int z) {
|
||||
public boolean trySpawnFruitBlock(ITreeGenome genome, World world, BlockPos pos) {
|
||||
|
||||
if (world.rand.nextFloat() > genome.getSappiness()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type == EnumPodType.COCOA) {
|
||||
return BlockUtil.tryPlantPot(world, x, y, z, Blocks.cocoa);
|
||||
return BlockUtil.tryPlantPot(world, pos, Blocks.cocoa);
|
||||
} else {
|
||||
return TreeManager.treeRoot.setFruitBlock(world, (IAlleleFruit) genome.getActiveAllele(EnumTreeChromosome.FRUITS),
|
||||
genome.getSappiness(), type.uids, x, y, z);
|
||||
genome.getSappiness(), type.uids, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public short getIconIndex(ITreeGenome genome, IBlockAccess world, int x, int y, int z, int ripeningTime, boolean fancy) {
|
||||
public short getSpriteIndex(ITreeGenome genome, IBlockAccess world, BlockPos pos, int ripeningTime, boolean fancy) {
|
||||
return type.uids[0];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
type.registerIcons(register);
|
||||
public void registerSprites() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelName() {
|
||||
return type.getModelName();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user