當前位置: 首頁>>代碼示例>>Java>>正文


Java Blocks.OAK_FENCE屬性代碼示例

本文整理匯總了Java中net.minecraft.init.Blocks.OAK_FENCE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Blocks.OAK_FENCE屬性的具體用法?Java Blocks.OAK_FENCE怎麽用?Java Blocks.OAK_FENCE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.OAK_FENCE屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onVillageBlocks

@SubscribeEvent
public void onVillageBlocks(BiomeEvent.GetVillageBlockID event) {
    IBlockState original = event.getOriginal();

    if (event.getBiome() == ATGBiomes.TUNDRA) {
        if (original.getBlock() == Blocks.LOG || original.getBlock() == Blocks.LOG2) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE).withProperty(BlockLog.LOG_AXIS, original.getValue(BlockLog.LOG_AXIS)));
        } else if (original.getBlock() == Blocks.PLANKS) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.SPRUCE));
        } else if (original.getBlock() == Blocks.OAK_STAIRS) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.SPRUCE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, original.getValue(BlockStairs.FACING)));
        } else if (original.getBlock() == Blocks.OAK_FENCE) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.SPRUCE_FENCE.getDefaultState());
        }
    }
    else if (event.getBiome() == ATGBiomes.SCRUBLAND) {
        if (original.getBlock() == Blocks.LOG || original.getBlock() == Blocks.LOG2) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.LOG2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(BlockLog.LOG_AXIS, original.getValue(BlockLog.LOG_AXIS)));
        } else if (original.getBlock() == Blocks.PLANKS) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.ACACIA));
        } else if (original.getBlock() == Blocks.OAK_STAIRS) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.ACACIA_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, original.getValue(BlockStairs.FACING)));
        } else if (original.getBlock() == Blocks.OAK_FENCE) {
            event.setResult(Event.Result.DENY);
            event.setReplacement(Blocks.ACACIA_FENCE.getDefaultState());
        }
    }
}
 
開發者ID:stuebz88,項目名稱:modName,代碼行數:35,代碼來源:VillageBlocks.java

示例2: safeImpact

@Override
public void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
	int box = 1 + (int) ((float) amplifier / 2F);

	BlockPos posI = pos.add(box, box, box);
	BlockPos posF = pos.add(-box, -box, -box);

	Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
	for (BlockPos spot : spots) {
		Block block = world.getBlockState(spot).getBlock();
		IBlockState state = world.getBlockState(spot);
		boolean place = amplifier > 2 || world.rand.nextBoolean();
		if (place && stateMap.containsKey(block)) {
			world.setBlockState(spot, stateMap.get(block), 3);
		} else if (state.getBlock() == Blocks.LEAVES) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.LEAVES2) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.PLANKS) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.STONE) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.BRICK_BLOCK) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.STONEBRICK) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (BlockStairs.isBlockStairs(state)) {
			IBlockState newState = ModBlocks.fake_ice_stairs.getDefaultState()
					.withProperty(BlockStairs.FACING, state.getValue(BlockStairs.FACING))
					.withProperty(BlockStairs.HALF, state.getValue(BlockStairs.HALF));
			world.setBlockState(spot, newState);
		} else if (state.getBlock() == Blocks.OAK_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.ACACIA_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.BIRCH_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.DARK_OAK_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.JUNGLE_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.SPRUCE_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.NETHER_BRICK_FENCE) {
			world.setBlockState(spot, ModBlocks.fake_ice_fence.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.SANDSTONE) {
			world.setBlockState(spot, ModBlocks.fake_ice.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.NETHER_BRICK) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.RED_NETHER_BRICK) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == Blocks.END_BRICKS) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == ModBlocks.scorned_bricks) {
			world.setBlockState(spot, ModBlocks.embittered_bricks.getDefaultState(), 3);
		} else if (state.getBlock() == ModBlocks.nethersteel) {
			world.setBlockState(spot, Blocks.PACKED_ICE.getDefaultState(), 3);
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:60,代碼來源:IceWorldBrew.java


注:本文中的net.minecraft.init.Blocks.OAK_FENCE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。