diff --git a/dependencies.gradle b/dependencies.gradle index a7487377..ab9b098b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,17 +1,17 @@ // Add your dependencies here dependencies { - implementation("com.github.GTNewHorizons:NotEnoughItems:2.5.24-GTNH:dev") + implementation("com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev") implementation("com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev") implementation("com.github.GTNewHorizons:CodeChickenCore:1.2.1:dev") - implementation("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-342-GTNH:dev") + implementation("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-400-GTNH:dev") implementation("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") implementation("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false } compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false } - compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.2.21-gtnh:dev') { transitive = false } - compileOnly("com.github.GTNewHorizons:waila:1.7.1:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.106:dev") { transitive = false } + compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.3.0-gtnh:dev') { transitive = false } + compileOnly("com.github.GTNewHorizons:waila:1.7.3:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.46.16:dev") { transitive = false } compileOnly("curse.maven:computercraft-67504:2269339") { transitive = false } compileOnly("curse.maven:cofh-lib-220333:2388748") { transitive = false } compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") { transitive = false } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd491..e6441136 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/settings.gradle b/settings.gradle index 378da589..f9bba047 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,9 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.21' + + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22' + } diff --git a/src/main/java/thaumicenergistics/client/render/item/ItemCellMicroscopeRenderer.java b/src/main/java/thaumicenergistics/client/render/item/ItemCellMicroscopeRenderer.java index 79ad32ee..dd0a570c 100644 --- a/src/main/java/thaumicenergistics/client/render/item/ItemCellMicroscopeRenderer.java +++ b/src/main/java/thaumicenergistics/client/render/item/ItemCellMicroscopeRenderer.java @@ -100,6 +100,7 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glRotatef(90.0F, -1.0F, 0.0F, 0.0F); GL11.glRotatef(30.0F, 0.0F, 0.0F, -1.0F); } else if (type == ItemRenderType.INVENTORY) { + GL11.glTranslatef(0.5F, 0.2F, 0F); GL11.glScalef(2.5F, 2.5F, 2.5F); GL11.glRotatef(60.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(30.0F, 0.0F, 0.0F, -1.0F); diff --git a/src/main/java/thaumicenergistics/common/items/ItemCellMicroscope.java b/src/main/java/thaumicenergistics/common/items/ItemCellMicroscope.java index 58b53464..2bb7321d 100644 --- a/src/main/java/thaumicenergistics/common/items/ItemCellMicroscope.java +++ b/src/main/java/thaumicenergistics/common/items/ItemCellMicroscope.java @@ -1,17 +1,25 @@ package thaumicenergistics.common.items; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import appeng.api.AEApi; +import appeng.api.storage.ICellContainer; import appeng.api.storage.IMEInventory; +import appeng.api.storage.ISaveProvider; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; @@ -33,7 +41,8 @@ public ItemCellMicroscope() { super(); } - ItemStack startCell = null; + List startCells = new ArrayList(); + TileEntity cellSaveManager = null; @SideOnly(Side.CLIENT) @Override @@ -59,9 +68,9 @@ public int getMaxItemUseDuration(ItemStack itemstack) { @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer p) { if (world.isRemote) { - ItemStack cell = this.doScan(stack, world, p, 0); - if (cell != null) { - this.startCell = cell; + ArrayList cells = this.doScan(stack, world, p, 0); + if (cells.size() != 0) { + this.startCells = cells; } } @@ -71,34 +80,18 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer p) @Override public void onUsingTick(ItemStack stack, EntityPlayer p, int count) { - if (p.worldObj.isRemote - && p.getCommandSenderName() == Minecraft.getMinecraft().thePlayer.getCommandSenderName()) { + if (p.worldObj.isRemote && Objects + .equals(p.getCommandSenderName(), Minecraft.getMinecraft().thePlayer.getCommandSenderName())) { - ItemStack cell = this.doScan(stack, p.worldObj, p, count); + ArrayList cells = this.doScan(stack, p.worldObj, p, count); - if (cell != null && cell.equals(this.startCell)) { + if (cells.size() != 0 && cells.equals(this.startCells)) { if (count <= 5) { - this.startCell = null; p.stopUsingItem(); - - IMEInventory inv = AEApi.instance().registries().cell() - .getCellInventory(cell, null, StorageChannel.ITEMS); - IItemList itemList = inv - .getAvailableItems(AEApi.instance().storage().createItemList()); - - for (final IAEItemStack i : itemList) { - ScanResult sr = new ScanResult( - (byte) 1, - Item.getIdFromItem(i.getItem()), - i.getItemDamage(), - (Entity) null, - ""); - if (ScanManager.isValidScanTarget(p, sr, "@")) { - - ScanManager.completeScan(p, sr, "@"); - PacketHandler.INSTANCE.sendToServer(new PacketScannedToServer(sr, p, "@")); - } + this.startCells.clear(); + for (ItemStack cell : cells) { + doCellScan(p, cell); } } @@ -113,14 +106,30 @@ public void onUsingTick(ItemStack stack, EntityPlayer p, int count) { false); } } else { - this.startCell = null; + this.startCells.clear(); } } } - private ItemStack doScan(ItemStack stack, World world, EntityPlayer p, int count) { + private void doCellScan(EntityPlayer p, ItemStack cell) { + IMEInventory inv = AEApi.instance().registries().cell() + .getCellInventory(cell, (ISaveProvider) cellSaveManager, StorageChannel.ITEMS); + IItemList itemList = inv.getAvailableItems(AEApi.instance().storage().createItemList()); + + for (final IAEItemStack i : itemList) { + ScanResult sr = new ScanResult((byte) 1, Item.getIdFromItem(i.getItem()), i.getItemDamage(), null, ""); + if (ScanManager.isValidScanTarget(p, sr, "@")) { + + ScanManager.completeScan(p, sr, "@"); + PacketHandler.INSTANCE.sendToServer(new PacketScannedToServer(sr, p, "@")); + } + } + } + private ArrayList doScan(ItemStack stack, World world, EntityPlayer p, int count) { + + ArrayList cellsOutput = new ArrayList<>(); Entity pointedEntity = EntityUtils.getPointedEntity(p.worldObj, p, 0.5D, 10.0D, 0.0F, true); if (pointedEntity != null) { @@ -130,29 +139,54 @@ private ItemStack doScan(ItemStack stack, World world, EntityPlayer p, int count try { Thaumcraft.proxy.blockRunes( world, - (double) mop.blockX, + mop.blockX, (double) mop.blockY + 0.50D, - (double) mop.blockZ, + mop.blockZ, 0.3F, 0.3F, 0.7F + world.rand.nextFloat() * 0.7F, 15, -0.03F); - } catch (Exception e) {} - - ItemStack cell = (((EntityItem) pointedEntity).getEntityItem()); - return cell; + } catch (Exception ignored) {} + cellSaveManager = null; + cellsOutput.add(((EntityItem) pointedEntity).getEntityItem()); + return cellsOutput; } } } - return null; - + MovingObjectPosition lookingAtBlock = Minecraft.getMinecraft().objectMouseOver; + TileEntity blockAtPos = world + .getTileEntity(lookingAtBlock.blockX, lookingAtBlock.blockY, lookingAtBlock.blockZ); + if (blockAtPos instanceof ICellContainer) { + ((ICellContainer) blockAtPos).getCellArray(StorageChannel.ITEMS); + IInventory inv = (IInventory) blockAtPos; + cellSaveManager = blockAtPos; + try { + Thaumcraft.proxy.blockRunes( + world, + lookingAtBlock.blockX, + lookingAtBlock.blockY, + lookingAtBlock.blockZ, + 0.3F, + 0.3F, + 0.7F + world.rand.nextFloat() * 0.7F, + 15, + -0.03F); + } catch (Exception ignored) {} + for (int i = 0; i < inv.getSizeInventory(); i++) { + ItemStack itemStack = inv.getStackInSlot(i); + if (itemStack != null) { + cellsOutput.add(itemStack); + } + } + } + return cellsOutput; } public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { super.onPlayerStoppedUsing(par1ItemStack, par2World, par3EntityPlayer, par4); - this.startCell = null; + this.startCells.clear(); } }