Fix wireless grid RF
This commit is contained in:
		| @@ -29,6 +29,10 @@ public class ItemWirelessGrid extends ItemEnergyContainer { | |||||||
|     public static final String NBT_SORTING_DIRECTION = "SortingDirection"; |     public static final String NBT_SORTING_DIRECTION = "SortingDirection"; | ||||||
|     public static final String NBT_SEARCH_BOX_MODE = "SearchBoxMode"; |     public static final String NBT_SEARCH_BOX_MODE = "SearchBoxMode"; | ||||||
|  |  | ||||||
|  |     public static final int USAGE_OPEN = 30; | ||||||
|  |     public static final int USAGE_PULL = 3; | ||||||
|  |     public static final int USAGE_PUSH = 3; | ||||||
|  |  | ||||||
|     public ItemWirelessGrid() { |     public ItemWirelessGrid() { | ||||||
|         super(3200); |         super(3200); | ||||||
|  |  | ||||||
| @@ -49,7 +53,7 @@ public class ItemWirelessGrid extends ItemEnergyContainer { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public double getDurabilityForDisplay(ItemStack stack) { |     public double getDurabilityForDisplay(ItemStack stack) { | ||||||
|         return 1 - (getEnergyStored(stack) / getMaxEnergyStored(stack)); |         return 1d - ((double) getEnergyStored(stack) / (double) getMaxEnergyStored(stack)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
| @@ -64,6 +68,8 @@ public class ItemWirelessGrid extends ItemEnergyContainer { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { |     public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { | ||||||
|  |         list.add(I18n.translateToLocalFormatted("misc.refinedstorage:energy_stored", getEnergyStored(stack), getMaxEnergyStored(stack))); | ||||||
|  |  | ||||||
|         if (isValid(stack)) { |         if (isValid(stack)) { | ||||||
|             list.add(I18n.translateToLocalFormatted("misc.refinedstorage:wireless_grid.tooltip.0", getX(stack))); |             list.add(I18n.translateToLocalFormatted("misc.refinedstorage:wireless_grid.tooltip.0", getX(stack))); | ||||||
|             list.add(I18n.translateToLocalFormatted("misc.refinedstorage:wireless_grid.tooltip.1", getY(stack))); |             list.add(I18n.translateToLocalFormatted("misc.refinedstorage:wireless_grid.tooltip.1", getY(stack))); | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack; | |||||||
| import net.minecraft.tileentity.TileEntity; | import net.minecraft.tileentity.TileEntity; | ||||||
| import net.minecraft.util.math.BlockPos; | import net.minecraft.util.math.BlockPos; | ||||||
| import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||||||
|  | import refinedstorage.item.ItemWirelessGrid; | ||||||
| import refinedstorage.storage.StorageItem; | import refinedstorage.storage.StorageItem; | ||||||
| import refinedstorage.tile.TileController; | import refinedstorage.tile.TileController; | ||||||
|  |  | ||||||
| @@ -101,7 +102,7 @@ public class MessageStoragePull extends MessageHandlerPlayerToServer<MessageStor | |||||||
|                         player.updateHeldItem(); |                         player.updateHeldItem(); | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|                     controller.drainEnergyFromWirelessGrid(player, 300); |                     controller.drainEnergyFromWirelessGrid(player, ItemWirelessGrid.USAGE_PULL); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack; | |||||||
| import net.minecraft.tileentity.TileEntity; | import net.minecraft.tileentity.TileEntity; | ||||||
| import net.minecraft.util.math.BlockPos; | import net.minecraft.util.math.BlockPos; | ||||||
| import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||||||
|  | import refinedstorage.item.ItemWirelessGrid; | ||||||
| import refinedstorage.tile.TileController; | import refinedstorage.tile.TileController; | ||||||
|  |  | ||||||
| public class MessageStoragePush extends MessageHandlerPlayerToServer<MessageStoragePush> implements IMessage { | public class MessageStoragePush extends MessageHandlerPlayerToServer<MessageStoragePush> implements IMessage { | ||||||
| @@ -83,6 +84,8 @@ public class MessageStoragePush extends MessageHandlerPlayerToServer<MessageStor | |||||||
|                         player.inventory.setInventorySlotContents(message.slot, null); |                         player.inventory.setInventorySlotContents(message.slot, null); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  |                 controller.drainEnergyFromWirelessGrid(player, ItemWirelessGrid.USAGE_PUSH); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -273,8 +273,10 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor | |||||||
|  |  | ||||||
|     public void onOpenWirelessGrid(EntityPlayer player, EnumHand hand) { |     public void onOpenWirelessGrid(EntityPlayer player, EnumHand hand) { | ||||||
|         wirelessGridConsumers.add(new WirelessGridConsumer(player, hand, player.getHeldItem(hand))); |         wirelessGridConsumers.add(new WirelessGridConsumer(player, hand, player.getHeldItem(hand))); | ||||||
|  |  | ||||||
|         player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.WIRELESS_GRID, worldObj, HandUtils.getIdFromHand(hand), 0, 0); |         player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.WIRELESS_GRID, worldObj, HandUtils.getIdFromHand(hand), 0, 0); | ||||||
|         drainEnergyFromWirelessGrid(player, 100); |  | ||||||
|  |         drainEnergyFromWirelessGrid(player, ItemWirelessGrid.USAGE_OPEN); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void onCloseWirelessGrid(EntityPlayer player) { |     public void onCloseWirelessGrid(EntityPlayer player) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Raoul Van den Berge
					Raoul Van den Berge