本文整理汇总了Java中forestry.api.farming.IFarmable类的典型用法代码示例。如果您正苦于以下问题:Java IFarmable类的具体用法?Java IFarmable怎么用?Java IFarmable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFarmable类属于forestry.api.farming包,在下文中一共展示了IFarmable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: harvest
import forestry.api.farming.IFarmable; //导入依赖的package包/类
@Override
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
world = housing.getWorld();
Stack<ICrop> crops = new Stack<ICrop>();
for(int i = 0; i < extent; i++) {
Vect position = translateWithOffset(x, y + 1, z, direction, i);
for(IFarmable seed : seeds) {
ICrop crop = seed.getCropAt(world, position.x, position.y, position.z);
if(crop != null)
crops.push(crop);
}
}
return crops;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:17,代码来源:FarmLogicCrops.java
示例2: harvest
import forestry.api.farming.IFarmable; //导入依赖的package包/类
@Override
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
world = housing.getWorld();
Stack<ICrop> crops = new Stack<ICrop>();
for(int i = 0; i < extent; i++) {
Vect position = translateWithOffset(x, y + 1, z, direction, i);
for(IFarmable seed : germlings) {
ICrop crop = seed.getCropAt(world, position.x, position.y, position.z);
if(crop != null)
crops.push(crop);
}
}
return crops;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:17,代码来源:FarmLogicPoale.java
示例3: harvest
import forestry.api.farming.IFarmable; //导入依赖的package包/类
@Override
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
world = housing.getWorld();
Stack<ICrop> crops = new Stack<ICrop>();
for(int i = 0; i < extent; i++) {
Vect position = translateWithOffset(x, y + 1, z, direction, i);
for(IFarmable farmable : germlings) {
ICrop crop = farmable.getCropAt(world, position.x, position.y, position.z);
if(crop != null)
crops.push(crop);
}
}
return crops;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:19,代码来源:FarmLogicInfernal.java
示例4: plantGermling
import forestry.api.farming.IFarmable; //导入依赖的package包/类
@Override
public boolean plantGermling(IFarmable germling, World world, int x, int y, int z) {
for(int i = SLOT_GERMLINGS_1; i < SLOT_GERMLINGS_1 + SLOT_COUNT_RESERVOIRS; i++) {
if(inventory.getStackInSlot(i) == null)
continue;
if(!germling.isGermling(inventory.getStackInSlot(i)))
continue;
if(!germling.plantSaplingAt(inventory.getStackInSlot(i), world, x, y, z))
continue;
inventory.decrStackSize(i, 1);
return true;
}
return false;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:18,代码来源:TileFarmPlain.java
示例5: FarmLogicCrops
import forestry.api.farming.IFarmable; //导入依赖的package包/类
public FarmLogicCrops(IFarmHousing housing, IFarmable[] seeds) {
super(housing,
new ItemStack[] { new ItemStack(Block.dirt) },
new ItemStack[] { new ItemStack(Block.tilledField) },
new ItemStack[] { new ItemStack(Block.dirt), new ItemStack(Block.grass) });
this.seeds = seeds;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:9,代码来源:FarmLogicCrops.java
示例6: isAcceptedGermling
import forestry.api.farming.IFarmable; //导入依赖的package包/类
@Override
public boolean isAcceptedGermling(ItemStack itemstack) {
for(IFarmable germling : seeds) {
if(germling.isGermling(itemstack)) {
return true;
}
}
return false;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:10,代码来源:FarmLogicCrops.java
示例7: trySetCrop
import forestry.api.farming.IFarmable; //导入依赖的package包/类
private boolean trySetCrop(Vect position) {
for(IFarmable candidate : seeds) {
if(housing.plantGermling(candidate, world, position.x, position.y, position.z))
return true;
}
return false;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:10,代码来源:FarmLogicCrops.java
示例8: FarmLogicHomogenous
import forestry.api.farming.IFarmable; //导入依赖的package包/类
public FarmLogicHomogenous(IFarmHousing housing, ItemStack[] resource, ItemStack[] ground, ItemStack[] waste, IFarmable[] germlings) {
super(housing);
this.resource = resource;
this.ground = ground;
this.waste = waste;
this.germlings = germlings;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:8,代码来源:FarmLogicHomogenous.java
示例9: isAcceptedGermling
import forestry.api.farming.IFarmable; //导入依赖的package包/类
@Override
public boolean isAcceptedGermling(ItemStack itemstack) {
for(IFarmable germling : germlings)
if(germling.isGermling(itemstack))
return true;
return false;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:8,代码来源:FarmLogicHomogenous.java
示例10: FarmLogicArboreal
import forestry.api.farming.IFarmable; //导入依赖的package包/类
public FarmLogicArboreal(IFarmHousing housing) {
super(housing,
new ItemStack[] { new ItemStack(Block.dirt) },
new ItemStack[] { new ItemStack(ForestryBlock.soil.blockID, 1, 0), new ItemStack(ForestryBlock.soil.blockID, 1, -1) },
new ItemStack[] { new ItemStack(Block.sand) },
Farmables.farmables.get("farmArboreal").toArray(new IFarmable[0])
);
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:9,代码来源:FarmLogicArboreal.java
示例11: getHarvestBlocks
import forestry.api.farming.IFarmable; //导入依赖的package包/类
private Collection<ICrop> getHarvestBlocks(Vect position) {
ArrayList<Vect> seen = new ArrayList<Vect>();
Stack<ICrop> crops = new Stack<ICrop>();
// Determine what type we want to harvest.
IFarmable germling = null;
for(IFarmable germl : germlings) {
ICrop crop = germl.getCropAt(world, position.x, position.y, position.z);
if(crop == null)
continue;
crops.push(crop);
seen.add(position);
germling = germl;
break;
}
if(germling == null)
return crops;
ArrayList<Vect> candidates = processHarvestBlock(germling, crops, seen, position, position);
ArrayList<Vect> temp = new ArrayList<Vect>();
while(!candidates.isEmpty()) {
for(Vect candidate : candidates) {
temp.addAll(processHarvestBlock(germling, crops, seen, position, candidate));
}
candidates.clear();
candidates.addAll(temp);
temp.clear();
}
return crops;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:35,代码来源:FarmLogicArboreal.java
示例12: processHarvestBlock
import forestry.api.farming.IFarmable; //导入依赖的package包/类
private ArrayList<Vect> processHarvestBlock(IFarmable germling, Stack<ICrop> crops, Collection<Vect> seen, Vect start, Vect position) {
ArrayList<Vect> candidates = new ArrayList<Vect>();
// Get additional candidates to return
for(int i = -1; i < 2; i++) {
for(int j = yOffset; j < 2; j++) {
for(int k = -1; k < 2; k++) {
Vect candidate = new Vect(position.x + i, position.y + j, position.z + k);
if(candidate.equals(position))
continue;
if(Math.abs(candidate.x - start.x) > 5)
continue;
if(Math.abs(candidate.z - start.z) > 5)
continue;
// See whether the given position has already been processed
boolean skip = false;
for(Vect prcs : seen) {
if(candidate.equals(prcs)) {
skip = true;
break;
}
}
if(skip)
continue;
ICrop crop = germling.getCropAt(world, candidate.x, candidate.y, candidate.z);
if(crop != null) {
crops.push(crop);
candidates.add(candidate);
seen.add(candidate);
}
}
}
}
return candidates;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:41,代码来源:FarmLogicArboreal.java
示例13: plantSapling
import forestry.api.farming.IFarmable; //导入依赖的package包/类
private boolean plantSapling(Vect position) {
for(IFarmable candidate : germlings) {
if(housing.plantGermling(candidate, world, position.x, position.y, position.z))
return true;
}
return false;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:10,代码来源:FarmLogicArboreal.java
示例14: FarmLogicInfernal
import forestry.api.farming.IFarmable; //导入依赖的package包/类
public FarmLogicInfernal(IFarmHousing housing) {
super(housing,
new ItemStack[] { new ItemStack(Block.slowSand) },
new ItemStack[] { new ItemStack(Block.slowSand) },
new ItemStack[0],
Farmables.farmables.get("farmInfernal").toArray(new IFarmable[0]));
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:8,代码来源:FarmLogicInfernal.java
示例15: trySetCrop
import forestry.api.farming.IFarmable; //导入依赖的package包/类
private boolean trySetCrop(Vect position) {
for(IFarmable candidate : germlings) {
if(housing.plantGermling(candidate, world, position.x, position.y, position.z))
return true;
}
return false;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:10,代码来源:FarmLogicInfernal.java
示例16: getFarmLogic
import forestry.api.farming.IFarmable; //导入依赖的package包/类
@Override
protected IFarmLogic getFarmLogic(IFarmHousing housing) throws Throwable{
ArrayList<IFarmable> origList = (ArrayList<IFarmable>)Farmables.farmables.get("farmVegetables");
ArrayList<IFarmable> backup = new ArrayList<IFarmable>(origList);
origList.clear();
origList.add(new FarmablePlastic(getBlock()));
IFarmLogic logic = getLogicClass("FarmLogicVegetable").getConstructor(IFarmHousing.class).newInstance(housing);
origList.clear();
origList.addAll(backup);
return logic;
}
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:12,代码来源:FarmLogicPlasticNormal.java
示例17: isWindfall
import forestry.api.farming.IFarmable; //导入依赖的package包/类
public boolean isWindfall(ItemStack itemstack) {
for(IFarmable germling : seeds)
if(germling.isWindfall(itemstack))
return true;
return false;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:7,代码来源:FarmLogicCrops.java
示例18: isWindfall
import forestry.api.farming.IFarmable; //导入依赖的package包/类
public boolean isWindfall(ItemStack itemstack) {
for(IFarmable germling : germlings)
if(germling.isWindfall(itemstack))
return true;
return false;
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:7,代码来源:FarmLogicHomogenous.java
示例19: FarmLogicVegetable
import forestry.api.farming.IFarmable; //导入依赖的package包/类
public FarmLogicVegetable(IFarmHousing housing) {
super(housing, Farmables.farmables.get("farmVegetables").toArray(new IFarmable[0]));
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:4,代码来源:FarmLogicVegetable.java
示例20: FarmLogicGourd
import forestry.api.farming.IFarmable; //导入依赖的package包/类
public FarmLogicGourd(IFarmHousing housing) {
super(housing);
seeds = Farmables.farmables.get("farmGourd").toArray(new IFarmable[0]);
}
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:5,代码来源:FarmLogicGourd.java
注:本文中的forestry.api.farming.IFarmable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论