@Override public Map<String, ? extends Property<?>> getProperties(BlockType blockType) { Map<String, Property<?>> map = new TreeMap<>(); Collection<IProperty<?>> propertyKeys = Block.getBlockFromName(blockType.getId()) .getDefaultState() .getPropertyKeys(); for (IProperty<?> key : propertyKeys) { map.put(key.getName(), ForgeAdapter.adaptProperty(key)); } return map; }
@Override public BlockMaterial getMaterial(BlockType blockType) { return materialMap.computeIfAbsent(Block.getBlockFromName(blockType.getId()).getDefaultState().getMaterial(), m -> new ForgeBlockMaterial(m, super.getMaterial(blockType))); }
@Nullable @Override public String getName(BlockType blockType) { return Block.REGISTRY.getObject(new ResourceLocation(blockType.getId())).getLocalizedName(); }
public InWorldToolOperationIngredient( final Block blk, final boolean b ) { this.state = blk.getDefaultState(); this.blockOnly = b; }
private static BlockSwapper swapperFromMeta(World world, BlockPos pos, int meta) { switch(meta) { case 1 : return new BlockSwapper(world, pos, Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL)); case 2 : return new BlockSwapper(world, pos, Blocks.MYCELIUM.getDefaultState()); case 3 : return new BlockSwapper(world, pos, ModBlocks.altGrass.getDefaultState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.DRY)); case 4 : return new BlockSwapper(world, pos, ModBlocks.altGrass.getDefaultState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.GOLDEN)); case 5 : return new BlockSwapper(world, pos, ModBlocks.altGrass.getDefaultState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.VIVID)); case 6 : return new BlockSwapper(world, pos, ModBlocks.altGrass.getDefaultState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.SCORCHED)); case 7 : return new BlockSwapper(world, pos, ModBlocks.altGrass.getDefaultState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.INFUSED)); case 8 : return new BlockSwapper(world, pos, ModBlocks.altGrass.getDefaultState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.MUTATED)); default : return new BlockSwapper(world, pos, Blocks.GRASS.getDefaultState()); } }
@Override public void simulateBlockMine(BlockVector3 position) { BlockPos pos = ForgeAdapter.toBlockPos(position); IBlockState state = getWorld().getBlockState(pos); state.getBlock().dropBlockAsItem(getWorld(), pos, state, 0); getWorld().setBlockToAir(pos); }
BlockPos pos = new BlockPos(x, y, z); IBlockState old = chunk.getBlockState(pos); Block mcBlock = Block.getBlockFromName(block.getBlockType().getId()); IBlockState newState = mcBlock.getDefaultState(); Map<Property<?>, Object> states = block.getStates(); newState = applyProperties(mcBlock.getBlockState(), newState, states); IBlockState successState = chunk.setBlockState(pos, newState); boolean successful = successState != null;
public static void init() { BotaniaAPI.registerPureDaisyRecipe("stone", ModBlocks.livingrock.getDefaultState()); BotaniaAPI.registerPureDaisyRecipe("logWood", ModBlocks.livingwood.getDefaultState()); BotaniaAPI.registerPureDaisyRecipe("netherrack", Blocks.COBBLESTONE.getDefaultState()); BotaniaAPI.registerPureDaisyRecipe("soulSand", Blocks.SAND.getDefaultState()); BotaniaAPI.registerPureDaisyRecipe("ice", Blocks.PACKED_ICE.getDefaultState()); BotaniaAPI.registerPureDaisyRecipe(LibOreDict.BLAZE_BLOCK, Blocks.OBSIDIAN.getDefaultState()); BotaniaAPI.registerPureDaisyRecipe(Blocks.WATER, Blocks.SNOW.getDefaultState()); }
protected void setBlockAndMetadata(World world, BlockPos pos, IBlockState stateNew) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if(block.isAir(state, world, pos) || block.canPlaceBlockAt(world, pos) || world.getBlockState(pos) == leaves) { world.setBlockState(pos, stateNew, 2); } } }
private static boolean isLog(World world, BlockPos pos) { return world.getBlockState(pos).getBlock().isWood(world, pos); }
private static String getMagnetKey(Block block, int meta) { return "bm_" + block.getTranslationKey() + "@" + meta; }
public BeaconBeamComponent(BlockPos relPos) { super(relPos, Blocks.BEACON.getDefaultState()); }
public ColorSwitchingComponent(BlockPos relPos, Block block, PropertyEnum<EnumDyeColor> colorProp) { super(relPos, block.getDefaultState()); this.colorProp = colorProp; }
public BlockLivingwoodStairs() { super(ModBlocks.livingwood.getDefaultState()); }
public BeaconComponent(BlockPos relPos) { super(relPos, Blocks.IRON_BLOCK.getDefaultState()); }
public BlockShimmerwoodPlankStairs() { super(ModBlocks.shimmerwoodPlanks.getDefaultState()); }
public BlockShimmerrockStairs() { super(ModBlocks.shimmerrock.getDefaultState()); }
public StateInsensitiveComponent(BlockPos relPos, Block block) { super(relPos, block.getDefaultState(), false, null); }
public BlockSpecialQuartzStairs(Block source) { super(source.getDefaultState(), "quartzStairs" + ((BlockSpecialQuartz) source).type); }
public BlockLivingrockStairs() { super(ModBlocks.livingrock.getDefaultState()); }