public static Property<?> adaptProperty(IProperty<?> property) { if (property instanceof PropertyBool) { return new BooleanProperty(property.getName(), ImmutableList.copyOf(((PropertyBool) property).getAllowedValues())); } if (property instanceof PropertyInteger) { return new IntegerProperty(property.getName(), ImmutableList.copyOf(((PropertyInteger) property).getAllowedValues())); } if (property instanceof PropertyDirection) { return new DirectionalProperty(property.getName(), ((PropertyDirection) property).getAllowedValues().stream() .map(ForgeAdapter::adaptEnumFacing) .collect(Collectors.toList())); } if (property instanceof PropertyEnum) { return new EnumProperty(property.getName(), ((PropertyEnum<?>) property).getAllowedValues().stream() .map(e -> e.getName()) .collect(Collectors.toList())); } return new IPropertyAdapter<>(property); }
@Nonnull @Override public Map<IBlockState, ModelResourceLocation> getStateModelLocations() { Map<IBlockState, ModelResourceLocation> map = new HashMap<>(); for (int bite : BlockCake.BITES.getAllowedValues()) map.put(getDefaultState().withProperty(BlockCake.BITES, bite), new ModelResourceLocation(new ResourceLocation(FoodCraftReloadedMod.MODID, "fruit_cake"), "bites=" + bite)); return map; }
@Nonnull @Override public Map<IBlockState, ModelResourceLocation> getStateModelLocations() { Map<IBlockState, ModelResourceLocation> locationMap = new HashMap<>(); for (int i : BlockSapling.STAGE.getAllowedValues()) locationMap.put(getDefaultState().withProperty(BlockSapling.STAGE, i), new ModelResourceLocation(new ResourceLocation(FoodCraftReloadedMod.MODID, "fruit_sapling"), "normal")); return locationMap; }
@Override @SideOnly(Side.CLIENT) public void registerRenderers(@Nonnull IModObject modObject) { for (Integer dmg : DAMAGE.getAllowedValues()) { ClientUtil.regRenderer(this, dmg, DAMAGE.getName() + "=" + DAMAGE.getName(NullHelper.notnullM(dmg, "invalid property")) + "," + FACING.getName() + "=" + FACING.getName(EnumFacing.NORTH)); } }
private static void setMoreSnow(World world, BlockPos pos) { IBlockState hitState = world.getBlockState(pos); int m = hitState.getBlock().getMetaFromState(hitState) + 1; if (BlockSnow.LAYERS.getAllowedValues().contains(m + 1)) { world.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, m + 1)); UtilSound.playSound(world, pos, SoundEvents.BLOCK_SNOW_PLACE, SoundCategory.BLOCKS); } else { setNewSnow(world, pos.up()); } }
private void setDynamicBlocks(Map<BlockPos, String> dataBlocks, Map<BlockPos, String> dataBlocksClone, World world, Random random, HashMap<BlockPos, IBlockState> defaultBlocks) { int dinoType = random.nextInt(FossilBlock.VARIANT.getAllowedValues().size()); dataBlocks.forEach((pos, type) -> {
ModCyclic.logger.log("[harvest] age Property " + blockId); int currentAge = blockState.getValue(propInt); int minAge = Collections.min(propInt.getAllowedValues()); int maxAge = Collections.max(propInt.getAllowedValues()); if (harvestCustomMaxAge.containsKey(blockId.toString())) { maxAge = harvestCustomMaxAge.get(blockId.toString());
int garlic_age_count = BlockGarlic.AGE.getAllowedValues().size(); this.setBlockState(worldIn, Blocks.WATER.getDefaultState(), 1, -1, 6, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.FARMLAND.getDefaultState(), 1, -1, 7, structureBoundingBoxIn);