Fixed Wireless Grid not working cross dimensionally, fixes #276
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
**Bugfixes**
|
**Bugfixes**
|
||||||
- Fixed crash with Grid
|
- Fixed crash with Grid
|
||||||
- Fixed Grid Filter only updating the Grid when reopening the GUI
|
- Fixed Grid Filter only updating the Grid when reopening the GUI
|
||||||
|
- Fixed Wireless Grid not working cross dimensionally
|
||||||
- Priority field and detector amount field can now display 4 digits at a time
|
- Priority field and detector amount field can now display 4 digits at a time
|
||||||
|
|
||||||
**Features**
|
**Features**
|
||||||
|
@@ -35,7 +35,7 @@ public class WirelessGridHandler implements IWirelessGridHandler {
|
|||||||
boolean inRange = false;
|
boolean inRange = false;
|
||||||
|
|
||||||
for (INetworkNode node : network.getNodeGraph().all()) {
|
for (INetworkNode node : network.getNodeGraph().all()) {
|
||||||
if (node instanceof IWirelessTransmitter) {
|
if (node instanceof IWirelessTransmitter && node.getNodeWorld().provider.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));
|
||||||
|
@@ -17,6 +17,7 @@ import net.minecraft.util.*;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextComponentTranslation;
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
import net.minecraftforge.fml.common.Optional;
|
import net.minecraftforge.fml.common.Optional;
|
||||||
@@ -52,7 +53,7 @@ public class ItemWirelessGrid extends ItemEnergyContainer implements ISpecialEle
|
|||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setCreativeTab(RefinedStorage.INSTANCE.tab);
|
setCreativeTab(RefinedStorage.INSTANCE.tab);
|
||||||
addPropertyOverride(new ResourceLocation("connected"), (stack, world, entity) -> (entity != null && isValid(stack) && getDimensionId(stack) == entity.dimension) ? 1.0f : 0.0f);
|
addPropertyOverride(new ResourceLocation("connected"), (stack, world, entity) -> (entity != null && isValid(stack)) ? 1.0f : 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -137,11 +138,13 @@ public class ItemWirelessGrid extends ItemEnergyContainer implements ISpecialEle
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
||||||
if (!world.isRemote && isValid(stack) && getDimensionId(stack) == player.dimension) {
|
if (!world.isRemote && isValid(stack)) {
|
||||||
TileEntity tile = world.getTileEntity(new BlockPos(getX(stack), getY(stack), getZ(stack)));
|
World controllerWorld = DimensionManager.getWorld(getDimensionId(stack));
|
||||||
|
|
||||||
if (tile instanceof TileController) {
|
TileEntity controller;
|
||||||
if (((TileController) tile).getWirelessGridHandler().onOpen(player, hand)) {
|
|
||||||
|
if (controllerWorld != null && ((controller = controllerWorld.getTileEntity(new BlockPos(getX(stack), getY(stack), getZ(stack)))) instanceof TileController)) {
|
||||||
|
if (((TileController) controller).getWirelessGridHandler().onOpen(player, hand)) {
|
||||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||||
} else {
|
} else {
|
||||||
player.addChatComponentMessage(new TextComponentTranslation("misc.refinedstorage:wireless_grid.out_of_range"));
|
player.addChatComponentMessage(new TextComponentTranslation("misc.refinedstorage:wireless_grid.out_of_range"));
|
||||||
|
Reference in New Issue
Block a user