net.minecraft.block.BlockOldLog Java Examples

The following examples show how to use net.minecraft.block.BlockOldLog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CocoaHandler.java    From BetterChests with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean canHandlePlant(Collection<ItemStack> items, World world, BlockPos pos, IBlockState state) {
	if (!WorldUtil.isBlockAir(state)) {
		return false;
	}
	boolean found = false;
	for (EnumFacing dir : EnumFacing.HORIZONTALS) {
		BlockPos toCheck = pos.offset(dir);
		IBlockState other = world.getBlockState(toCheck);
		if (other.getBlock() == Blocks.LOG && other.getValue(BlockOldLog.VARIANT) == EnumType.JUNGLE) {
			found = true;
			break;
		}
	}
	return found && items.stream().anyMatch(this::canPlantStack);
}
 
Example #2
Source File: WrappedBlockStateTests.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void test_deserialization_propertiesAsObject()
{
    WrappedBlockState state = gson.fromJson("{ \"block\": \"minecraft:log\", \"properties\" : { \"variant\" : \"spruce\"} }", WrappedBlockState.class);
    IBlockState blockState = state.createState();

    assertNotNull(state);
    assertNotNull(blockState);
    assertSame(Blocks.LOG, blockState.getBlock());
    assertSame(BlockPlanks.EnumType.SPRUCE, blockState.getValue(BlockOldLog.VARIANT));
}
 
Example #3
Source File: WrappedBlockStateTests.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void test_deserialization_propertiesAsString()
{
    WrappedBlockState state = gson.fromJson("{ \"block\": \"minecraft:log\", \"properties\" : \"variant=spruce,axis=z\" }", WrappedBlockState.class);
    IBlockState blockState = state.createState();

    assertNotNull(state);
    assertNotNull(blockState);
    assertSame(Blocks.LOG, blockState.getBlock());
    assertSame(BlockPlanks.EnumType.SPRUCE, blockState.getValue(BlockOldLog.VARIANT));
    assertSame(BlockLog.EnumAxis.Z, blockState.getValue(BlockLog.LOG_AXIS));
}
 
Example #4
Source File: Log.java    From minecraft-roguelike with GNU General Public License v3.0 5 votes vote down vote up
public static void setType(MetaBlock log, Wood type){
	switch(type){
	case OAK: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); return;
	case SPRUCE: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); return;
	case BIRCH: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.BIRCH); return;
	case JUNGLE: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); return;
	case ACACIA: log.withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA); return;
	case DARKOAK: log.withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK); return;
	default: log.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); return;
	}
}
 
Example #5
Source File: CocoaHandler.java    From BetterChests with GNU Lesser General Public License v3.0 4 votes vote down vote up
private boolean isJungleTree(IBlockState state) {
	return state.getBlock() == Blocks.LOG && state.getValue(BlockOldLog.VARIANT) == EnumType.JUNGLE;
}