Wireless Transmitters can now be placed on any block and in any direction. Fixes #2173
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Refined Storage Changelog
|
||||
|
||||
### 1.8.3
|
||||
- Added a new experimental autocrafting engine that's enabled by default. This should improve autocrafting performance (Darkere)
|
||||
- Wireless Transmitters can now be placed on any block and in any direction (raoulvdberge)
|
||||
|
||||
### 1.8.2
|
||||
- Add Refined Storage silicon to forge:silicon tag for mod compatibility (jeremiahwinsley)
|
||||
- Update pt_br translation (Arthur-o-b)
|
||||
|
@@ -8,28 +8,30 @@ import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.NetworkUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WirelessTransmitterBlock extends NetworkNodeBlock {
|
||||
private static final VoxelShape SHAPE = Block.makeCuboidShape(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D);
|
||||
private static final VoxelShape SHAPE_DOWN = Block.makeCuboidShape(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D);
|
||||
private static final VoxelShape SHAPE_UP = Block.makeCuboidShape(6.0D, 6.0D, 6.0D, 10.0D, 16.0D, 10.0D);
|
||||
private static final VoxelShape SHAPE_EAST = Block.makeCuboidShape(6.0D, 6.0D, 6.0D, 16.0D, 10.0D, 10.0D);
|
||||
private static final VoxelShape SHAPE_WEST = Block.makeCuboidShape(0.0D, 6.0D, 6.0D, 10.0D, 10.0D, 10.0D);
|
||||
private static final VoxelShape SHAPE_NORTH = Block.makeCuboidShape(6.0D, 6.0D, 0.0D, 10.0D, 10.0D, 10.0D);
|
||||
private static final VoxelShape SHAPE_SOUTH = Block.makeCuboidShape(6.0D, 6.0D, 6.0D, 10.0D, 10.0D, 16.0D);
|
||||
|
||||
public WirelessTransmitterBlock() {
|
||||
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
|
||||
@@ -37,6 +39,16 @@ public class WirelessTransmitterBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, "wireless_transmitter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.ANY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
@@ -45,25 +57,23 @@ public class WirelessTransmitterBlock extends NetworkNodeBlock {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) {
|
||||
return world.getBlockState(pos.offset(Direction.DOWN)).getBlock() instanceof CableBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos currentPos, BlockPos facingPos) {
|
||||
return facing == Direction.DOWN && !this.isValidPosition(state, world, currentPos) ? Blocks.AIR.getDefaultState() : super.updatePostPlacement(state, facing, facingState, world, currentPos, facingPos);
|
||||
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) {
|
||||
switch (state.get(getDirection().getProperty())) {
|
||||
case DOWN:
|
||||
return SHAPE_DOWN;
|
||||
case UP:
|
||||
return SHAPE_UP;
|
||||
case NORTH:
|
||||
return SHAPE_NORTH;
|
||||
case SOUTH:
|
||||
return SHAPE_SOUTH;
|
||||
case WEST:
|
||||
return SHAPE_WEST;
|
||||
case EAST:
|
||||
return SHAPE_EAST;
|
||||
default:
|
||||
return VoxelShapes.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,9 +1,53 @@
|
||||
{
|
||||
"variants": {
|
||||
"connected=true": {
|
||||
"connected=true,direction=north": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_connected",
|
||||
"x": 270
|
||||
},
|
||||
"connected=true,direction=east": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_connected",
|
||||
"x": 270,
|
||||
"y": 90
|
||||
},
|
||||
"connected=true,direction=south": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_connected",
|
||||
"x": 90
|
||||
},
|
||||
"connected=true,direction=west": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_connected",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"connected=true,direction=up": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_connected",
|
||||
"x": 180
|
||||
},
|
||||
"connected=true,direction=down": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_connected"
|
||||
},
|
||||
"connected=false": {
|
||||
"connected=false,direction=north": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_disconnected",
|
||||
"x": 270
|
||||
},
|
||||
"connected=false,direction=east": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_disconnected",
|
||||
"x": 270,
|
||||
"y": 90
|
||||
},
|
||||
"connected=false,direction=south": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_disconnected",
|
||||
"x": 90
|
||||
},
|
||||
"connected=false,direction=west": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_disconnected",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"connected=false,direction=up": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_disconnected",
|
||||
"x": 180
|
||||
},
|
||||
"connected=false,direction=down": {
|
||||
"model": "refinedstorage:block/wireless_transmitter_disconnected"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user