/
BlockFluxCable.java
110 lines (89 loc) · 2.8 KB
/
BlockFluxCable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package net.RPower.RPowermod.machines.power.cable;
import RPower.api.power.block.cable.I_MFCable;
import RPower.api.power.core.E_MFPacketType;
import RPower.api.power.core.MFHelper;
import RPower.api.power.core.MFPacket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFluxCable extends BlockContainer{
public BlockFluxCable(Material p_i45394_1_) {
super(p_i45394_1_);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metaD, float hitX, float hitY, float hitZ)
{
MFPacket temp = new MFPacket(E_MFPacketType.REQUEST);
((TileEntityFluxCable)world.getTileEntity(x, y, z)).takePacket(temp);
System.out.println("This pipe has "+((TileEntityFluxCable)world.getTileEntity(x, y, z)).getConnections().size()+" connections.");
//System.out.println(((TileEntityFluxCable)world.getTileEntity(x, y, z)).toJSON());
return false;
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
int[] origin = {x, y ,z,};
MFHelper.checkConnections(world, origin);
super.onBlockAdded(world, x, y, z);
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
TileEntity cable = new TileEntityFluxCable(32);
return cable;
}
@Override
public boolean isAir(IBlockAccess world, int x, int y, int z) {
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int metaD) {
int[] origin = {x, y ,z,};
MFHelper.breakAllConnections(world, origin);
super.breakBlock(world, x, y, z, block, metaD);
}
@Override
public void onBlockPreDestroy(World world, int x, int y, int z, int metaD) {
int[] origin = {x, y ,z,};
MFHelper.breakAllConnections(world, origin);
super.onBlockPreDestroy(world, x, y, z, metaD);
}
@Override
protected boolean canSilkHarvest() {
return false;
};
@Override
public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata) {
return false;
};
@Override
public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) {
return false;
}
@SideOnly(Side.CLIENT)
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side) {
return false;
};
@SideOnly(Side.CLIENT)
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public int getRenderType() {
return -1;
}
}