0.9.2 hotfix

This commit is contained in:
Raoul Van den Berge
2016-08-25 14:51:33 +02:00
parent f65da8bf6b
commit ee2cd92a56
9 changed files with 38 additions and 24 deletions

View File

@@ -19,7 +19,7 @@ import refinedstorage.proxy.CommonProxy;
@Mod(modid = RefinedStorage.ID, version = RefinedStorage.VERSION, dependencies = RefinedStorage.DEPENDENCIES)
public final class RefinedStorage {
public static final String ID = "refinedstorage";
public static final String VERSION = "0.9.1";
public static final String VERSION = "0.9.2";
public static final String DEPENDENCIES = "required-after:mcmultipart@[1.2.1,);";
@SidedProxy(clientSide = "refinedstorage.proxy.ClientProxy", serverSide = "refinedstorage.proxy.ServerProxy")

View File

@@ -2,6 +2,7 @@ package refinedstorage.api.network;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@@ -18,10 +19,11 @@ public interface IWirelessGridHandler {
* Called when a player opens a wireless grid.
*
* @param player The player that opened the wireless grid
* @param world The world of the controller
* @param hand The hand the player opened it with
* @return If the opening was successful
*/
boolean onOpen(EntityPlayer player, EnumHand hand);
boolean onOpen(EntityPlayer player, World world, EnumHand hand);
/**
* Called when the player closes a wireless grid.

View File

@@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import refinedstorage.RefinedStorage;
import refinedstorage.RefinedStorageGui;
import refinedstorage.RefinedStorageItems;
@@ -31,7 +32,7 @@ public class WirelessGridHandler implements IWirelessGridHandler {
}
@Override
public boolean onOpen(EntityPlayer player, EnumHand hand) {
public boolean onOpen(EntityPlayer player, World controllerWorld, EnumHand hand) {
boolean inRange = false;
for (INetworkNode node : network.getNodeGraph().all()) {
@@ -60,7 +61,7 @@ public class WirelessGridHandler implements IWirelessGridHandler {
consumers.add(new WirelessGridConsumer(player, stack));
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.WIRELESS_GRID, player.worldObj, hand.ordinal(), 0, 0);
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.WIRELESS_GRID, player.worldObj, hand.ordinal(), controllerWorld.provider.getDimension(), 0);
network.sendItemStorageToClient((EntityPlayerMP) player);

View File

@@ -63,12 +63,12 @@ public class GuiHandler implements IGuiHandler {
}
}
private WirelessGrid getWirelessGrid(EntityPlayer player, int hand) {
return new WirelessGrid(player.worldObj, player.getHeldItem(EnumHand.values()[hand]));
private WirelessGrid getWirelessGrid(EntityPlayer player, int hand, int controllerDimension) {
return new WirelessGrid(controllerDimension, player.getHeldItem(EnumHand.values()[hand]));
}
private ContainerGrid getWirelessGridContainer(EntityPlayer player, int hand) {
return new ContainerGrid(getWirelessGrid(player, hand), player);
private ContainerGrid getWirelessGridContainer(EntityPlayer player, int hand, int controllerDimension) {
return new ContainerGrid(getWirelessGrid(player, hand, controllerDimension), player);
}
private ContainerGridFilter getGridFilterContainer(EntityPlayer player, int hand) {
@@ -78,7 +78,7 @@ public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == RefinedStorageGui.WIRELESS_GRID) {
return getWirelessGridContainer(player, x);
return getWirelessGridContainer(player, x, y);
} else if (ID == RefinedStorageGui.GRID_FILTER) {
return getGridFilterContainer(player, x);
}
@@ -96,7 +96,7 @@ public class GuiHandler implements IGuiHandler {
case RefinedStorageGui.GRID:
return new GuiGrid((ContainerGrid) getContainer(ID, player, tile), (TileGrid) tile);
case RefinedStorageGui.WIRELESS_GRID:
return getWirelessGridGui(player, x);
return getWirelessGridGui(player, x, y);
case RefinedStorageGui.DISK_DRIVE:
return new GuiStorage((ContainerDiskDrive) getContainer(ID, player, tile), (IStorageGui) tile, "gui/disk_drive.png");
case RefinedStorageGui.IMPORTER:
@@ -140,8 +140,8 @@ public class GuiHandler implements IGuiHandler {
}
}
private GuiGrid getWirelessGridGui(EntityPlayer player, int hand) {
WirelessGrid grid = getWirelessGrid(player, hand);
private GuiGrid getWirelessGridGui(EntityPlayer player, int hand, int controllerDimension) {
WirelessGrid grid = getWirelessGrid(player, hand, controllerDimension);
return new GuiGrid(new ContainerGrid(grid, player), grid);
}

View File

@@ -144,7 +144,7 @@ public class ItemWirelessGrid extends ItemEnergyContainer implements ISpecialEle
TileEntity controller;
if (controllerWorld != null && ((controller = controllerWorld.getTileEntity(new BlockPos(getX(stack), getY(stack), getZ(stack)))) instanceof TileController)) {
if (((TileController) controller).getWirelessGridHandler().onOpen(player, hand)) {
if (((TileController) controller).getWirelessGridHandler().onOpen(player, controllerWorld, hand)) {
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
} else {
player.addChatComponentMessage(new TextComponentTranslation("misc.refinedstorage:wireless_grid.out_of_range"));

View File

@@ -6,6 +6,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import refinedstorage.RefinedStorage;
import refinedstorage.api.network.grid.IFluidGridHandler;
import refinedstorage.api.network.grid.IItemGridHandler;
@@ -24,10 +27,9 @@ import java.util.ArrayList;
import java.util.List;
public class WirelessGrid implements IGrid {
private World world;
private ItemStack stack;
private int controllerDimension;
private BlockPos controller;
private int viewType;
@@ -41,7 +43,7 @@ public class WirelessGrid implements IGrid {
protected void onContentsChanged(int slot) {
super.onContentsChanged(slot);
if (!world.isRemote) {
if (FMLCommonHandler.instance().getSide() == Side.SERVER) {
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
@@ -51,13 +53,12 @@ public class WirelessGrid implements IGrid {
}
};
public WirelessGrid(World world, ItemStack stack) {
this.world = world;
public WirelessGrid(int controllerDimension, ItemStack stack) {
this.controllerDimension = controllerDimension;
this.controller = new BlockPos(ItemWirelessGrid.getX(stack), ItemWirelessGrid.getY(stack), ItemWirelessGrid.getZ(stack));
this.stack = stack;
this.controller = new BlockPos(ItemWirelessGrid.getX(stack), ItemWirelessGrid.getY(stack), ItemWirelessGrid.getZ(stack));
this.viewType = ItemWirelessGrid.getViewType(stack);
this.sortingType = ItemWirelessGrid.getSortingType(stack);
this.sortingDirection = ItemWirelessGrid.getSortingDirection(stack);
@@ -184,8 +185,14 @@ public class WirelessGrid implements IGrid {
}
private TileController getController() {
TileEntity tile = world.getTileEntity(controller);
World world = DimensionManager.getWorld(controllerDimension);
return tile instanceof TileController ? (TileController) tile : null;
if (world != null) {
TileEntity tile = world.getTileEntity(controller);
return tile instanceof TileController ? (TileController) tile : null;
}
return null;
}
}

View File

@@ -3,7 +3,7 @@
"modid": "refinedstorage",
"name": "Refined Storage",
"description": "A Minecraft mod all about storage.",
"version": "0.9.1",
"version": "0.9.2",
"mcversion": "1.10.2",
"url": "",
"updateUrl": "",