Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No more drop drops from interface #265

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,20 @@
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.7.27-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-532-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-533-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.8.2:dev')
api("com.github.GTNewHorizons:GTNHLib:0.6.5:dev")
api("com.github.GTNewHorizons:GTNHLib:0.6.6:dev")

implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}

compileOnly("com.github.GTNewHorizons:GTNHLib:0.6.5:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.0.3:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.1:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.2:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.97:dev') {
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.99:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
Expand All @@ -61,5 +60,4 @@ dependencies {
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.22:dev") { transitive = false }

runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:0.6.5:dev")
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.glodblock.github.common.tile;

import java.io.IOException;
import java.util.List;

import javax.annotation.Nullable;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -218,4 +220,11 @@ public void setFluidInv(int id, IAEFluidStack fluid) {
getInternalFluid().setFluidInSlot(id, fluid);
}
}

@Override
public void getDrops(World w, int x, int y, int z, List<ItemStack> drops) {
this.fluidDuality.addDrops(drops);
this.fluidDuality.convertDrops(drops, this.getInterfaceDuality().getWaitingToSend());
super.getDrops(w, x, y, z, drops);
}
}
22 changes: 22 additions & 0 deletions src/main/java/com/glodblock/github/util/DualityFluidInterface.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.glodblock.github.util;

import java.util.List;
import java.util.Objects;

import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -458,4 +460,24 @@ private static class InterfaceInventory extends MEMonitorIFluidHandler {
super(tileInterface.tanks);
}
}

public void addDrops(final List<ItemStack> drops) {
for (int i = 0; i < NUMBER_OF_TANKS; i++) {
ItemStack is = ItemFluidPacket.newStack(this.tanks.getFluidStackInSlot(i));
if (is != null) {
drops.add(is);
}
}
}

public void convertDrops(final List<ItemStack> drops, final List<ItemStack> waitingToSend) {
if (waitingToSend != null) {
for (final ItemStack is : waitingToSend) {
if (is != null && is.getItem() instanceof ItemFluidDrop) {
drops.add(ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(is)));
is.stackSize = 0;
}
}
}
}
}