net.minecraft.state.StateManager Java Examples

The following examples show how to use net.minecraft.state.StateManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StandardWrenchItem.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
private void use(PlayerEntity player, BlockState state, WorldAccess iWorld, BlockPos pos, ItemStack stack) {
    Block block = state.getBlock();
    if (block instanceof Rotatable) {
        StateManager<Block, BlockState> manager = block.getStateManager();
        Collection<Property<?>> collection = manager.getProperties();
        String string_1 = Registry.BLOCK.getId(block).toString();
        if (!collection.isEmpty()) {
            CompoundTag compoundTag_1 = stack.getOrCreateSubTag("wrenchProp");
            String string_2 = compoundTag_1.getString(string_1);
            Property<?> property = manager.getProperty(string_2);
            if (property == null) {
                property = collection.iterator().next();
            }
            if (property.getName().equals("facing")) {
                BlockState blockState_2 = cycle(state, property, player.isSneaking());
                iWorld.setBlockState(pos, blockState_2, 18);
                stack.damage(2, player, (playerEntity) -> playerEntity.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
            }
        }
    }
}
 
Example #2
Source File: BasicSolarPanelBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    super.appendProperties(stateBuilder);
    stateBuilder.add(FACING);

    stateBuilder.add(FRONT_SIDE_OPTION);
    stateBuilder.add(BACK_SIDE_OPTION);
    stateBuilder.add(RIGHT_SIDE_OPTION);
    stateBuilder.add(LEFT_SIDE_OPTION);
    stateBuilder.add(TOP_SIDE_OPTION);
    stateBuilder.add(BOTTOM_SIDE_OPTION);
}
 
Example #3
Source File: TinyPumpkinBlock.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
	builder.add(HorizontalFacingBlock.FACING);
	
	if (HallowedConfig.TinyPumpkin.waterloggable) {
		builder.add(Properties.WATERLOGGED);
	}
}
 
Example #4
Source File: CoalGeneratorBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    super.appendProperties(stateBuilder);
    stateBuilder.add(FACING);

    stateBuilder.add(FRONT_SIDE_OPTION);
    stateBuilder.add(BACK_SIDE_OPTION);
    stateBuilder.add(RIGHT_SIDE_OPTION);
    stateBuilder.add(LEFT_SIDE_OPTION);
    stateBuilder.add(TOP_SIDE_OPTION);
    stateBuilder.add(BOTTOM_SIDE_OPTION);
}
 
Example #5
Source File: EnergyStorageModuleBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    stateBuilder.add(FACING);

    stateBuilder.add(FRONT_SIDE_OPTION);
    stateBuilder.add(BACK_SIDE_OPTION);
    stateBuilder.add(RIGHT_SIDE_OPTION);
    stateBuilder.add(LEFT_SIDE_OPTION);
    stateBuilder.add(TOP_SIDE_OPTION);
    stateBuilder.add(BOTTOM_SIDE_OPTION);
}
 
Example #6
Source File: RefineryBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    super.appendProperties(stateBuilder);
    stateBuilder.add(FACING);
    stateBuilder.add(FRONT_SIDE_OPTION);
    stateBuilder.add(BACK_SIDE_OPTION);
    stateBuilder.add(RIGHT_SIDE_OPTION);
    stateBuilder.add(LEFT_SIDE_OPTION);
    stateBuilder.add(TOP_SIDE_OPTION);
    stateBuilder.add(BOTTOM_SIDE_OPTION);
}
 
Example #7
Source File: ElectricCompressorBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    stateBuilder.add(FACING);

    stateBuilder.add(FRONT_SIDE_OPTION);
    stateBuilder.add(BACK_SIDE_OPTION);
    stateBuilder.add(RIGHT_SIDE_OPTION);
    stateBuilder.add(LEFT_SIDE_OPTION);
    stateBuilder.add(TOP_SIDE_OPTION);
    stateBuilder.add(BOTTOM_SIDE_OPTION);
}
 
Example #8
Source File: CircuitFabricatorBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    super.appendProperties(stateBuilder);
    stateBuilder.add(FACING);
    stateBuilder.add(FRONT_SIDE_OPTION);
    stateBuilder.add(BACK_SIDE_OPTION);
    stateBuilder.add(RIGHT_SIDE_OPTION);
    stateBuilder.add(LEFT_SIDE_OPTION);
    stateBuilder.add(TOP_SIDE_OPTION);
    stateBuilder.add(BOTTOM_SIDE_OPTION);
}
 
Example #9
Source File: OxygenCollectorBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    stateBuilder.add(FACING);

    stateBuilder.add(FRONT_SIDE_OPTION);
    stateBuilder.add(BACK_SIDE_OPTION);
    stateBuilder.add(RIGHT_SIDE_OPTION);
    stateBuilder.add(LEFT_SIDE_OPTION);
    stateBuilder.add(TOP_SIDE_OPTION);
    stateBuilder.add(BOTTOM_SIDE_OPTION);
}
 
Example #10
Source File: HallowedTreasureChestBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> factory) {
	factory.add(FACING);
}
 
Example #11
Source File: CrudeOilFluid.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Fluid, FluidState> stateBuilder) {
    super.appendProperties(stateBuilder);
    stateBuilder.add(LEVEL);
}
 
Example #12
Source File: WitchWaterBubbleColumnBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateFactory$Builder_1) {
	stateFactory$Builder_1.add(DRAG);
}
 
Example #13
Source File: HallowedGateBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
	builder.add(FACING);
}
 
Example #14
Source File: TombstoneBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
	builder.add(HorizontalFacingBlock.FACING);
	builder.add(Properties.AGE_1);
}
 
Example #15
Source File: Protocol_1_12_2.java    From multiconnect with MIT License 4 votes vote down vote up
@SuppressWarnings("unchecked")
private static <T extends Comparable<T>> BlockState addProperty(StateManager<Block, BlockState> stateManager, BlockState state, String propName, String valName) {
    Property<T> prop = (Property<T>) stateManager.getProperty(propName);
    return prop == null ? state : state.with(prop, prop.parse(valName).orElseGet(() -> state.get(prop)));
}
 
Example #16
Source File: BlockWrapper.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<net.minecraft.block.Block, BlockState> stateFactory$Builder_1) {
    super.appendProperties(stateFactory$Builder_1);
    if (block instanceof BaseBlock)
        ((BaseBlock) block).appendProperties(((SandboxInternal.StateFactoryBuilder) stateFactory$Builder_1).getSboxBuilder());
}
 
Example #17
Source File: PumpkinPieBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateFactoryBuilder) {
	stateFactoryBuilder.add(BITES);
}
 
Example #18
Source File: RestlessCactusBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
	builder.add(AGE);
}
 
Example #19
Source File: BlockWrapper.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<net.minecraft.block.Block, BlockState> stateFactory$Builder_1) {
    super.appendProperties(stateFactory$Builder_1);
    if (block instanceof org.sandboxpowered.sandbox.api.block.FluidBlock)
        ((BaseBlock) block).appendProperties(((SandboxInternal.StateFactoryBuilder) stateFactory$Builder_1).getSboxBuilder());
}
 
Example #20
Source File: FluidWrapper.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<net.minecraft.fluid.Fluid, FluidState> stateFactory$Builder_1) {
    super.appendProperties(stateFactory$Builder_1);
    if (fluid != null)
        fluid.appendProperties(((SandboxInternal.StateFactoryBuilder) stateFactory$Builder_1).getSboxBuilder());
}
 
Example #21
Source File: BloodFluid.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Fluid, FluidState> stateBuilder) {
	super.appendProperties(stateBuilder);
	stateBuilder.add(LEVEL);
}
 
Example #22
Source File: WitchWaterFluid.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Fluid, FluidState> stateBuilder) {
	super.appendProperties(stateBuilder);
	stateBuilder.add(LEVEL);
}
 
Example #23
Source File: FuelFluid.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Fluid, FluidState> stateBuilder) {
    super.appendProperties(stateBuilder);
    stateBuilder.add(LEVEL);
}
 
Example #24
Source File: AbstractDirectionalBlock.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
    super.appendProperties(builder);
    builder.add(FACING);
}
 
Example #25
Source File: Walkway.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    stateBuilder.add(NORTH, EAST, WEST, SOUTH, FLUID, FlowableFluid.LEVEL);
}
 
Example #26
Source File: AluminumWireBlock.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> StateManager$Builder_1) {
    super.appendProperties(StateManager$Builder_1);
    StateManager$Builder_1.add(ATTACHED_NORTH, ATTACHED_EAST, ATTACHED_SOUTH, ATTACHED_WEST, ATTACHED_UP, ATTACHED_DOWN);
}
 
Example #27
Source File: FluidPipeBlock.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
    super.appendProperties(builder);
    builder.add(PULL, COLOR, ATTACHED_NORTH, ATTACHED_EAST, ATTACHED_SOUTH, ATTACHED_WEST, ATTACHED_UP, ATTACHED_DOWN);
}
 
Example #28
Source File: MoonCheeseBlock.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
    super.appendProperties(builder);
    builder.add(WATERLOGGED);
}
 
Example #29
Source File: GratingBlock.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
    super.appendProperties(builder);
    builder.add(FLUID).add(GRATING_STATE).add(FlowableFluid.LEVEL);
}
 
Example #30
Source File: MoonBerryBushBlock.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
@Override
public void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
    stateBuilder.add(AGE);
}