本文整理匯總了Java中net.minecraftforge.common.EnumPlantType.Crop方法的典型用法代碼示例。如果您正苦於以下問題:Java EnumPlantType.Crop方法的具體用法?Java EnumPlantType.Crop怎麽用?Java EnumPlantType.Crop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.common.EnumPlantType
的用法示例。
在下文中一共展示了EnumPlantType.Crop方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: canSustainPlant
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
IBlockState plant = plantable.getPlant(world, pos.offset(direction));
net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
if(plantType == EnumPlantType.Crop)
return true;
if(plantType == EnumPlantType.Plains)
return true;
if(plantable == TFCBlocks.Sapling)
return true;
return false;
}
示例2: canSustainPlantType
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
public boolean canSustainPlantType(IBlockAccess world, BlockPos pos, EnumPlantType plantType)
{
IBlockState state = world.getBlockState(pos);
switch ((ExtraGrassType) state.getValue(VARIANT))
{
case FARM:
if (plantType == EnumPlantType.Crop) {return true;}
break;
case SAND:
case REDSAND:
if (plantType == EnumPlantType.Desert) {return true;}
break;
default: break;
}
switch (plantType)
{
// support plains and cave plants
case Plains: case Cave:
return true;
// support beach plants if there's water alongside
case Beach:
return (
(!world.isAirBlock(pos.east()) && world.getBlockState(pos.east()).getMaterial() == Material.WATER) ||
(!world.isAirBlock(pos.west()) && world.getBlockState(pos.west()).getMaterial() == Material.WATER) ||
(!world.isAirBlock(pos.north()) && world.getBlockState(pos.north()).getMaterial() == Material.WATER) ||
(!world.isAirBlock(pos.south()) && world.getBlockState(pos.south()).getMaterial() == Material.WATER)
);
// don't support nether plants, water plants, or crops (require farmland), or anything else by default
default:
return false;
}
}
示例3: acceptsInputStack
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
protected boolean acceptsInputStack(int slot, ItemStack stack) {
if (ItemStackUtil.isEmpty(stack)) {
return false;
}
if (stack.getItem() instanceof IPlantable) {
IPlantable plant = (IPlantable) stack.getItem();
if (plant.getPlantType(this.getWorld(), this.getPos()) == EnumPlantType.Crop) {
return true;
}
}
return false;
}
示例4: canSustainPlant
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
public boolean canSustainPlant(final IBlockAccess world, final int x,
final int y, final int z, final ForgeDirection direction,
final IPlantable plantable) {
final EnumPlantType plant = plantable.getPlantType(world, x, y + 1, z);
// Crops or reeds
return plant == EnumPlantType.Crop || plant == EnumPlantType.Beach;
}
示例5: canSustainPlant
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public boolean canSustainPlant (IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
TileEntityGarden gardenTile = getTileEntity(world, x, y, z);
EnumPlantType plantType = plantable.getPlantType(world, x, y, z);
if (plantType == EnumPlantType.Crop)
return substrateSupportsCrops(gardenTile.getSubstrate());
return false;
}
示例6: getPlantType
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
return EnumPlantType.Crop;
}
示例7: getPlantType
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
return soil == Blocks.FARMLAND ? EnumPlantType.Crop : EnumPlantType.Water;
}
示例8: BlockCropsBase
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
public BlockCropsBase(String unlocalizedName, String modId, Item seed, Item crop) {
this(unlocalizedName, modId, seed, crop, EnumPlantType.Crop);
}
示例9: getPlantType
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
return EnumPlantType.Crop;
}
示例10: canSustainPlant
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
EnumPlantType type = plantable.getPlantType(world, pos.offset(direction));
return direction == EnumFacing.UP && (type == EnumPlantType.Crop || type == EnumPlantType.Plains);
}
示例11: getPlantType
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
{
return world.getTileEntity(pos).hasCapability(ExPCropCapability.cropCap, null) && IExPCrop.of(world.getTileEntity(pos)).isWild() ? EnumPlantType.Plains : EnumPlantType.Crop;
}
示例12: getPlantType
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
{
return EnumPlantType.Crop;
}
示例13: getPlantType
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
return EnumPlantType.Crop;
}
示例14: performWork
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
protected float performWork() {
float result = 0.0f;
// EnumFacing facing = super.getFacing();
if (this.plantedThing != null) {
PropertyInteger ageProperty = this.getAgeProperty(this.plantedThing);
if (ageProperty != null) {
int age = this.plantedThing.getValue(ageProperty);
Integer[] ages = ageProperty.getAllowedValues().toArray(new Integer[0]);
if (age == ages[ages.length - 1]) {
List<ItemStack> stacks = this.plantedThing.getBlock().getDrops(this.getWorld(), this.getPos(), this.plantedThing, 0);
// if (stacks != null) {
// for (ItemStack s : stacks) {
// ItemStack remaining = ItemHandlerHelper.insertItem(this.outStackHandler, s, false);
// if (!ItemStackUtil.isEmpty(remaining)) {
//// BlockPos spawnPos = this.pos.offset(facing);
//// world.spawnEntity(new EntityItem(this.getWorld(), spawnPos.getX(), spawnPos.getY(), spawnPos.getZ(), remaining));
// super.spawnOverloadedItem(remaining);
// }
// }
// }
if (super.outputItems(stacks)) {
this.plantedThing = null;
result += .85f;
}
} else {
this.plantedThing = this.plantedThing.withProperty(ageProperty, ++age);
result += .85f;
}
this.onPlantedThingChanged();
}
// result += .85f;
}
if ((this.plantedThing == null) && (this.waterTank != null) && (this.waterTank.getFluidAmount() >= 250)) {
ItemStack stack = this.inStackHandler.getStackInSlot(0);
if (!ItemStackUtil.isEmpty(stack) && (stack.getItem() instanceof IPlantable)) {
IPlantable plantable = (IPlantable) stack.getItem();
if (plantable.getPlantType(this.getWorld(), this.getPos()) == EnumPlantType.Crop) {
this.plantedThing = plantable.getPlant(this.getWorld(), this.getPos());
this.waterTank.drain(250, true); // TODO: <-- do this better
this.onPlantedThingChanged();
}
}
result += .15f;
}
return result;
}
示例15: canPlantHere
import net.minecraftforge.common.EnumPlantType; //導入方法依賴的package包/類
@Override
public boolean canPlantHere(World world, BlockPos pos) {
return (world.getBlockState(pos.down()).getBlock() == Blocks.FARMLAND)
&& this.plantable.getPlantType(world, pos) == EnumPlantType.Crop;
}