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 @Nonnull
IWirelessGridRegistry getWirelessGridRegistry(); 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. * 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 { public interface IWirelessGridFactory {
@Nonnull @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 @Override
public void openWirelessGrid(EntityPlayer player, EnumHand hand, int controllerDimension, int id) { public void openWirelessGrid(EntityPlayer player, EnumHand hand, int networkDimension, int id) {
player.openGui(RS.INSTANCE, RSGui.WIRELESS_GRID, player.getEntityWorld(), hand.ordinal(), controllerDimension, id); player.openGui(RS.INSTANCE, RSGui.WIRELESS_GRID, player.getEntityWorld(), hand.ordinal(), networkDimension, id);
} }
@Override @Override

View File

@@ -11,7 +11,7 @@ import javax.annotation.Nonnull;
public class WirelessGridFactoryPortableGrid implements IWirelessGridFactory { public class WirelessGridFactoryPortableGrid implements IWirelessGridFactory {
@Nonnull @Nonnull
@Override @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)); return new PortableGrid(player, player.getHeldItem(hand));
} }
} }

View File

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

View File

@@ -11,7 +11,7 @@ import javax.annotation.Nonnull;
public class WirelessGridFactoryWirelessGrid implements IWirelessGridFactory { public class WirelessGridFactoryWirelessGrid implements IWirelessGridFactory {
@Nonnull @Nonnull
@Override @Override
public IGrid create(EntityPlayer player, EnumHand hand, int controllerDimension) { public IGrid create(EntityPlayer player, EnumHand hand, int networkDimension) {
return new WirelessGrid(controllerDimension, player.getHeldItem(hand)); 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) { private IGrid getGrid(EntityPlayer player, int hand, int networkDimension, int id) {
return API.instance().getWirelessGridRegistry().get(id).create(player, EnumHand.values()[hand], controllerDimension); return API.instance().getWirelessGridRegistry().get(id).create(player, EnumHand.values()[hand], networkDimension);
} }
private GuiGrid getGridGui(EntityPlayer player, int hand, int controllerDimension, int id) { private GuiGrid getGridGui(EntityPlayer player, int hand, int networkDimension, int id) {
IGrid grid = getGrid(player, hand, controllerDimension, id); IGrid grid = getGrid(player, hand, networkDimension, id);
GuiGrid gui = new GuiGrid(null, grid); GuiGrid gui = new GuiGrid(null, grid);
gui.inventorySlots = new ContainerGrid(grid, gui, null, player); gui.inventorySlots = new ContainerGrid(grid, gui, null, player);
return gui; return gui;
} }
private ContainerGrid getGridContainer(EntityPlayer player, int hand, int controllerDimension, int id) { private ContainerGrid getGridContainer(EntityPlayer player, int hand, int networkDimension, int id) {
return new ContainerGrid(getGrid(player, hand, controllerDimension, id), new GridDisplayDummy(), null, player); return new ContainerGrid(getGrid(player, hand, networkDimension, id), new GridDisplayDummy(), null, player);
} }
private WirelessCraftingMonitor getCraftingMonitor(EntityPlayer player, int hand, int controllerDimension) { private WirelessCraftingMonitor getCraftingMonitor(EntityPlayer player, int hand, int networkDimension) {
return new WirelessCraftingMonitor(controllerDimension, player.getHeldItem(EnumHand.values()[hand])); return new WirelessCraftingMonitor(networkDimension, player.getHeldItem(EnumHand.values()[hand]));
} }
private GuiCraftingMonitor getCraftingMonitorGui(EntityPlayer player, int hand, int controllerDimension) { private GuiCraftingMonitor getCraftingMonitorGui(EntityPlayer player, int hand, int networkDimension) {
WirelessCraftingMonitor craftingMonitor = getCraftingMonitor(player, hand, controllerDimension); WirelessCraftingMonitor craftingMonitor = getCraftingMonitor(player, hand, networkDimension);
return new GuiCraftingMonitor(new ContainerCraftingMonitor(craftingMonitor, null, player), craftingMonitor); return new GuiCraftingMonitor(new ContainerCraftingMonitor(craftingMonitor, null, player), craftingMonitor);
} }
private ContainerCraftingMonitor getCraftingMonitorContainer(EntityPlayer player, int hand, int controllerDimension) { private ContainerCraftingMonitor getCraftingMonitorContainer(EntityPlayer player, int hand, int networkDimension) {
return new ContainerCraftingMonitor(getCraftingMonitor(player, hand, controllerDimension), null, player); return new ContainerCraftingMonitor(getCraftingMonitor(player, hand, networkDimension), null, player);
} }
private ContainerFilter getFilterContainer(EntityPlayer player, int hand) { 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.RS;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTask; 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.api.util.IFilter;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase; import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter; import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
import com.raoulvdberge.refinedstorage.item.ItemWirelessCraftingMonitor; import com.raoulvdberge.refinedstorage.item.ItemWirelessCraftingMonitor;
import com.raoulvdberge.refinedstorage.network.MessageWirelessCraftingMonitorViewAutomated; import com.raoulvdberge.refinedstorage.network.MessageWirelessCraftingMonitorViewAutomated;
import com.raoulvdberge.refinedstorage.tile.TileController;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter; import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
import com.raoulvdberge.refinedstorage.util.StackUtils; import com.raoulvdberge.refinedstorage.util.StackUtils;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
@@ -24,8 +24,10 @@ import java.util.List;
public class WirelessCraftingMonitor implements ICraftingMonitor { public class WirelessCraftingMonitor implements ICraftingMonitor {
private ItemStack stack; private ItemStack stack;
private int controllerDimension;
private BlockPos controller; private int networkDimension;
private BlockPos network;
private boolean viewAutomated; private boolean viewAutomated;
private List<IFilter> filters = new ArrayList<>(); private List<IFilter> filters = new ArrayList<>();
@@ -40,18 +42,18 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
StackUtils.writeItems(this, 0, stack.getTagCompound()); StackUtils.writeItems(this, 0, stack.getTagCompound());
TileController controller = getController(); INetwork network = getNetwork();
if (controller != null) { if (network != null) {
controller.sendCraftingMonitorUpdate(); network.sendCraftingMonitorUpdate();
} }
} }
}; };
public WirelessCraftingMonitor(int controllerDimension, ItemStack stack) { public WirelessCraftingMonitor(int networkDimension, ItemStack stack) {
this.stack = stack; this.stack = stack;
this.controllerDimension = controllerDimension; this.networkDimension = networkDimension;
this.controller = new BlockPos(ItemWirelessCraftingMonitor.getX(stack), ItemWirelessCraftingMonitor.getY(stack), ItemWirelessCraftingMonitor.getZ(stack)); this.network = new BlockPos(ItemWirelessCraftingMonitor.getX(stack), ItemWirelessCraftingMonitor.getY(stack), ItemWirelessCraftingMonitor.getZ(stack));
this.viewAutomated = ItemWirelessCraftingMonitor.canViewAutomated(stack); this.viewAutomated = ItemWirelessCraftingMonitor.canViewAutomated(stack);
if (stack.hasTagCompound()) { if (stack.hasTagCompound()) {
@@ -66,10 +68,10 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
@Override @Override
public void onCancelled(EntityPlayerMP player, int id) { public void onCancelled(EntityPlayerMP player, int id) {
TileController controller = getController(); INetwork network = getNetwork();
if (controller != null) { if (network != null) {
controller.getItemGridHandler().onCraftingCancelRequested(player, id); network.getItemGridHandler().onCraftingCancelRequested(player, id);
} }
} }
@@ -80,15 +82,15 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
@Override @Override
public BlockPos getNetworkPosition() { public BlockPos getNetworkPosition() {
return controller; return network;
} }
@Override @Override
public List<ICraftingTask> getTasks() { public List<ICraftingTask> getTasks() {
TileController controller = getController(); INetwork network = getNetwork();
if (controller != null) { if (network != null) {
return controller.getCraftingManager().getTasks(); return network.getCraftingManager().getTasks();
} }
return Collections.emptyList(); return Collections.emptyList();
@@ -116,13 +118,13 @@ public class WirelessCraftingMonitor implements ICraftingMonitor {
this.viewAutomated = viewAutomated; this.viewAutomated = viewAutomated;
} }
private TileController getController() { private INetwork getNetwork() {
World world = DimensionManager.getWorld(controllerDimension); World world = DimensionManager.getWorld(networkDimension);
if (world != null) { 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; return null;

View File

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

View File

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