use of forestry.arboriculture.blocks.BlockFruitPod in project ForestryMC by ForestryMC.
the class TreeRoot method setFruitBlock.
@Override
public boolean setFruitBlock(World world, ITreeGenome genome, IAlleleFruit allele, float sappiness, BlockPos pos) {
BlockRegistryArboriculture blocks = ModuleArboriculture.getBlocks();
EnumFacing facing = BlockUtil.getValidPodFacing(world, pos);
if (facing != null) {
BlockFruitPod fruitPod = blocks.getFruitPod(allele);
if (fruitPod != null) {
IBlockState state = fruitPod.getDefaultState().withProperty(BlockHorizontal.FACING, facing);
boolean placed = world.setBlockState(pos, state);
if (placed) {
Block block = world.getBlockState(pos).getBlock();
if (fruitPod == block) {
TileFruitPod pod = TileUtil.getTile(world, pos, TileFruitPod.class);
if (pod != null) {
pod.setProperties(genome, allele, sappiness);
world.markBlockRangeForRenderUpdate(pos, pos);
return true;
} else {
world.setBlockToAir(pos);
return false;
}
}
}
}
}
return false;
}
use of forestry.arboriculture.blocks.BlockFruitPod in project ForestryMC by ForestryMC.
the class FruitPodStateMapper method putStateModelLocations.
@Override
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
if (block instanceof BlockFruitPod) {
BlockFruitPod blockFruitPod = (BlockFruitPod) block;
IAlleleFruit fruit = blockFruitPod.getFruit();
String modID = fruit.getModID();
if (modID == null) {
modID = Constants.MOD_ID;
}
String modelName = fruit.getModelName();
String resourcePath = modID + ":pods/" + modelName;
for (IBlockState state : block.getBlockState().getValidStates()) {
String propertyString = getPropertyString(state.getProperties());
mapStateModelLocations.put(state, new ModelResourceLocation(resourcePath, propertyString));
}
}
return mapStateModelLocations;
}
Aggregations