• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IFarmable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AdCustomFieldValue类代码示例发布时间:2022-05-15
下一篇:
Java Symbols类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap