diff --git a/src/api/java/appeng/api/definitions/BlockIds.java b/src/api/java/appeng/api/definitions/BlockIds.java deleted file mode 100644 index 09e79445e..000000000 --- a/src/api/java/appeng/api/definitions/BlockIds.java +++ /dev/null @@ -1,109 +0,0 @@ -package appeng.api.definitions; - -import net.minecraft.util.ResourceLocation; -import static appeng.api.definitions.IdHelper.id; - -public final class BlockIds { - - private BlockIds() { - } - - /* - * world gen - */ - public static final ResourceLocation QUARTZ_ORE = id("quartz_ore"); - public static final ResourceLocation QUARTZ_ORE_CHARGED = id("charged_quartz_ore"); - public static final ResourceLocation MATRIX_FRAME = id("matrix_frame"); - - /* - * decorative - */ - public static final ResourceLocation QUARTZ_BLOCK = id("quartz_block"); - public static final ResourceLocation QUARTZ_PILLAR = id("quartz_pillar"); - public static final ResourceLocation CHISELED_QUARTZ_BLOCK = id("chiseled_quartz_block"); - public static final ResourceLocation QUARTZ_GLASS = id("quartz_glass"); - public static final ResourceLocation QUARTZ_VIBRANT_GLASS = id("quartz_vibrant_glass"); - public static final ResourceLocation QUARTZ_FIXTURE = id("quartz_fixture"); - public static final ResourceLocation FLUIX_BLOCK = id("fluix_block"); - public static final ResourceLocation SKY_STONE_BLOCK = id("sky_stone_block"); - public static final ResourceLocation SMOOTH_SKY_STONE_BLOCK = id("smooth_sky_stone_block"); - public static final ResourceLocation SKY_STONE_BRICK = id("sky_stone_brick"); - public static final ResourceLocation SKY_STONE_SMALL_BRICK = id("sky_stone_small_brick"); - public static final ResourceLocation SKY_STONE_CHEST = id("sky_stone_chest"); - public static final ResourceLocation SMOOTH_SKY_STONE_CHEST = id("smooth_sky_stone_chest"); - public static final ResourceLocation SKY_COMPASS = id("sky_compass"); - public static final ResourceLocation SKY_STONE_STAIRS = id("sky_stone_stairs"); - public static final ResourceLocation SMOOTH_SKY_STONE_STAIRS = id("smooth_sky_stone_stairs"); - public static final ResourceLocation SKY_STONE_BRICK_STAIRS = id("sky_stone_brick_stairs"); - public static final ResourceLocation SKY_STONE_SMALL_BRICK_STAIRS = id("sky_stone_small_brick_stairs"); - public static final ResourceLocation FLUIX_STAIRS = id("fluix_stairs"); - public static final ResourceLocation QUARTZ_STAIRS = id("quartz_stairs"); - public static final ResourceLocation CHISELED_QUARTZ_STAIRS = id("chiseled_quartz_stairs"); - public static final ResourceLocation QUARTZ_PILLAR_STAIRS = id("quartz_pillar_stairs"); - public static final ResourceLocation SKY_STONE_SLAB = id("sky_stone_slab"); - public static final ResourceLocation SMOOTH_SKY_STONE_SLAB = id("smooth_sky_stone_slab"); - public static final ResourceLocation SKY_STONE_BRICK_SLAB = id("sky_stone_brick_slab"); - public static final ResourceLocation SKY_STONE_SMALL_BRICK_SLAB = id("sky_stone_small_brick_slab"); - public static final ResourceLocation FLUIX_SLAB = id("fluix_slab"); - public static final ResourceLocation QUARTZ_SLAB = id("quartz_slab"); - public static final ResourceLocation CHISELED_QUARTZ_SLAB = id("chiseled_quartz_slab"); - public static final ResourceLocation QUARTZ_PILLAR_SLAB = id("quartz_pillar_slab"); - - /* - * misc - */ - public static final ResourceLocation GRINDSTONE = id("grindstone"); - public static final ResourceLocation CRANK = id("crank"); - public static final ResourceLocation INSCRIBER = id("inscriber"); - public static final ResourceLocation WIRELESS_ACCESS_POINT = id("wireless_access_point"); - public static final ResourceLocation CHARGER = id("charger"); - public static final ResourceLocation TINY_TNT = id("tiny_tnt"); - public static final ResourceLocation SECURITY_STATION = id("security_station"); - - /* - * quantum Network Bridge - */ - public static final ResourceLocation QUANTUM_RING = id("quantum_ring"); - public static final ResourceLocation QUANTUM_LINK = id("quantum_link"); - - /* - * spatial iO - */ - public static final ResourceLocation SPATIAL_PYLON = id("spatial_pylon"); - public static final ResourceLocation SPATIAL_IO_PORT = id("spatial_io_port"); - - /* - * Bus / cables - */ - public static final ResourceLocation MULTI_PART = id("cable_bus"); - - /* - * machines - */ - public static final ResourceLocation CONTROLLER = id("controller"); - public static final ResourceLocation DRIVE = id("drive"); - public static final ResourceLocation CHEST = id("chest"); - public static final ResourceLocation IFACE = id("interface"); - public static final ResourceLocation FLUID_IFACE = id("fluid_interface"); - public static final ResourceLocation CELL_WORKBENCH = id("cell_workbench"); - public static final ResourceLocation IO_PORT = id("io_port"); - public static final ResourceLocation CONDENSER = id("condenser"); - public static final ResourceLocation ENERGY_ACCEPTOR = id("energy_acceptor"); - public static final ResourceLocation VIBRATION_CHAMBER = id("vibration_chamber"); - public static final ResourceLocation QUARTZ_GROWTH_ACCELERATOR = id("quartz_growth_accelerator"); - public static final ResourceLocation ENERGY_CELL = id("energy_cell"); - public static final ResourceLocation ENERGY_CELL_DENSE = id("dense_energy_cell"); - public static final ResourceLocation ENERGY_CELL_CREATIVE = id("creative_energy_cell"); - - // rv1 - public static final ResourceLocation CRAFTING_UNIT = id("crafting_unit"); - public static final ResourceLocation CRAFTING_ACCELERATOR = id("crafting_accelerator"); - public static final ResourceLocation CRAFTING_STORAGE1K = id("crafting_storage_1k"); - public static final ResourceLocation CRAFTING_STORAGE4K = id("crafting_storage_4k"); - public static final ResourceLocation CRAFTING_STORAGE16K = id("crafting_storage_16k"); - public static final ResourceLocation CRAFTING_STORAGE64K = id("crafting_storage_64k"); - public static final ResourceLocation CRAFTING_MONITOR = id("crafting_monitor"); - public static final ResourceLocation MOLECULAR_ASSEMBLER = id("molecular_assembler"); - public static final ResourceLocation LIGHT_DETECTOR = id("light_detector"); - public static final ResourceLocation PAINT = id("paint"); -} diff --git a/src/main/java/appeng/block/misc/BlockLightDetector.java b/src/main/java/appeng/block/misc/BlockLightDetector.java index 0e1c598a5..a15f137ca 100644 --- a/src/main/java/appeng/block/misc/BlockLightDetector.java +++ b/src/main/java/appeng/block/misc/BlockLightDetector.java @@ -28,8 +28,8 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; import net.minecraft.state.BooleanProperty; -import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -47,9 +47,6 @@ import java.util.Random; public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock { - // Cannot use the vanilla FACING property here because it excludes facing DOWN - public static final DirectionProperty FACING = DirectionProperty.create( "facing" ); - // Used to alternate between two variants of the fixture on adjacent blocks public static final BooleanProperty ODD = BooleanProperty.create( "odd" ); @@ -57,13 +54,13 @@ public class BlockLightDetector extends AEBaseTileBlock imple { super( Properties.create(Material.MISCELLANEOUS).notSolid() ); - this.setDefaultState( this.getDefaultState().with( FACING, Direction.UP ).with( ODD, false ) ); + this.setDefaultState( this.getDefaultState().with(BlockStateProperties.FACING, Direction.UP ).with( ODD, false ) ); } @Override protected void fillStateContainer(StateContainer.Builder builder) { super.fillStateContainer(builder); - builder.add(FACING); + builder.add(BlockStateProperties.FACING); builder.add(ODD); } @@ -112,6 +109,8 @@ public class BlockLightDetector extends AEBaseTileBlock imple @Override public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) { + // FIXME: We should / rather MUST use state here because at startup, this gets called without a world + final Direction up = this.getOrientable( w, pos ).getUp(); final double xOff = -0.3 * up.getXOffset(); final double yOff = -0.3 * up.getYOffset(); @@ -157,7 +156,7 @@ public class BlockLightDetector extends AEBaseTileBlock imple @Override public IOrientable getOrientable( final IBlockReader w, final BlockPos pos ) { - return new MetaRotation( w, pos, FACING ); + return new MetaRotation( w, pos, BlockStateProperties.FACING ); } } diff --git a/src/main/java/appeng/core/api/definitions/ApiBlocks.java b/src/main/java/appeng/core/api/definitions/ApiBlocks.java index 9bdd17f5b..223490e44 100644 --- a/src/main/java/appeng/core/api/definitions/ApiBlocks.java +++ b/src/main/java/appeng/core/api/definitions/ApiBlocks.java @@ -324,14 +324,16 @@ public final class ApiBlocks implements IBlocks .tileEntity( registry.tileEntity("security_station", TileSecurityStation.class, TileSecurityStation::new).build() ) .rendering( new SecurityStationRendering() ) .build(); + + TileEntityDefinition quantumRingTile = registry.tileEntity("quantum_ring", TileQuantumBridge.class, TileQuantumBridge::new).build(); this.quantumRing = registry.block( "quantum_ring", BlockQuantumRing::new ) .features( AEFeature.QUANTUM_NETWORK_BRIDGE ) - .tileEntity( registry.tileEntity( "quantum_ring", TileQuantumBridge.class, TileQuantumBridge::new ).build() ) + .tileEntity( quantumRingTile ) .rendering( new QuantumBridgeRendering() ) .build(); this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new ) .features( AEFeature.QUANTUM_NETWORK_BRIDGE ) - .tileEntity( registry.tileEntity( "quantum_ring", TileQuantumBridge.class, TileQuantumBridge::new ).build() ) + .tileEntity( quantumRingTile ) .rendering( new QuantumBridgeRendering() ) .build(); this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new ) diff --git a/src/main/java/appeng/helpers/MetaRotation.java b/src/main/java/appeng/helpers/MetaRotation.java index 9c10aa89e..3b3ec9ede 100644 --- a/src/main/java/appeng/helpers/MetaRotation.java +++ b/src/main/java/appeng/helpers/MetaRotation.java @@ -66,29 +66,26 @@ public class MetaRotation implements IOrientable { final BlockState state = this.w.getBlockState( this.pos ); - if( this.facingProp != null ) + if( this.facingProp != null && state.has(this.facingProp) ) { return state.get( this.facingProp ); } // TODO 1.10.2-R - Temp - Axis a = state.get( BlockQuartzPillar.AXIS ); - - if( a == null ) - { - a = Axis.Y; + if (state.has(BlockQuartzPillar.AXIS)) { + Axis a = state.get(BlockQuartzPillar.AXIS); + switch (a) { + case X: + return Direction.EAST; + case Z: + return Direction.SOUTH; + default: + case Y: + return Direction.UP; + } } - switch( a ) - { - case X: - return Direction.EAST; - case Z: - return Direction.SOUTH; - default: - case Y: - return Direction.UP; - } + return Direction.UP; } @Override