public BlockStateContainer build() { IProperty<?>[] iproperty = new IProperty[this.listed.size()]; iproperty = (IProperty[])this.listed.toArray(iproperty); if (this.unlisted.size() == 0) { return new BlockStateContainer(this.block, iproperty); } else { IUnlistedProperty<?>[] iunlistedproperty = new IUnlistedProperty[this.unlisted.size()]; iunlistedproperty = (IUnlistedProperty[])this.unlisted.toArray(iunlistedproperty); return (BlockStateContainer)Reflector.newInstance(Reflector.ExtendedBlockState_Constructor, new Object[] {this.block, iproperty, iunlistedproperty}); } }
@Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { final Optional<IBlockState> maybeInnerBlock; final Optional<CanvasState> maybeCanvasState; if (state instanceof IExtendedBlockState) { final IExtendedBlockState extendedState = (IExtendedBlockState)state; final ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties = extendedState.getUnlistedProperties(); maybeInnerBlock = getProperty(unlistedProperties, InnerBlockState.PROPERTY); maybeCanvasState = getProperty(unlistedProperties, CanvasState.PROPERTY); if (maybeCanvasState.isPresent()) maybeCanvasState.get().onRender(); } else { maybeInnerBlock = Optional.empty(); maybeCanvasState = Optional.empty(); } final BlockRenderLayer renderLayer = MoreObjects.firstNonNull(MinecraftForgeClient.getRenderLayer(), BlockRenderLayer.CUTOUT); return modelTransformer.getQuads(maybeInnerBlock, maybeCanvasState, renderLayer).get(side); }
protected BlockStateContainer(Block p_i9_1_, IProperty<?>[] p_i9_2_, ImmutableMap < IUnlistedProperty<?>, Optional<? >> p_i9_3_) { this.block = p_i9_1_; Map < String, IProperty<? >> map = Maps. < String, IProperty<? >> newHashMap(); for (IProperty<?> iproperty : p_i9_2_) { validateProperty(p_i9_1_, iproperty); map.put(iproperty.getName(), iproperty); } this.properties = ImmutableSortedMap. < String, IProperty<? >> copyOf(map); Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map2 = Maps. < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > newLinkedHashMap(); List<BlockStateContainer.StateImplementation> list = Lists.<BlockStateContainer.StateImplementation>newArrayList(); for (List < Comparable<? >> list1 : Cartesian.cartesianProduct(this.getAllowedValues())) { Map < IProperty<?>, Comparable<? >> map1 = MapPopulator. < IProperty<?>, Comparable<? >> createMap(this.properties.values(), list1); BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = this.createState(p_i9_1_, ImmutableMap. < IProperty<?>, Comparable<? >> copyOf(map1), p_i9_3_); map2.put(map1, blockstatecontainer$stateimplementation); list.add(blockstatecontainer$stateimplementation); } for (BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation1 : list) { blockstatecontainer$stateimplementation1.buildPropertyValueTable(map2); } this.validStates = ImmutableList.copyOf(list); }
public BlockStateContainer.Builder add(IUnlistedProperty<?>... p_add_1_) { for (IUnlistedProperty<?> iunlistedproperty : p_add_1_) { this.unlisted.add(iunlistedproperty); } return this; }
@Override @Nonnull protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, BlockHorizontal.FACING, IS_LIT) { @Override @Nonnull protected StateImplementation createState(@Nonnull Block block, ImmutableMap<IProperty<?>, Comparable<?>> properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties) { return new State(block, properties); } }; }
@Override public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{BlockMultiblockBase.MULTIBLOCK_GAG, BlockMultiblockBase.FACING}, new IUnlistedProperty[]{Properties.AnimationProperty}); }
@SuppressWarnings ("unchecked") private static int hashBlockState(IExtendedBlockState state) { List<String> toHash = new LinkedList<>(); toHash.add(state.toString()); toHash.add("meta=" + state.getBlock().getMetaFromState(state)); for (Entry<IUnlistedProperty<?>, Optional<?>> entry : state.getUnlistedProperties().entrySet()) { IUnlistedProperty property = entry.getKey(); toHash.add(property.getName() + "=" + property.valueToString(state.getValue(property))); } return Objects.hashCode(toHash.toArray()); }
@Override public BlockStateContainer createBlockState() { if (maxStates.get() == -1) { maxIntValueInProperties = -1; propertyList = null; } else { maxIntValueInProperties = Math.min(maxStates.get(), 3); if (!propertyListMap.containsKey(maxIntValueInProperties)) { PropertyInteger UP = PropertyInteger.create("up", 0, maxIntValueInProperties); PropertyInteger DOWN = PropertyInteger.create("down", 0, maxIntValueInProperties); PropertyInteger NORTH = PropertyInteger.create("north", 0, maxIntValueInProperties); PropertyInteger EAST = PropertyInteger.create("east", 0, maxIntValueInProperties); PropertyInteger SOUTH = PropertyInteger.create("south", 0, maxIntValueInProperties); PropertyInteger WEST = PropertyInteger.create("west", 0, maxIntValueInProperties); propertyListMap.put(maxIntValueInProperties, new PropertyList(UP, DOWN, NORTH, EAST, SOUTH, WEST)); } propertyList = propertyListMap.get(maxIntValueInProperties); } IProperty<?>[] properties = getProperties(); IUnlistedProperty<?>[] unlistedProperties = getUnlistedProperties(); if (properties == null) { properties = new IProperty[]{propertyList.DOWN, propertyList.UP, propertyList.NORTH, propertyList.SOUTH, propertyList.WEST, propertyList.EAST}; } if (unlistedProperties != null && unlistedProperties.length > 0) return new ExtendedBlockState(this, properties, unlistedProperties); else return new BlockStateContainer(this, properties); }
@Override public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {AXIS, FRONTBEAM, BACKBEAM, FLOOR, FRONT, RIGHT, BACK, LEFT, FL, FR, BL, BR}); }
@Override public BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] {TOP, BOTTOM, DOUBLE}, new IUnlistedProperty[] {NORTH, EAST, SOUTH, WEST, N_TOP, E_TOP, S_TOP, W_TOP, N_BOTTOM, E_BOTTOM, S_BOTTOM, W_BOTTOM, N_DOUBLE, E_DOUBLE, S_DOUBLE, W_DOUBLE}); }
@Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { if (!(state instanceof IExtendedBlockState)) { return Collections.emptyList(); } IExtendedBlockState extState = (IExtendedBlockState) state; ImmutableMap<IUnlistedProperty<?>,Optional<?>> extProps = extState.getUnlistedProperties(); ImmutableMap<IProperty<?>,Comparable<?>> props = extState.getProperties(); Pair<ImmutableMap<IProperty<?>,Comparable<?>>, ImmutableMap<IUnlistedProperty<?>,Optional<?>>> pair = Pair.of(props, extProps); if (this.cache.containsKey(pair)) { return this.cache.get(pair); } List<BakedQuad> result = this.getAllQuads(state, side, rand); this.cache.put(pair, result); return result; }
@Override protected final BlockStateContainer createBlockState() { InfinityProperty[] propertyArray = this.getPropertyArray(); IProperty[] properties = new IProperty[propertyArray.length]; for(int i = 0; i < properties.length; i++) { properties[i] = propertyArray[i].getProperty(); } IUnlistedProperty[] uprops = getUnlistedPropertyArray(); if (uprops.length < 1) { return new BlockStateContainer(this, properties); } else { return new ExtendedBlockState(this, properties, uprops); } }
/******************************************************************************* * 3. Blockstate *******************************************************************************/ @Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{META_PROPERTY, BlockLeaves.FANCY}, new IUnlistedProperty[]{ B3DLoader.B3DFrameProperty.INSTANCE }); }
/******************************************************************************* * 3. Blockstate *******************************************************************************/ @Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{LIT, TOOL}, new IUnlistedProperty[]{}); }
@Override protected BlockStateContainer createBlockState() { IUnlistedProperty[] unlistedProperties = new IUnlistedProperty[]{ NORTH, SOUTH, EAST, WEST, UP, DOWN, FACING }; return new ExtendedBlockState(this, new IProperty[0], unlistedProperties); }
@Override public BlockStateContainer createBlockState() { return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[] { DIRECTION, VARIANT }, new IUnlistedProperty[] { BlockMultipartContainer.PROPERTY_MULTIPART_CONTAINER, OBJModel.OBJProperty.instance } ); }
@Override public IUnlistedProperty[] getUnlistedPropertyArray() { return new IUnlistedProperty[]{ AgriProperties.CROP_PLANT, AgriProperties.GROWTH_STAGE, AgriProperties.CROSS_CROP }; }
@Override public final IUnlistedProperty[] getUnlistedPropertyArray() { List<IUnlistedProperty> list = getUnlistedProperties(); IUnlistedProperty[] props = list.toArray(new IUnlistedProperty[list.size() + 1]); props[props.length - 1] = AgriProperties.CUSTOM_WOOD_TYPE; return props; }
@Override protected BlockStateContainer createBlockState() { // 1.8.9 Hack, crashes otherwise return new ExtendedBlockState(this, new IProperty[] { getPropertyOrientation(), BlockLiquid.LEVEL, Properties.StaticProperty }, new IUnlistedProperty[] { EvalModelState.PROPERTY }); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{ROTATION, BlockPneumaticCraft.DOWN, BlockPneumaticCraft.UP, BlockPneumaticCraft.NORTH, BlockPneumaticCraft.SOUTH, BlockPneumaticCraft.WEST, BlockPneumaticCraft.EAST}, new IUnlistedProperty[]{OBJProperty.INSTANCE}); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] { BlockPneumaticCraft.NORTH, BlockPneumaticCraft.SOUTH, BlockPneumaticCraft.WEST, BlockPneumaticCraft.EAST }, new IUnlistedProperty[] { CAMO_STATE }); }
@Override protected BlockStateContainer createBlockState() { IProperty[] listedProperties = new IProperty[0]; // no listed properties IUnlistedProperty[] unlistedProperties = new IUnlistedProperty[] { DOWN, UP, NORTH, SOUTH, WEST, EAST }; return new ExtendedBlockState(this, listedProperties, unlistedProperties); }
@Override protected BlockStateContainer createBlockState() { return isRotatable() ? new ExtendedBlockState(this, new IProperty[] { ROTATION } , new IUnlistedProperty[] { CAMO_STATE }) : new ExtendedBlockState(this, new IProperty[] { } , new IUnlistedProperty[] { CAMO_STATE }); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, Arrays.copyOf(BlockPressureTube.CONNECTION_PROPERTIES_3, BlockPressureTube.CONNECTION_PROPERTIES_3.length), new IUnlistedProperty[] { CAMO_STATE }); }
@Override public Collection<IUnlistedProperty<?>> getUnlistedNames() { return iebsValue(IExtendedBlockState::getUnlistedNames, Collections.emptyList()); }
@Override public <V> V getValue(IUnlistedProperty<V> property) { return iebsThrow(iebs -> iebs.getValue(property), () -> new IllegalArgumentException("Cannot get unlisted property " + property + " as it does not exist in " + getBlock().getBlockState())); }
@Override public <V> IExtendedBlockState withProperty(IUnlistedProperty<V> property, V value) { return iebsThrow(iebs -> iebs.withProperty(property, value), () -> new IllegalArgumentException("Cannot set unlisted property " + property + " as it does not exist in " + getBlock().getBlockState())); }
@Override public ImmutableMap<IUnlistedProperty<?>, Optional<?>> getUnlistedProperties() { return iebsValue(IExtendedBlockState::getUnlistedProperties, ImmutableMap.of()); }
public IUnlistedProperty<T> asUnlistedProperty() { return this; }
@Override protected BlockStateContainer createBlockState() { IUnlistedProperty[] unlisted = new IUnlistedProperty[] { CONNECTIONS[0], CONNECTIONS[1], CONNECTIONS[2], CONNECTIONS[3], CONNECTIONS[4], CONNECTIONS[5] }; return new ExtendedBlockState(this, new IProperty[] {}, unlisted); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{}, ConnectionsController.PROPS.values().toArray(new IUnlistedProperty[0])); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{HorizontalFacingController.FACING_H}, new IUnlistedProperty[]{IF_TIER}); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] {HorizontalFacingController.FACING_H}, new IUnlistedProperty[] {UNLOCKED_PROPERTY}); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{State.ACTIVE}, new IUnlistedProperty[]{Properties.AnimationProperty}); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] { UP, DOWN, NORTH, SOUTH, EAST, WEST, COLOR }); }
public BlockStateContainer(Block blockIn, IProperty<?>... properties) { this(blockIn, properties, (ImmutableMap < IUnlistedProperty<?>, Optional<? >>)null); }
protected BlockStateContainer.StateImplementation createState(Block p_createState_1_, ImmutableMap < IProperty<?>, Comparable<? >> p_createState_2_, ImmutableMap < IUnlistedProperty<?>, Optional<? >> p_createState_3_) { return new BlockStateContainer.StateImplementation(p_createState_1_, p_createState_2_); }
@Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[] { LEVEL }, FLUID_RENDER_PROPS.toArray(new IUnlistedProperty<?>[0])); }