Make wireless transmitter have a torch like model

This commit is contained in:
Raoul Van den Berge
2016-07-08 21:54:57 +02:00
parent 04861e41a8
commit b73a90dbf8
6 changed files with 53 additions and 42 deletions

View File

@@ -13,7 +13,7 @@ import refinedstorage.api.network.INetworkNode;
import refinedstorage.tile.TileCable;
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 EAST = PropertyBool.create("east");

View File

@@ -1,18 +1,25 @@
package refinedstorage.block;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import refinedstorage.RefinedStorage;
import refinedstorage.RefinedStorageGui;
import refinedstorage.tile.TileWirelessTransmitter;
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() {
super("wireless_transmitter");
}
@@ -31,7 +38,45 @@ public class BlockWirelessTransmitter extends BlockNode {
return true;
}
public boolean hasConnectivityState() {
return true;
@Override
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;
}
}

View File

@@ -1,53 +1,19 @@
{
"forge_marker": 1,
"defaults": {
"model": "orientable",
"model": "torch",
"textures": {
"side": "refinedstorage:blocks/side",
"top": "refinedstorage:blocks/side"
"torch": "refinedstorage:blocks/wireless_transmitter"
}
},
"variants": {
"inventory": [
{
"textures": {
"front": "refinedstorage:blocks/wireless_transmitter_disconnected"
},
"transform": "forge:default-block",
"y": 0
"transform": "forge:default-block"
}
],
"connected": {
"true": {
"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
}
"normal": {
"model": "torch"
}
}
}

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