@Override public BlockState getBlock(BlockVector3 position) { World world = getWorld(); BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); IBlockState mcState = world.getBlockState(pos); BlockType blockType = BlockType.REGISTRY.get(Block.REGISTRY.getNameForObject(mcState.getBlock()).toString()); return blockType.getState(adaptProperties(blockType, mcState.getProperties())); }
@Override protected ModelResourceLocation getModelResourceLocation( IBlockState state ) { return new ModelResourceLocation( this.registryName, this.getPropertyString( state.getProperties() ) ); } }
@Override public int getCurrentMana() { if(world != null) { IBlockState state = world.getBlockState(getPos()); if(state.getProperties().containsKey(BotaniaStateProps.POOL_VARIANT)) return state.getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.CREATIVE ? MAX_MANA : mana; } return 0; }
@Override public @Nonnull ImmutableMap<IProperty<?>, Comparable<?>> getProperties() { return state.getProperties(); }
private static EnumType getVariant(IBlockState bs) { if (bs.getProperties().containsKey(BlockNewLog.VARIANT)) { return bs.getValue(BlockNewLog.VARIANT); } if (bs.getProperties().containsKey(BlockOldLog.VARIANT)) { return bs.getValue(BlockOldLog.VARIANT); } return null; }
public static IProperty getPropertyByName(IBlockState blockState, String propertyName) { for (IProperty property : (ImmutableSet<IProperty<?>>) blockState.getProperties().keySet()) { if (property.getName().equals(propertyName)) return property; } return null; }
@Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { Map<IProperty<?>, Comparable<?>> map = Maps.newLinkedHashMap(state.getProperties()); map.remove(BlockValvePipe.FACING); return new ModelResourceLocation(PIPE_NAME, getPropertyString(map)); } }
@Override protected @Nonnull ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { Map<IProperty<?>, Comparable<?>> map = Maps.<IProperty<?>, Comparable<?>> newLinkedHashMap(state.getProperties()); return new ModelResourceLocation(Block.REGISTRY.getNameForObject(Blocks.LEVER), this.getPropertyString(map)); }
@Override protected @Nonnull ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { Map<IProperty<?>, Comparable<?>> map = Maps.<IProperty<?>, Comparable<?>> newLinkedHashMap(state.getProperties()); map.remove(BlockColored.COLOR); return new ModelResourceLocation(Block.REGISTRY.getNameForObject(ModObject.blockFusedQuartz.getBlockNN()), this.getPropertyString(map)); }
@Override protected @Nonnull ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { Map<IProperty<?>, Comparable<?>> map = Maps.<IProperty<?>, Comparable<?>> newLinkedHashMap(state.getProperties()); map.remove(BlockConduitBundle.OPAQUE); return new ModelResourceLocation(Block.REGISTRY.getNameForObject(state.getBlock()), this.getPropertyString(map)); }
@SuppressWarnings({ "rawtypes" }) public IBlockState getReplacement(final IBlockState original, final Map<IProperty, Comparable> properties) { IBlockState replacement = this.defaultReplacement; replacement = applyProperties(replacement, original.getProperties()); replacement = applyProperties(replacement, properties); return replacement; }
public static EnumFacing getRotation(IBlockState state) { for (IProperty<?> prop : state.getProperties().keySet()) { if ((prop.getName().equals("facing") || prop.getName().equals("rotation")) && prop.getValueClass() == EnumFacing.class) { return (EnumFacing) state.getValue(prop); } } return null; }
@Override public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis) { net.minecraft.block.state.IBlockState state = world.getBlockState(pos); for(net.minecraft.block.properties.IProperty<?> prop : state.getProperties().keySet()) { if(prop == BlockRotatedPillar.AXIS) { world.setBlockState(pos, state.cycleProperty(prop)); return true; } } return false; }
@Override public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis) { net.minecraft.block.state.IBlockState state = world.getBlockState(pos); for (net.minecraft.block.properties.IProperty<?> prop : state.getProperties().keySet()) { if (prop.getName().equals("axis")) { world.setBlockState(pos, state.cycleProperty(prop)); return true; } } return false; }
@Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { if(state.getValue(BlockCustomFlowerPot.CUSTOM)) return LOCATION; LinkedHashMap<IProperty<?>, Comparable<?>> map = Maps.newLinkedHashMap(state.getProperties()); map.remove(BlockCustomFlowerPot.CUSTOM); map.remove(BlockCustomFlowerPot.LEGACY_DATA); return new ModelResourceLocation(state.getBlock().getRegistryName(), this.getPropertyString(map)); } }
@Override @SideOnly(Side.CLIENT) protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return new ModelResourceLocation(assetLocation, getPropertyString(state.getProperties())); } });
@Override @SideOnly(Side.CLIENT) protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return new ModelResourceLocation(assetLocation, getPropertyString(state.getProperties())); } });
public static StateMatcher fromState(IBlockState displayState, boolean strict) { return new StateMatcher(displayState, strict ? ((state) -> state.getBlock() == displayState.getBlock() && state.getProperties().equals(displayState.getProperties())) : ((state) -> state.getBlock() == displayState.getBlock())); }
private ModelResourceLocation getCropResourceLocation(Crop crop, IBlockState state) { Map <IProperty<?>, Comparable<? >> map = Maps.newLinkedHashMap(state.getProperties()); map.remove(HFCrops.CROPS.property); //Remove the base property for rendering purposes return new ModelResourceLocation(crop.getResource().getResourceDomain() + ":crops_" + crop.getResource().getResourcePath(), this.getPropertyString(map)); } }
@Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { String resourceDomain = Block.REGISTRY.getNameForObject(state.getBlock()).getNamespace(); String resourceLocation = "apiculture/alveary_" + type; String propertyString = getPropertyString(state.getProperties()); return new ModelResourceLocation(resourceDomain + ':' + resourceLocation, propertyString); }