Re-add the Wireless Transmitter
This commit is contained in:
@@ -56,6 +56,7 @@ public class ClientSetup {
|
|||||||
new ResourceLocation(RS.ID, "block/security_manager/cutouts/back_connected"),
|
new ResourceLocation(RS.ID, "block/security_manager/cutouts/back_connected"),
|
||||||
new ResourceLocation(RS.ID, "block/security_manager/cutouts/right_connected")
|
new ResourceLocation(RS.ID, "block/security_manager/cutouts/right_connected")
|
||||||
));
|
));
|
||||||
|
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "wireless_transmitter"), (base, registry) -> new FullbrightBakedModel(base, new ResourceLocation(RS.ID, "block/wireless_transmitter/cutouts/connected")));
|
||||||
|
|
||||||
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "disk_drive"), (base, registry) -> new FullbrightBakedModel(
|
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "disk_drive"), (base, registry) -> new FullbrightBakedModel(
|
||||||
new DiskDriveBakedModel(
|
new DiskDriveBakedModel(
|
||||||
@@ -124,6 +125,7 @@ public class ClientSetup {
|
|||||||
ScreenManager.registerFactory(RSContainers.SECURITY_MANAGER, SecurityManagerScreen::new);
|
ScreenManager.registerFactory(RSContainers.SECURITY_MANAGER, SecurityManagerScreen::new);
|
||||||
ScreenManager.registerFactory(RSContainers.INTERFACE, InterfaceScreen::new);
|
ScreenManager.registerFactory(RSContainers.INTERFACE, InterfaceScreen::new);
|
||||||
ScreenManager.registerFactory(RSContainers.FLUID_INTERFACE, FluidInterfaceScreen::new);
|
ScreenManager.registerFactory(RSContainers.FLUID_INTERFACE, FluidInterfaceScreen::new);
|
||||||
|
ScreenManager.registerFactory(RSContainers.WIRELESS_TRANSMITTER, WirelessTransmitterScreen::new);
|
||||||
|
|
||||||
ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR);
|
ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR);
|
||||||
ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX);
|
ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.raoulvdberge.refinedstorage.item.*;
|
|||||||
import com.raoulvdberge.refinedstorage.item.blockitem.ControllerBlockItem;
|
import com.raoulvdberge.refinedstorage.item.blockitem.ControllerBlockItem;
|
||||||
import com.raoulvdberge.refinedstorage.item.blockitem.FluidStorageBlockItem;
|
import com.raoulvdberge.refinedstorage.item.blockitem.FluidStorageBlockItem;
|
||||||
import com.raoulvdberge.refinedstorage.item.blockitem.StorageBlockItem;
|
import com.raoulvdberge.refinedstorage.item.blockitem.StorageBlockItem;
|
||||||
|
import com.raoulvdberge.refinedstorage.item.blockitem.WirelessTransmitterBlockItem;
|
||||||
import com.raoulvdberge.refinedstorage.item.group.MainItemGroup;
|
import com.raoulvdberge.refinedstorage.item.group.MainItemGroup;
|
||||||
import com.raoulvdberge.refinedstorage.loottable.StorageBlockLootFunctionSerializer;
|
import com.raoulvdberge.refinedstorage.loottable.StorageBlockLootFunctionSerializer;
|
||||||
import com.raoulvdberge.refinedstorage.network.NetworkHandler;
|
import com.raoulvdberge.refinedstorage.network.NetworkHandler;
|
||||||
@@ -125,6 +126,7 @@ public final class RS {
|
|||||||
API.instance().getNetworkNodeRegistry().add(SecurityManagerNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new SecurityManagerNetworkNode(world, pos)));
|
API.instance().getNetworkNodeRegistry().add(SecurityManagerNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new SecurityManagerNetworkNode(world, pos)));
|
||||||
API.instance().getNetworkNodeRegistry().add(InterfaceNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new InterfaceNetworkNode(world, pos)));
|
API.instance().getNetworkNodeRegistry().add(InterfaceNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new InterfaceNetworkNode(world, pos)));
|
||||||
API.instance().getNetworkNodeRegistry().add(FluidInterfaceNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new FluidInterfaceNetworkNode(world, pos)));
|
API.instance().getNetworkNodeRegistry().add(FluidInterfaceNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new FluidInterfaceNetworkNode(world, pos)));
|
||||||
|
API.instance().getNetworkNodeRegistry().add(WirelessTransmitterNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new WirelessTransmitterNetworkNode(world, pos)));
|
||||||
|
|
||||||
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
||||||
|
|
||||||
@@ -176,6 +178,7 @@ public final class RS {
|
|||||||
e.getRegistry().register(new SecurityManagerBlock());
|
e.getRegistry().register(new SecurityManagerBlock());
|
||||||
e.getRegistry().register(new InterfaceBlock());
|
e.getRegistry().register(new InterfaceBlock());
|
||||||
e.getRegistry().register(new FluidInterfaceBlock());
|
e.getRegistry().register(new FluidInterfaceBlock());
|
||||||
|
e.getRegistry().register(new WirelessTransmitterBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -211,6 +214,7 @@ public final class RS {
|
|||||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(SecurityManagerTile::new, RSBlocks.SECURITY_MANAGER).build(null).setRegistryName(RS.ID, "security_manager")));
|
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(SecurityManagerTile::new, RSBlocks.SECURITY_MANAGER).build(null).setRegistryName(RS.ID, "security_manager")));
|
||||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(InterfaceTile::new, RSBlocks.INTERFACE).build(null).setRegistryName(RS.ID, "interface")));
|
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(InterfaceTile::new, RSBlocks.INTERFACE).build(null).setRegistryName(RS.ID, "interface")));
|
||||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(FluidInterfaceTile::new, RSBlocks.FLUID_INTERFACE).build(null).setRegistryName(RS.ID, "fluid_interface")));
|
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(FluidInterfaceTile::new, RSBlocks.FLUID_INTERFACE).build(null).setRegistryName(RS.ID, "fluid_interface")));
|
||||||
|
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(WirelessTransmitterTile::new, RSBlocks.WIRELESS_TRANSMITTER).build(null).setRegistryName(RS.ID, "wireless_transmitter")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
|
private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
|
||||||
@@ -238,6 +242,7 @@ public final class RS {
|
|||||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<SecurityManagerContainer, SecurityManagerTile>((windowId, inv, tile) -> new SecurityManagerContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "security_manager"));
|
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<SecurityManagerContainer, SecurityManagerTile>((windowId, inv, tile) -> new SecurityManagerContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "security_manager"));
|
||||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<InterfaceContainer, InterfaceTile>((windowId, inv, tile) -> new InterfaceContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "interface"));
|
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<InterfaceContainer, InterfaceTile>((windowId, inv, tile) -> new InterfaceContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "interface"));
|
||||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<FluidInterfaceContainer, FluidInterfaceTile>((windowId, inv, tile) -> new FluidInterfaceContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "fluid_interface"));
|
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<FluidInterfaceContainer, FluidInterfaceTile>((windowId, inv, tile) -> new FluidInterfaceContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "fluid_interface"));
|
||||||
|
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<WirelessTransmitterContainer, WirelessTransmitterTile>((windowId, inv, tile) -> new WirelessTransmitterContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "wireless_transmitter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -315,6 +320,7 @@ public final class RS {
|
|||||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.SECURITY_MANAGER));
|
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.SECURITY_MANAGER));
|
||||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.INTERFACE));
|
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.INTERFACE));
|
||||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.FLUID_INTERFACE));
|
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.FLUID_INTERFACE));
|
||||||
|
e.getRegistry().register(new WirelessTransmitterBlockItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
|
|||||||
@@ -64,11 +64,12 @@ public final class RSBlocks {
|
|||||||
public static final InterfaceBlock INTERFACE = null;
|
public static final InterfaceBlock INTERFACE = null;
|
||||||
@ObjectHolder(RS.ID + ":fluid_interface")
|
@ObjectHolder(RS.ID + ":fluid_interface")
|
||||||
public static final FluidInterfaceBlock FLUID_INTERFACE = null;
|
public static final FluidInterfaceBlock FLUID_INTERFACE = null;
|
||||||
|
@ObjectHolder(RS.ID + ":wireless_transmitter")
|
||||||
|
public static final WirelessTransmitterBlock WIRELESS_TRANSMITTER = null;
|
||||||
|
|
||||||
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
||||||
public static final BlockConstructor CONSTRUCTOR = new BlockConstructor();
|
public static final BlockConstructor CONSTRUCTOR = new BlockConstructor();
|
||||||
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
|
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
|
||||||
public static final BlockWirelessTransmitter WIRELESS_TRANSMITTER = new BlockWirelessTransmitter();
|
|
||||||
public static final BlockCrafter CRAFTER = new BlockCrafter();
|
public static final BlockCrafter CRAFTER = new BlockCrafter();
|
||||||
public static final BlockDiskManipulator DISK_MANIPULATOR = new BlockDiskManipulator();
|
public static final BlockDiskManipulator DISK_MANIPULATOR = new BlockDiskManipulator();
|
||||||
public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
|
public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public final class RSContainers {
|
|||||||
public static final ContainerType<InterfaceContainer> INTERFACE = null;
|
public static final ContainerType<InterfaceContainer> INTERFACE = null;
|
||||||
@ObjectHolder(RS.ID + ":fluid_interface")
|
@ObjectHolder(RS.ID + ":fluid_interface")
|
||||||
public static final ContainerType<FluidInterfaceContainer> FLUID_INTERFACE = null;
|
public static final ContainerType<FluidInterfaceContainer> FLUID_INTERFACE = null;
|
||||||
|
@ObjectHolder(RS.ID + ":wireless_transmitter")
|
||||||
|
public static final ContainerType<WirelessTransmitterContainer> WIRELESS_TRANSMITTER = null;
|
||||||
|
|
||||||
//@ObjectHolder(RS.ID + ":crafter")
|
//@ObjectHolder(RS.ID + ":crafter")
|
||||||
public static final ContainerType<CrafterContainer> CRAFTER = null;
|
public static final ContainerType<CrafterContainer> CRAFTER = null;
|
||||||
@@ -50,6 +52,4 @@ public final class RSContainers {
|
|||||||
public static final ContainerType<DiskManipulatorContainer> DISK_MANIPULATOR = null;
|
public static final ContainerType<DiskManipulatorContainer> DISK_MANIPULATOR = null;
|
||||||
//@ObjectHolder(RS.ID + ":storage_monitor")
|
//@ObjectHolder(RS.ID + ":storage_monitor")
|
||||||
public static final ContainerType<StorageMonitorContainer> STORAGE_MONITOR = null;
|
public static final ContainerType<StorageMonitorContainer> STORAGE_MONITOR = null;
|
||||||
//@ObjectHolder(RS.ID + ":wireless_transmitter")
|
|
||||||
public static final ContainerType<SecurityManagerContainer> WIRELESS_TRANSMITTER = null;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,9 @@ public class RSOldConfig {
|
|||||||
public int craftingMonitorUsage;
|
public int craftingMonitorUsage;
|
||||||
public int crafterManagerUsage;
|
public int crafterManagerUsage;
|
||||||
public int destructorUsage;
|
public int destructorUsage;
|
||||||
public int wirelessTransmitterUsage;
|
|
||||||
public int diskManipulatorUsage;
|
public int diskManipulatorUsage;
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region Wireless Transmitter
|
|
||||||
public int wirelessTransmitterBaseRange;
|
|
||||||
public int wirelessTransmitterRangePerUpgrade;
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region Wireless Grid
|
//region Wireless Grid
|
||||||
public boolean wirelessGridUsesEnergy;
|
public boolean wirelessGridUsesEnergy;
|
||||||
public int wirelessGridCapacity;
|
public int wirelessGridCapacity;
|
||||||
@@ -55,7 +49,6 @@ public class RSOldConfig {
|
|||||||
|
|
||||||
//region Categories
|
//region Categories
|
||||||
private static final String ENERGY = "energy";
|
private static final String ENERGY = "energy";
|
||||||
private static final String WIRELESS_TRANSMITTER = "wirelessTransmitter";
|
|
||||||
private static final String WIRELESS_GRID = "wirelessGrid";
|
private static final String WIRELESS_GRID = "wirelessGrid";
|
||||||
private static final String PORTABLE_GRID = "portableGrid";
|
private static final String PORTABLE_GRID = "portableGrid";
|
||||||
private static final String WIRELESS_FLUID_GRID = "wirelessFluidGrid";
|
private static final String WIRELESS_FLUID_GRID = "wirelessFluidGrid";
|
||||||
@@ -71,15 +64,9 @@ public class RSOldConfig {
|
|||||||
craftingMonitorUsage = config.getInt("craftingMonitor", ENERGY, 2, 0, Integer.MAX_VALUE, "The energy used by Crafting Monitors");
|
craftingMonitorUsage = config.getInt("craftingMonitor", ENERGY, 2, 0, Integer.MAX_VALUE, "The energy used by Crafting Monitors");
|
||||||
crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers");
|
crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers");
|
||||||
destructorUsage = config.getInt("destructor", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Destructors");
|
destructorUsage = config.getInt("destructor", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Destructors");
|
||||||
wirelessTransmitterUsage = config.getInt("wirelessTransmitter", ENERGY, 8, 0, Integer.MAX_VALUE, "The energy used by Wireless Transmitters");
|
|
||||||
diskManipulatorUsage = config.getInt("diskManipulator", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Disk Manipulators");
|
diskManipulatorUsage = config.getInt("diskManipulator", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Disk Manipulators");
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region Wireless Transmitter
|
|
||||||
wirelessTransmitterBaseRange = config.getInt("range", WIRELESS_TRANSMITTER, 16, 0, Integer.MAX_VALUE, "The base range of the Wireless Transmitter");
|
|
||||||
wirelessTransmitterRangePerUpgrade = config.getInt("rangePerUpgrade", WIRELESS_TRANSMITTER, 8, 0, Integer.MAX_VALUE, "The additional range per Range Upgrade in the Wireless Transmitter");
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region Wireless Grid
|
//region Wireless Grid
|
||||||
wirelessGridUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_GRID, true, "Whether the Wireless Grid uses energy");
|
wirelessGridUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_GRID, true, "Whether the Wireless Grid uses energy");
|
||||||
wirelessGridCapacity = config.getInt("capacity", WIRELESS_GRID, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Wireless Grid");
|
wirelessGridCapacity = config.getInt("capacity", WIRELESS_GRID, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Wireless Grid");
|
||||||
|
|||||||
@@ -64,13 +64,13 @@ public class RSTiles {
|
|||||||
public static final TileEntityType<InterfaceTile> INTERFACE = null;
|
public static final TileEntityType<InterfaceTile> INTERFACE = null;
|
||||||
@ObjectHolder(RS.ID + ":fluid_interface")
|
@ObjectHolder(RS.ID + ":fluid_interface")
|
||||||
public static final TileEntityType<FluidInterfaceTile> FLUID_INTERFACE = null;
|
public static final TileEntityType<FluidInterfaceTile> FLUID_INTERFACE = null;
|
||||||
|
@ObjectHolder(RS.ID + ":wireless_transmitter")
|
||||||
|
public static final TileEntityType<WirelessTransmitterTile> WIRELESS_TRANSMITTER = null;
|
||||||
|
|
||||||
//@ObjectHolder(RS.ID + ":portable_grid")
|
//@ObjectHolder(RS.ID + ":portable_grid")
|
||||||
public static final TileEntityType<TilePortableGrid> PORTABLE_GRID = null;
|
public static final TileEntityType<TilePortableGrid> PORTABLE_GRID = null;
|
||||||
//@ObjectHolder(RS.ID + ":storage_monitor")
|
//@ObjectHolder(RS.ID + ":storage_monitor")
|
||||||
public static final TileEntityType<TileStorageMonitor> STORAGE_MONITOR = null;
|
public static final TileEntityType<TileStorageMonitor> STORAGE_MONITOR = null;
|
||||||
//@ObjectHolder(RS.ID + ":wireless_transmitter")
|
|
||||||
public static final TileEntityType<SecurityManagerTile> WIRELESS_TRANSMITTER = null;
|
|
||||||
//@ObjectHolder(RS.ID + ":disk_manipulator")
|
//@ObjectHolder(RS.ID + ":disk_manipulator")
|
||||||
public static final TileEntityType<TileDiskManipulator> DISK_MANIPULATOR = null;
|
public static final TileEntityType<TileDiskManipulator> DISK_MANIPULATOR = null;
|
||||||
//@ObjectHolder(RS.ID + ":crafter")
|
//@ObjectHolder(RS.ID + ":crafter")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.api.network;
|
package com.raoulvdberge.refinedstorage.api.network;
|
||||||
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a node that can send a wireless signal.
|
* Represents a node that can send a wireless signal.
|
||||||
@@ -19,5 +20,5 @@ public interface IWirelessTransmitter {
|
|||||||
/**
|
/**
|
||||||
* @return the dimension in which the transmitter is
|
* @return the dimension in which the transmitter is
|
||||||
*/
|
*/
|
||||||
int getDimension(); // TODO: return dimension actual value instead?
|
DimensionType getDimension();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public class NetworkItemHandler implements INetworkItemHandler {
|
public class NetworkItemHandler implements INetworkItemHandler {
|
||||||
private INetwork network;
|
private INetwork network;
|
||||||
|
|
||||||
private Map<PlayerEntity, INetworkItem> items = new ConcurrentHashMap<>();
|
private Map<PlayerEntity, INetworkItem> items = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public NetworkItemHandler(INetwork network) {
|
public NetworkItemHandler(INetwork network) {
|
||||||
@@ -27,7 +26,9 @@ public class NetworkItemHandler implements INetworkItemHandler {
|
|||||||
boolean inRange = false;
|
boolean inRange = false;
|
||||||
|
|
||||||
for (INetworkNode node : network.getNodeGraph().all()) {
|
for (INetworkNode node : network.getNodeGraph().all()) {
|
||||||
if (node instanceof IWirelessTransmitter && node.canUpdate() && ((IWirelessTransmitter) node).getDimension() == player.dimension.getId()) { // TODO does that work?
|
if (node instanceof IWirelessTransmitter &&
|
||||||
|
node.canUpdate() &&
|
||||||
|
((IWirelessTransmitter) node).getDimension() == player.dimension) {
|
||||||
IWirelessTransmitter transmitter = (IWirelessTransmitter) node;
|
IWirelessTransmitter transmitter = (IWirelessTransmitter) node;
|
||||||
|
|
||||||
double distance = Math.sqrt(Math.pow(transmitter.getOrigin().getX() - player.posX, 2) + Math.pow(transmitter.getOrigin().getY() - player.posY, 2) + Math.pow(transmitter.getOrigin().getZ() - player.posZ, 2));
|
double distance = Math.sqrt(Math.pow(transmitter.getOrigin().getX() - player.posX, 2) + Math.pow(transmitter.getOrigin().getY() - player.posY, 2) + Math.pow(transmitter.getOrigin().getZ() - player.posZ, 2));
|
||||||
|
|||||||
@@ -12,22 +12,23 @@ import net.minecraft.util.Direction;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class NetworkNodeWirelessTransmitter extends NetworkNode implements IWirelessTransmitter {
|
public class WirelessTransmitterNetworkNode extends NetworkNode implements IWirelessTransmitter {
|
||||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "wireless_transmitter");
|
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "wireless_transmitter");
|
||||||
|
|
||||||
private UpgradeItemHandler upgrades = (UpgradeItemHandler) new UpgradeItemHandler(4 /* TODO , ItemUpgrade.TYPE_RANGE*/).addListener(new NetworkNodeInventoryListener(this));
|
private UpgradeItemHandler upgrades = (UpgradeItemHandler) new UpgradeItemHandler(4, UpgradeItem.Type.RANGE).addListener(new NetworkNodeInventoryListener(this));
|
||||||
|
|
||||||
public NetworkNodeWirelessTransmitter(World world, BlockPos pos) {
|
public WirelessTransmitterNetworkNode(World world, BlockPos pos) {
|
||||||
super(world, pos);
|
super(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
return RS.INSTANCE.config.wirelessTransmitterUsage + upgrades.getEnergyUsage();
|
return RS.SERVER_CONFIG.getWirelessTransmitter().getUsage() + upgrades.getEnergyUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,7 +54,7 @@ public class NetworkNodeWirelessTransmitter extends NetworkNode implements IWire
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRange() {
|
public int getRange() {
|
||||||
return RS.INSTANCE.config.wirelessTransmitterBaseRange + (upgrades.getUpgradeCount(UpgradeItem.Type.RANGE) * RS.INSTANCE.config.wirelessTransmitterRangePerUpgrade);
|
return RS.SERVER_CONFIG.getWirelessTransmitter().getBaseRange() + (upgrades.getUpgradeCount(UpgradeItem.Type.RANGE) * RS.SERVER_CONFIG.getWirelessTransmitter().getRangePerUpgrade());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,8 +63,8 @@ public class NetworkNodeWirelessTransmitter extends NetworkNode implements IWire
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDimension() {
|
public DimensionType getDimension() {
|
||||||
return world.getDimension().getType().getId();
|
return world.getDimension().getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseItemHandler getUpgrades() {
|
public BaseItemHandler getUpgrades() {
|
||||||
@@ -77,7 +78,7 @@ public class NetworkNodeWirelessTransmitter extends NetworkNode implements IWire
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canConduct(@Nullable Direction direction) {
|
public boolean canConduct(@Nullable Direction direction) {
|
||||||
return direction != null && Direction.DOWN.equals(direction);
|
return Direction.DOWN.equals(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder;
|
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileWirelessTransmitter;
|
|
||||||
|
|
||||||
public class BlockWirelessTransmitter extends BlockNode {
|
|
||||||
public BlockWirelessTransmitter() {
|
|
||||||
super(BlockInfoBuilder.forId("wireless_transmitter").tileEntity(TileWirelessTransmitter::new).create());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO
|
|
||||||
@Override
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
public void registerModels(IModelRegistration modelRegistration) {
|
|
||||||
modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory"));
|
|
||||||
|
|
||||||
modelRegistration.addBakedModelOverride(info.getId(), base -> new BakedModelFullbright(base, RS.ID + ":blocks/wireless_transmitter/cutouts/connected"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
|
||||||
return openNetworkGui(RSGui.WIRELESS_TRANSMITTER, player, world, pos, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
|
||||||
if (!canPlaceBlockAt(world, pos) && world.getBlockState(pos).getBlock() == this) {
|
|
||||||
dropBlockAsItem(world, pos, state, 0);
|
|
||||||
|
|
||||||
world.setBlockToAir(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) {
|
|
||||||
return Collections.singletonList(ConstantsWirelessTransmitter.COLLISION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public boolean isOpaqueCube(BlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public boolean isFullCube(BlockState state) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
|
||||||
TileEntity tile = world.getTileEntity(pos.offset(Direction.DOWN));
|
|
||||||
|
|
||||||
if (tile != null && tile.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, Direction.UP)) {
|
|
||||||
INetworkNodeProxy proxy = tile.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, Direction.UP);
|
|
||||||
|
|
||||||
if (proxy != null && proxy.getNode() instanceof INetworkNodeCable) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return world.getBlockState(pos.offset(Direction.DOWN)).getBlock() instanceof BlockCable; // Make sure we still detect stuff like importers/exporters/etc.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockRenderLayer getRenderLayer() {
|
|
||||||
return BlockRenderLayer.CUTOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasConnectedState() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
|
|
||||||
super.addInformation(stack, world, tooltip, flag);
|
|
||||||
|
|
||||||
tooltip.add(I18n.format("block.refinedstorage:wireless_transmitter.tooltip", TextFormatting.WHITE + I18n.format("block.refinedstorage:cable.name") + TextFormatting.GRAY));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
|
||||||
return BlockFaceShape.UNDEFINED;
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
@@ -31,8 +31,6 @@ public abstract class NodeBlock extends BaseBlock {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
|
||||||
|
|
||||||
if (state.getBlock() != newState.getBlock()) {
|
if (state.getBlock() != newState.getBlock()) {
|
||||||
TileEntity tile = worldIn.getTileEntity(pos);
|
TileEntity tile = worldIn.getTileEntity(pos);
|
||||||
|
|
||||||
@@ -50,6 +48,9 @@ public abstract class NodeBlock extends BaseBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call onReplaced after the drops check so the tile still exists
|
||||||
|
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.WirelessTransmitterContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerProvider;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.WirelessTransmitterTile;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.NetworkUtils;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraft.world.IWorld;
|
||||||
|
import net.minecraft.world.IWorldReader;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.network.NetworkHooks;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class WirelessTransmitterBlock extends NodeBlock {
|
||||||
|
private static final VoxelShape SHAPE = Block.makeCuboidShape(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D);
|
||||||
|
|
||||||
|
public WirelessTransmitterBlock() {
|
||||||
|
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
|
||||||
|
|
||||||
|
this.setRegistryName(RS.ID, "wireless_transmitter");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
return new WirelessTransmitterTile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
|
return SHAPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockRenderLayer getRenderLayer() {
|
||||||
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasConnectedState() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) {
|
||||||
|
return world.getBlockState(pos.offset(Direction.DOWN)).getBlock() instanceof CableBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos currentPos, BlockPos facingPos) {
|
||||||
|
return facing == Direction.DOWN && !this.isValidPosition(state, world, currentPos) ? Blocks.AIR.getDefaultState() : super.updatePostPlacement(state, facing, facingState, world, currentPos, facingPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||||
|
if (!world.isRemote) {
|
||||||
|
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
|
||||||
|
(ServerPlayerEntity) player,
|
||||||
|
new PositionalTileContainerProvider<WirelessTransmitterTile>(
|
||||||
|
new TranslationTextComponent("gui.refinedstorage.wireless_transmitter"),
|
||||||
|
(tile, windowId, inventory, p) -> new WirelessTransmitterContainer(tile, player, windowId),
|
||||||
|
pos
|
||||||
|
),
|
||||||
|
pos
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ public class ServerConfig {
|
|||||||
private SecurityManager securityManager;
|
private SecurityManager securityManager;
|
||||||
private Interface _interface;
|
private Interface _interface;
|
||||||
private FluidInterface fluidInterface;
|
private FluidInterface fluidInterface;
|
||||||
|
private WirelessTransmitter wirelessTransmitter;
|
||||||
private Upgrades upgrades;
|
private Upgrades upgrades;
|
||||||
|
|
||||||
public ServerConfig() {
|
public ServerConfig() {
|
||||||
@@ -41,6 +42,7 @@ public class ServerConfig {
|
|||||||
securityManager = new SecurityManager();
|
securityManager = new SecurityManager();
|
||||||
_interface = new Interface();
|
_interface = new Interface();
|
||||||
fluidInterface = new FluidInterface();
|
fluidInterface = new FluidInterface();
|
||||||
|
wirelessTransmitter = new WirelessTransmitter();
|
||||||
upgrades = new Upgrades();
|
upgrades = new Upgrades();
|
||||||
|
|
||||||
spec = builder.build();
|
spec = builder.build();
|
||||||
@@ -114,6 +116,10 @@ public class ServerConfig {
|
|||||||
return fluidInterface;
|
return fluidInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WirelessTransmitter getWirelessTransmitter() {
|
||||||
|
return wirelessTransmitter;
|
||||||
|
}
|
||||||
|
|
||||||
public ForgeConfigSpec getSpec() {
|
public ForgeConfigSpec getSpec() {
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
@@ -527,4 +533,32 @@ public class ServerConfig {
|
|||||||
return usage.get();
|
return usage.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class WirelessTransmitter {
|
||||||
|
private final ForgeConfigSpec.IntValue usage;
|
||||||
|
private final ForgeConfigSpec.IntValue baseRange;
|
||||||
|
private final ForgeConfigSpec.IntValue rangePerUpgrade;
|
||||||
|
|
||||||
|
public WirelessTransmitter() {
|
||||||
|
builder.push("wirelessTransmitter");
|
||||||
|
|
||||||
|
usage = builder.comment("The energy used by the Wireless Transmitter").defineInRange("usage", 8, 0, Integer.MAX_VALUE);
|
||||||
|
baseRange = builder.comment("The base range of the Wireless Transmitter").defineInRange("baseRange", 16, 0, Integer.MAX_VALUE);
|
||||||
|
rangePerUpgrade = builder.comment("The additional range per Range Upgrade in the Wireless Transmitter").defineInRange("rangePerUpgrade", 8, 0, Integer.MAX_VALUE);
|
||||||
|
|
||||||
|
builder.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUsage() {
|
||||||
|
return usage.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBaseRange() {
|
||||||
|
return baseRange.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRangePerUpgrade() {
|
||||||
|
return rangePerUpgrade.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.raoulvdberge.refinedstorage.container;
|
package com.raoulvdberge.refinedstorage.container;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileWirelessTransmitter;
|
import com.raoulvdberge.refinedstorage.tile.WirelessTransmitterTile;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
import net.minecraftforge.items.SlotItemHandler;
|
||||||
|
|
||||||
public class WirelessTransmitterContainer extends BaseContainer {
|
public class WirelessTransmitterContainer extends BaseContainer {
|
||||||
public WirelessTransmitterContainer(TileWirelessTransmitter wirelessTransmitter, PlayerEntity player, int windowId) {
|
public WirelessTransmitterContainer(WirelessTransmitterTile wirelessTransmitter, PlayerEntity player, int windowId) {
|
||||||
super(RSContainers.WIRELESS_TRANSMITTER, wirelessTransmitter, player, windowId);
|
super(RSContainers.WIRELESS_TRANSMITTER, wirelessTransmitter, player, windowId);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.item.blockitem;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.Style;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WirelessTransmitterBlockItem extends BaseBlockItem {
|
||||||
|
public WirelessTransmitterBlockItem() {
|
||||||
|
super(RSBlocks.WIRELESS_TRANSMITTER, new Item.Properties().group(RS.MAIN_GROUP));
|
||||||
|
|
||||||
|
this.setRegistryName(RS.ID, "wireless_transmitter");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
|
||||||
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
|
tooltip.add(new TranslationTextComponent("block.refinedstorage.wireless_transmitter.tooltip", new TranslationTextComponent("block.refinedstorage.cable")).setStyle(new Style().setColor(TextFormatting.GRAY)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.render.constants;
|
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
|
||||||
|
|
||||||
public final class ConstantsWirelessTransmitter {
|
|
||||||
// @Volatile: From BlockTorch
|
|
||||||
public static final CollisionGroup COLLISION = new CollisionGroup().addItem(new AxisAlignedBB(0.4000000059604645D, 0.0D, 0.4000000059604645D, 0.6000000238418579D, 0.6000000238418579D, 0.6000000238418579D));
|
|
||||||
}
|
|
||||||
@@ -3,18 +3,19 @@ package com.raoulvdberge.refinedstorage.screen;
|
|||||||
import com.raoulvdberge.refinedstorage.RS;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.container.WirelessTransmitterContainer;
|
import com.raoulvdberge.refinedstorage.container.WirelessTransmitterContainer;
|
||||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton;
|
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton;
|
||||||
import com.raoulvdberge.refinedstorage.tile.TileWirelessTransmitter;
|
import com.raoulvdberge.refinedstorage.tile.WirelessTransmitterTile;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
public class GuiWirelessTransmitter extends BaseScreen<WirelessTransmitterContainer> {
|
public class WirelessTransmitterScreen extends BaseScreen<WirelessTransmitterContainer> {
|
||||||
public GuiWirelessTransmitter(WirelessTransmitterContainer container, PlayerInventory inventory) {
|
public WirelessTransmitterScreen(WirelessTransmitterContainer container, PlayerInventory inventory, ITextComponent title) {
|
||||||
super(container, 211, 137, inventory, null);
|
super(container, 211, 137, inventory, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPostInit(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
addSideButton(new RedstoneModeSideButton(this, TileWirelessTransmitter.REDSTONE_MODE));
|
addSideButton(new RedstoneModeSideButton(this, WirelessTransmitterTile.REDSTONE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -30,8 +31,8 @@ public class GuiWirelessTransmitter extends BaseScreen<WirelessTransmitterContai
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderForeground(int mouseX, int mouseY) {
|
public void renderForeground(int mouseX, int mouseY) {
|
||||||
renderString(7, 7, I18n.format("gui.refinedstorage:wireless_transmitter"));
|
renderString(7, 7, title.getFormattedText());
|
||||||
renderString(28, 25, I18n.format("gui.refinedstorage:wireless_transmitter.distance", TileWirelessTransmitter.RANGE.getValue()));
|
renderString(28, 25, I18n.format("gui.refinedstorage.wireless_transmitter.distance", WirelessTransmitterTile.RANGE.getValue()));
|
||||||
renderString(7, 43, I18n.format("container.inventory"));
|
renderString(7, 43, I18n.format("container.inventory"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile;
|
package com.raoulvdberge.refinedstorage.tile;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeWirelessTransmitter;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.WirelessTransmitterNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||||
import net.minecraft.network.datasync.DataSerializers;
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -9,10 +9,10 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class TileWirelessTransmitter extends NetworkNodeTile<NetworkNodeWirelessTransmitter> {
|
public class WirelessTransmitterTile extends NetworkNodeTile<WirelessTransmitterNetworkNode> {
|
||||||
public static final TileDataParameter<Integer, TileWirelessTransmitter> RANGE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getRange());
|
public static final TileDataParameter<Integer, WirelessTransmitterTile> RANGE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getRange());
|
||||||
|
|
||||||
public TileWirelessTransmitter() {
|
public WirelessTransmitterTile() {
|
||||||
super(RSTiles.WIRELESS_TRANSMITTER);
|
super(RSTiles.WIRELESS_TRANSMITTER);
|
||||||
|
|
||||||
dataManager.addWatchedParameter(RANGE);
|
dataManager.addWatchedParameter(RANGE);
|
||||||
@@ -20,7 +20,7 @@ public class TileWirelessTransmitter extends NetworkNodeTile<NetworkNodeWireless
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public NetworkNodeWirelessTransmitter createNode(World world, BlockPos pos) {
|
public WirelessTransmitterNetworkNode createNode(World world, BlockPos pos) {
|
||||||
return new NetworkNodeWirelessTransmitter(world, pos);
|
return new WirelessTransmitterNetworkNode(world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,26 +1,10 @@
|
|||||||
{
|
{
|
||||||
"forge_marker": 1,
|
|
||||||
"defaults": {
|
|
||||||
"model": "refinedstorage:wireless_transmitter",
|
|
||||||
"textures": {
|
|
||||||
"torch": "refinedstorage:blocks/wireless_transmitter/wireless_transmitter",
|
|
||||||
"cutout": "refinedstorage:blocks/wireless_transmitter/cutouts/disconnected"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory": [
|
"connected=true": {
|
||||||
{
|
"model": "refinedstorage:block/wireless_transmitter_connected"
|
||||||
"transform": "forge:default-block"
|
},
|
||||||
}
|
"connected=false": {
|
||||||
],
|
"model": "refinedstorage:block/wireless_transmitter_disconnected"
|
||||||
"connected": {
|
|
||||||
"true": {
|
|
||||||
"textures": {
|
|
||||||
"cutout": "refinedstorage:blocks/wireless_transmitter/cutouts/connected"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"false": {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,8 @@
|
|||||||
"gui.refinedstorage:crafting_monitor.machine_does_not_accept_fluid": "Machine doesn't accept fluid",
|
"gui.refinedstorage:crafting_monitor.machine_does_not_accept_fluid": "Machine doesn't accept fluid",
|
||||||
"gui.refinedstorage:crafting_monitor.machine_none": "No machine found",
|
"gui.refinedstorage:crafting_monitor.machine_none": "No machine found",
|
||||||
"gui.refinedstorage:crafting_monitor.crafter_is_locked": "Crafter is locked",
|
"gui.refinedstorage:crafting_monitor.crafter_is_locked": "Crafter is locked",
|
||||||
"gui.refinedstorage:wireless_transmitter": "Wireless Transmitter",
|
"gui.refinedstorage.wireless_transmitter": "Wireless Transmitter",
|
||||||
"gui.refinedstorage:wireless_transmitter.distance": "%d block(s)",
|
"gui.refinedstorage.wireless_transmitter.distance": "%d block(s)",
|
||||||
"gui.refinedstorage:crafter": "Crafter",
|
"gui.refinedstorage:crafter": "Crafter",
|
||||||
"gui.refinedstorage.filter": "Filter",
|
"gui.refinedstorage.filter": "Filter",
|
||||||
"gui.refinedstorage.filter.compare_nbt": "NBT",
|
"gui.refinedstorage.filter.compare_nbt": "NBT",
|
||||||
@@ -197,8 +197,8 @@
|
|||||||
"block.refinedstorage.relay": "Relay",
|
"block.refinedstorage.relay": "Relay",
|
||||||
"block.refinedstorage.interface": "Interface",
|
"block.refinedstorage.interface": "Interface",
|
||||||
"block.refinedstorage:crafting_monitor": "Crafting Monitor",
|
"block.refinedstorage:crafting_monitor": "Crafting Monitor",
|
||||||
"block.refinedstorage:wireless_transmitter": "Wireless Transmitter",
|
"block.refinedstorage.wireless_transmitter": "Wireless Transmitter",
|
||||||
"block.refinedstorage:wireless_transmitter.tooltip": "Must be placed on %s.",
|
"block.refinedstorage.wireless_transmitter.tooltip": "Must be placed on %s.",
|
||||||
"block.refinedstorage:crafter": "Crafter",
|
"block.refinedstorage:crafter": "Crafter",
|
||||||
"block.refinedstorage.network_receiver": "Network Receiver",
|
"block.refinedstorage.network_receiver": "Network Receiver",
|
||||||
"block.refinedstorage.network_transmitter": "Network Transmitter",
|
"block.refinedstorage.network_transmitter": "Network Transmitter",
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"parent": "block/cube",
|
||||||
"ambientocclusion": false,
|
"ambientocclusion": false,
|
||||||
"textures": {
|
"textures": {
|
||||||
"particle": "#torch"
|
"particle": "refinedstorage:block/wireless_transmitter/wireless_transmitter",
|
||||||
|
"torch": "refinedstorage:block/wireless_transmitter/wireless_transmitter"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "refinedstorage:block/wireless_transmitter",
|
||||||
|
"textures": {
|
||||||
|
"cutout": "refinedstorage:block/wireless_transmitter/cutouts/connected"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "refinedstorage:block/wireless_transmitter",
|
||||||
|
"textures": {
|
||||||
|
"cutout": "refinedstorage:block/wireless_transmitter/cutouts/disconnected"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parent": "refinedstorage:block/wireless_transmitter_disconnected"
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "refinedstorage:wireless_transmitter"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -10,13 +10,13 @@
|
|||||||
"item": "refinedstorage:quartz_enriched_iron"
|
"item": "refinedstorage:quartz_enriched_iron"
|
||||||
},
|
},
|
||||||
"A": {
|
"A": {
|
||||||
"item": "#advanced_processor"
|
"item": "refinedstorage:advanced_processor"
|
||||||
},
|
},
|
||||||
"M": {
|
"M": {
|
||||||
"item": "refinedstorage:machine_casing"
|
"item": "refinedstorage:machine_casing"
|
||||||
},
|
},
|
||||||
"P": {
|
"P": {
|
||||||
"item": "minecraft:ender_pearl"
|
"tag": "forge:ender_pearls"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
Reference in New Issue
Block a user