Rename controller specific stuff to network in wireless

This commit is contained in:
raoulvdberge
2017-07-18 13:52:31 +02:00
parent 99c6205cfd
commit 40d71e8e64
10 changed files with 58 additions and 56 deletions

View File

@@ -112,7 +112,7 @@ public interface IRSAPI {
@Nonnull
IWirelessGridRegistry getWirelessGridRegistry();
void openWirelessGrid(EntityPlayer player, EnumHand hand, int controllerDimension, int id);
void openWirelessGrid(EntityPlayer player, EnumHand hand, int networkDimension, int id);
/**
* Notifies the neighbors of a node that there is a node placed at the given position.

View File

@@ -8,5 +8,5 @@ import javax.annotation.Nonnull;
public interface IWirelessGridFactory {
@Nonnull
IGrid create(EntityPlayer player, EnumHand hand, int controllerDimension);
IGrid create(EntityPlayer player, EnumHand hand, int networkDimension);
}

View File

@@ -187,8 +187,8 @@ public class API implements IRSAPI {
}
@Override
public void openWirelessGrid(EntityPlayer player, EnumHand hand, int controllerDimension, int id) {
player.openGui(RS.INSTANCE, RSGui.WIRELESS_GRID, player.getEntityWorld(), hand.ordinal(), controllerDimension, id);
public void openWirelessGrid(EntityPlayer player, EnumHand hand, int networkDimension, int id) {
player.openGui(RS.INSTANCE, RSGui.WIRELESS_GRID, player.getEntityWorld(), hand.ordinal(), networkDimension, id);
}
@Override

View File

@@ -11,7 +11,7 @@ import javax.annotation.Nonnull;
public class WirelessGridFactoryPortableGrid implements IWirelessGridFactory {
@Nonnull
@Override
public IGrid create(EntityPlayer player, EnumHand hand, int controllerDimension) {
public IGrid create(EntityPlayer player, EnumHand hand, int networkDimension) {
return new PortableGrid(player, player.getHeldItem(hand));
}
}

View File

@@ -11,7 +11,7 @@ import javax.annotation.Nonnull;
public class WirelessGridFactoryWirelessFluidGrid implements IWirelessGridFactory {
@Nonnull
@Override
public IGrid create(EntityPlayer player, EnumHand hand, int controllerDimension) {
return new WirelessFluidGrid(controllerDimension, player.getHeldItem(hand));
public IGrid create(EntityPlayer player, EnumHand hand, int networkDimension) {
return new WirelessFluidGrid(networkDimension, player.getHeldItem(hand));
}
}

View File

@@ -11,7 +11,7 @@ import javax.annotation.Nonnull;
public class WirelessGridFactoryWirelessGrid implements IWirelessGridFactory {
@Nonnull
@Override
public IGrid create(EntityPlayer player, EnumHand hand, int controllerDimension) {
return new WirelessGrid(controllerDimension, player.getHeldItem(hand));
public IGrid create(EntityPlayer player, EnumHand hand, int networkDimension) {
return new WirelessGrid(networkDimension, player.getHeldItem(hand));
}
}

View File

@@ -157,34 +157,34 @@ public class GuiHandler implements IGuiHandler {
}
}
private IGrid getGrid(EntityPlayer player, int hand, int controllerDimension, int id) {
return API.instance().getWirelessGridRegistry().get(id).create(player, EnumHand.values()[hand], controllerDimension);
private IGrid getGrid(EntityPlayer player, int hand, int networkDimension, int id) {
return API.instance().getWirelessGridRegistry().get(id).create(player, EnumHand.values()[hand], networkDimension);
}
private GuiGrid getGridGui(EntityPlayer player, int hand, int controllerDimension, int id) {
IGrid grid = getGrid(player, hand, controllerDimension, id);
private GuiGrid getGridGui(EntityPlayer player, int hand, int networkDimension, int id) {
IGrid grid = getGrid(player, hand, networkDimension, id);
GuiGrid gui = new GuiGrid(null, grid);
gui.inventorySlots = new ContainerGrid(grid, gui, null, player);
return gui;
}
private ContainerGrid getGridContainer(EntityPlayer player, int hand, int controllerDimension, int id) {
return new ContainerGrid(getGrid(player, hand, controllerDimension, id), new GridDisplayDummy(), null, player);
private ContainerGrid getGridContainer(EntityPlayer player, int hand, int networkDimension, int id) {
return new ContainerGrid(getGrid(player, hand, networkDimension, id), new GridDisplayDummy(), null, player);
}
private WirelessCraftingMonitor getCraftingMonitor(EntityPlayer player, int hand, int controllerDimension) {
return new WirelessCraftingMonitor(controllerDimension, player.getHeldItem(EnumHand.values()[hand]));
private WirelessCraftingMonitor getCraftingMonitor(EntityPlayer player, int hand, int networkDimension) {
return new WirelessCraftingMonitor(networkDimension, player.getHeldItem(EnumHand.values()[hand]));
}
private GuiCraftingMonitor getCraftingMonitorGui(EntityPlayer player, int hand, int controllerDimension) {
WirelessCraftingMonitor craftingMonitor = getCraftingMonitor(player, hand, controllerDimension);
private GuiCraftingMonitor getCraftingMonitorGui(EntityPlayer player, int hand, int networkDimension) {
WirelessCraftingMonitor craftingMonitor = getCraftingMonitor(player, hand, networkDimension);
return new GuiCraftingMonitor(new ContainerCraftingMonitor(craftingMonitor, null, player), craftingMonitor);
}
private ContainerCraftingMonitor getCraftingMonitorContainer(EntityPlayer player, int hand, int controllerDimension) {
return new ContainerCraftingMonitor(getCraftingMonitor(player, hand, controllerDimension), null, player);
private ContainerCraftingMonitor getCraftingMonitorContainer(EntityPlayer player, int hand, int networkDimension) {
return new ContainerCraftingMonitor(getCraftingMonitor(player, hand, networkDimension), null, player);
}
private ContainerFilter getFilterContainer(EntityPlayer player, int hand) {

View File

@@ -2,12 +2,12 @@ package com.raoulvdberge.refinedstorage.tile.craftingmonitor;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask;
import com.raoulvdberge.refinedstorage.api.network.INetwork;
import com.raoulvdberge.refinedstorage.api.util.IFilter;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
import com.raoulvdberge.refinedstorage.item.ItemWirelessCraftingMonitor;
import com.raoulvdberge.refinedstorage.network.MessageWirelessCraftingMonitorViewAutomated;
import com.raoulvdberge.refinedstorage.tile.TileController;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
import com.raoulvdberge.refinedstorage.util.StackUtils;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -24,8 +24,10 @@ import java.util.List;
public class WirelessCraftingMonitor implements ICraftingMonitor {
private ItemStack stack;
private int controllerDimension;
private BlockPos controller;
private int networkDimension;
private BlockPos network;
private boolean viewAutomated;
private List<IFilter> filters = new ArrayList<>();
@@ -40,18 +42,18 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
StackUtils.writeItems(this, 0, stack.getTagCompound());
TileController controller = getController();
INetwork network = getNetwork();
if (controller != null) {
controller.sendCraftingMonitorUpdate();
if (network != null) {
network.sendCraftingMonitorUpdate();
}
}
};
public WirelessCraftingMonitor(int controllerDimension, ItemStack stack) {
public WirelessCraftingMonitor(int networkDimension, ItemStack stack) {
this.stack = stack;
this.controllerDimension = controllerDimension;
this.controller = new BlockPos(ItemWirelessCraftingMonitor.getX(stack), ItemWirelessCraftingMonitor.getY(stack), ItemWirelessCraftingMonitor.getZ(stack));
this.networkDimension = networkDimension;
this.network = new BlockPos(ItemWirelessCraftingMonitor.getX(stack), ItemWirelessCraftingMonitor.getY(stack), ItemWirelessCraftingMonitor.getZ(stack));
this.viewAutomated = ItemWirelessCraftingMonitor.canViewAutomated(stack);
if (stack.hasTagCompound()) {
@@ -66,10 +68,10 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
@Override
public void onCancelled(EntityPlayerMP player, int id) {
TileController controller = getController();
INetwork network = getNetwork();
if (controller != null) {
controller.getItemGridHandler().onCraftingCancelRequested(player, id);
if (network != null) {
network.getItemGridHandler().onCraftingCancelRequested(player, id);
}
}
@@ -80,15 +82,15 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
@Override
public BlockPos getNetworkPosition() {
return controller;
return network;
}
@Override
public List<ICraftingTask> getTasks() {
TileController controller = getController();
INetwork network = getNetwork();
if (controller != null) {
return controller.getCraftingManager().getTasks();
if (network != null) {
return network.getCraftingManager().getTasks();
}
return Collections.emptyList();
@@ -116,13 +118,13 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
this.viewAutomated = viewAutomated;
}
private TileController getController() {
World world = DimensionManager.getWorld(controllerDimension);
private INetwork getNetwork() {
World world = DimensionManager.getWorld(networkDimension);
if (world != null) {
TileEntity tile = world.getTileEntity(controller);
TileEntity tile = world.getTileEntity(network);
return tile instanceof TileController ? (TileController) tile : null;
return tile instanceof INetwork ? (INetwork) tile : null;
}
return null;

View File

@@ -29,17 +29,17 @@ public class WirelessFluidGrid implements IGrid {
private ItemStack stack;
private int controllerDimension;
private BlockPos controller;
private int networkDimension;
private BlockPos network;
private int sortingType;
private int sortingDirection;
private int searchBoxMode;
private int size;
public WirelessFluidGrid(int controllerDimension, ItemStack stack) {
this.controllerDimension = controllerDimension;
this.controller = new BlockPos(ItemWirelessFluidGrid.getX(stack), ItemWirelessFluidGrid.getY(stack), ItemWirelessFluidGrid.getZ(stack));
public WirelessFluidGrid(int networkDimension, ItemStack stack) {
this.networkDimension = networkDimension;
this.network = new BlockPos(ItemWirelessFluidGrid.getX(stack), ItemWirelessFluidGrid.getY(stack), ItemWirelessFluidGrid.getZ(stack));
this.stack = stack;
@@ -61,10 +61,10 @@ public class WirelessFluidGrid implements IGrid {
@Override
@Nullable
public INetwork getNetwork() {
World world = DimensionManager.getWorld(controllerDimension);
World world = DimensionManager.getWorld(networkDimension);
if (world != null) {
TileEntity tile = world.getTileEntity(controller);
TileEntity tile = world.getTileEntity(network);
return tile instanceof INetwork ? (INetwork) tile : null;
}

View File

@@ -30,10 +30,10 @@ import java.util.List;
public class WirelessGrid implements IGrid {
public static int ID;
protected ItemStack stack;
private ItemStack stack;
protected int controllerDimension;
private BlockPos controller;
private int networkDimension;
private BlockPos network;
private int viewType;
private int sortingType;
@@ -57,9 +57,9 @@ public class WirelessGrid implements IGrid {
}
};
public WirelessGrid(int controllerDimension, ItemStack stack) {
this.controllerDimension = controllerDimension;
this.controller = new BlockPos(ItemWirelessGrid.getX(stack), ItemWirelessGrid.getY(stack), ItemWirelessGrid.getZ(stack));
public WirelessGrid(int networkDimension, ItemStack stack) {
this.networkDimension = networkDimension;
this.network = new BlockPos(ItemWirelessGrid.getX(stack), ItemWirelessGrid.getY(stack), ItemWirelessGrid.getZ(stack));
this.stack = stack;
@@ -87,10 +87,10 @@ public class WirelessGrid implements IGrid {
@Override
@Nullable
public INetwork getNetwork() {
World world = DimensionManager.getWorld(controllerDimension);
World world = DimensionManager.getWorld(networkDimension);
if (world != null) {
TileEntity tile = world.getTileEntity(controller);
TileEntity tile = world.getTileEntity(network);
return tile instanceof INetwork ? (INetwork) tile : null;
}