Make wireless transmitter have a torch like model
This commit is contained in:
@@ -13,7 +13,7 @@ import refinedstorage.api.network.INetworkNode;
|
|||||||
import refinedstorage.tile.TileCable;
|
import refinedstorage.tile.TileCable;
|
||||||
|
|
||||||
public class BlockCable extends BlockNode {
|
public class BlockCable extends BlockNode {
|
||||||
public static final AxisAlignedBB CABLE_AABB = new AxisAlignedBB(4 * (1F / 16F), 4 * (1F / 16F), 4 * (1F / 16F), 1 - 4 * (1F / 16F), 1 - 4 * (1F / 16F), 1 - 4 * (1F / 16F));
|
private static final AxisAlignedBB CABLE_AABB = new AxisAlignedBB(4 * (1F / 16F), 4 * (1F / 16F), 4 * (1F / 16F), 1 - 4 * (1F / 16F), 1 - 4 * (1F / 16F), 1 - 4 * (1F / 16F));
|
||||||
|
|
||||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
public static final PropertyBool NORTH = PropertyBool.create("north");
|
||||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||||
|
|||||||
@@ -1,18 +1,25 @@
|
|||||||
package refinedstorage.block;
|
package refinedstorage.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileWirelessTransmitter;
|
import refinedstorage.tile.TileWirelessTransmitter;
|
||||||
|
|
||||||
public class BlockWirelessTransmitter extends BlockNode {
|
public class BlockWirelessTransmitter extends BlockNode {
|
||||||
|
// From BlockTorch
|
||||||
|
private static final AxisAlignedBB WIRELESS_TRANSMITTER_AABB = new AxisAlignedBB(0.4000000059604645D, 0.0D, 0.4000000059604645D, 0.6000000238418579D, 0.6000000238418579D, 0.6000000238418579D);
|
||||||
|
|
||||||
public BlockWirelessTransmitter() {
|
public BlockWirelessTransmitter() {
|
||||||
super("wireless_transmitter");
|
super("wireless_transmitter");
|
||||||
}
|
}
|
||||||
@@ -31,7 +38,45 @@ public class BlockWirelessTransmitter extends BlockNode {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasConnectivityState() {
|
@Override
|
||||||
return true;
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
|
||||||
|
if (!canPlaceBlockAt(world, pos) && world.getBlockState(pos).getBlock() == this) {
|
||||||
|
dropBlockAsItem(world, pos, state, 0);
|
||||||
|
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
|
return WIRELESS_TRANSMITTER_AABB;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFullCube(IBlockState state) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||||
|
BlockPos downPos = pos.offset(EnumFacing.DOWN);
|
||||||
|
IBlockState down = world.getBlockState(downPos);
|
||||||
|
|
||||||
|
return down.getBlock().canPlaceTorchOnTop(down, world, downPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockRenderLayer getBlockLayer() {
|
||||||
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumPlacementType getPlacementType() {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +1,19 @@
|
|||||||
{
|
{
|
||||||
"forge_marker": 1,
|
"forge_marker": 1,
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"model": "orientable",
|
"model": "torch",
|
||||||
"textures": {
|
"textures": {
|
||||||
"side": "refinedstorage:blocks/side",
|
"torch": "refinedstorage:blocks/wireless_transmitter"
|
||||||
"top": "refinedstorage:blocks/side"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory": [
|
"inventory": [
|
||||||
{
|
{
|
||||||
"textures": {
|
"transform": "forge:default-block"
|
||||||
"front": "refinedstorage:blocks/wireless_transmitter_disconnected"
|
|
||||||
},
|
|
||||||
"transform": "forge:default-block",
|
|
||||||
"y": 0
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"connected": {
|
"normal": {
|
||||||
"true": {
|
"model": "torch"
|
||||||
"textures": {
|
|
||||||
"front": "refinedstorage:blocks/wireless_transmitter_connected"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"false": {
|
|
||||||
"textures": {
|
|
||||||
"front": "refinedstorage:blocks/wireless_transmitter_disconnected"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"north": {
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"east": {
|
|
||||||
"y": 90
|
|
||||||
},
|
|
||||||
"south": {
|
|
||||||
"y": 180
|
|
||||||
},
|
|
||||||
"west": {
|
|
||||||
"y": 270
|
|
||||||
},
|
|
||||||
"up": {
|
|
||||||
"x": 270
|
|
||||||
},
|
|
||||||
"down": {
|
|
||||||
"x": 90
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 328 B |
Binary file not shown.
|
Before Width: | Height: | Size: 647 B |
Binary file not shown.
|
Before Width: | Height: | Size: 623 B |
Reference in New Issue
Block a user