use of net.dyeo.teleporter.teleport.TeleporterNetwork in project VanillaTeleporter by dyeo.
the class CommandTeleporters method execute.
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
TeleporterNetwork network = TeleporterNetwork.get(sender.getEntityWorld());
TextComponentString chat = new TextComponentString("--- There are currently " + network.getSubnets().size() + " teleporter networks ---");
chat.getStyle().setColor(TextFormatting.DARK_GREEN);
sender.sendMessage(chat);
Iterator<String> it = network.getSubnets().iterator();
while (it.hasNext()) {
String s = it.next();
chat = new TextComponentString("(" + network.getSubnetSize(s) + ") " + s);
sender.sendMessage(chat);
}
}
use of net.dyeo.teleporter.teleport.TeleporterNetwork in project VanillaTeleporter by dyeo.
the class TileEntityTeleporter method update.
@Override
public void update() {
if (!this.world.isRemote) {
TeleporterNetwork netWrapper = TeleporterNetwork.get(this.world);
int tileDim = this.world.provider.getDimension();
TeleporterNode thisNode = netWrapper.getNode(this.pos, tileDim);
if (thisNode == null) {
thisNode = new TeleporterNode();
thisNode.pos = this.pos;
thisNode.dimension = tileDim;
thisNode.type = this.getWorld().getBlockState(this.pos).getValue(BlockTeleporter.TYPE);
thisNode.key = TeleporterNetwork.getItemKey(getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).getStackInSlot(0));
netWrapper.addNode(thisNode);
this.markDirty();
netWrapper.markDirty();
} else {
netWrapper.updateNode(thisNode);
}
}
}
use of net.dyeo.teleporter.teleport.TeleporterNetwork in project VanillaTeleporter by dyeo.
the class TileEntityTeleporter method removeFromNetwork.
public void removeFromNetwork() {
TeleporterNetwork netWrapper = TeleporterNetwork.get(this.world);
ItemStack key = getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).getStackInSlot(0);
netWrapper.removeNode(this.pos, this.world.provider.getDimension(), key);
}
Aggregations