mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 01:54:59 +00:00
Merge branch 'master' into super_stoker
This commit is contained in:
11 files changed
+63
-42
No files matched your search
@@ -33,7 +33,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
modid = FluidCraft.MODID,
|
||||
version = FluidCraft.VERSION,
|
||||
name = FluidCraft.MODNAME,
|
||||
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;required-after:Baubles;after:waila;after:thaumicenergistics;after:ae2wct")
|
||||
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;after:waila;after:thaumicenergistics;after:ae2wct")
|
||||
public class FluidCraft {
|
||||
|
||||
public static final String MODID = "ae2fc";
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
|
||||
|
||||
delegateContainer = new ContainerInterfaceTerminal(ip, monitorable);
|
||||
|
||||
this.bindPlayerInventory(ip, 14, 0);
|
||||
this.bindPlayerInventory(ip, 14, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,8 @@ import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.common.item.ItemBaseInfinityStorageCell;
|
||||
import com.glodblock.github.common.item.ItemFluidVoidStorageCell;
|
||||
import com.glodblock.github.crossmod.extracells.storage.ProxyFluidCellInventory;
|
||||
@@ -226,12 +228,9 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
if (types == 0) types = this.getTotalFluidTypes();
|
||||
if (l != null) {
|
||||
if (restrictionLong > 0) {
|
||||
remaining = Math.min((restrictionLong / types) - l.getStackSize(), this.getUnusedFluidCount());
|
||||
remaining = Math.min((restrictionLong / types) - l.getStackSize(), getRemainingFluidCount());
|
||||
} else {
|
||||
remaining = (((this.getTotalBytes() / types)
|
||||
- (int) Math.ceil((double) l.getStackSize() / singleByteAmount)
|
||||
- getBytesPerType()) * singleByteAmount)
|
||||
+ (singleByteAmount - l.getStackSize() % singleByteAmount);
|
||||
remaining = (((getTotalBytes() / types) - getBytesPerType()) * singleByteAmount) - l.getStackSize();
|
||||
}
|
||||
} else {
|
||||
if (restrictionLong > 0) {
|
||||
@@ -479,7 +478,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IAEFluidStack> getContents() {
|
||||
public @NotNull List<IAEFluidStack> getContents() {
|
||||
List<IAEFluidStack> ret = new ArrayList<>();
|
||||
for (IAEFluidStack fluid : this.getCellFluids()) {
|
||||
ret.add(fluid);
|
||||
|
||||
+5
-2
@@ -1,11 +1,14 @@
|
||||
package com.glodblock.github.common.storage;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.exceptions.AppEngException;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
@@ -109,7 +112,7 @@ public class FluidVoidStorageCellInventory extends FluidCellInventory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IAEFluidStack> getContents() {
|
||||
return null;
|
||||
public @NotNull List<IAEFluidStack> getContents() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import java.util.List;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
@@ -90,6 +92,7 @@ public interface IFluidCellInventory extends IMEInventory<IAEFluidStack> {
|
||||
*/
|
||||
long getTotalFluidTypes();
|
||||
|
||||
@NotNull
|
||||
List<IAEFluidStack> getContents();
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,9 +20,8 @@ public class SpeedWailaDataProvider extends BasePartWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaBody(final IPart part, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
if (part instanceof FCSharedFluidBus) {
|
||||
part.readFromNBT(accessor.getNBTData());
|
||||
currentToolTip.add(Tooltip.partFluidBusFormat(((FCSharedFluidBus) part).calculateAmountToSend() / 5));
|
||||
if (accessor.getNBTData().hasKey("BusSpeed")) {
|
||||
currentToolTip.add(Tooltip.partFluidBusFormat(accessor.getNBTData().getInteger("BusSpeed")));
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
@@ -30,8 +29,8 @@ public class SpeedWailaDataProvider extends BasePartWailaDataProvider {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final IPart part, final TileEntity te,
|
||||
final NBTTagCompound tag, final World world, final int x, final int y, final int z) {
|
||||
if (part instanceof FCSharedFluidBus) {
|
||||
part.writeToNBT(tag);
|
||||
if (part instanceof FCSharedFluidBus bus) {
|
||||
tag.setInteger("BusSpeed", bus.calculateAmountToSend() / 5);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ public class NEICellViewHandler implements IUsageHandler {
|
||||
int count = 0;
|
||||
for (IAEFluidStack aeFluid : sortedStacks) {
|
||||
FluidStack fluid = aeFluid.getFluidStack();
|
||||
long amount = fluid.amount;
|
||||
ItemStack fluidItemStack = ItemFluidDrop.newStack(fluid);
|
||||
if (fluidItemStack != null) {
|
||||
fluidItemStack.stackSize = 1;
|
||||
@@ -93,7 +92,7 @@ public class NEICellViewHandler implements IUsageHandler {
|
||||
fluidItemStack,
|
||||
OFFSET_X + count % ROW_ITEM_NUM * 18 + 1,
|
||||
ITEMS_OFFSET_Y + count / ROW_ITEM_NUM * 18 + 1);
|
||||
stacks.add(new ViewItemStack(positionedStack, amount, fluid.getFluid().getIcon(), fluid.getFluid().getColor()));
|
||||
stacks.add(new ViewItemStack(positionedStack, aeFluid.getStackSize(), fluid.getFluid().getIcon(), fluid.getFluid().getColor()));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-6
@@ -3,6 +3,7 @@ package com.glodblock.github.nei;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import com.glodblock.github.common.storage.IFluidCellInventory;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
|
||||
@@ -13,9 +14,10 @@ import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import codechicken.nei.SearchField;
|
||||
import codechicken.nei.SearchTokenParser;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
|
||||
public class NEIItemFilter implements SearchField.ISearchProvider {
|
||||
public class NEISearchFilter implements SearchTokenParser.ISearchParserProvider {
|
||||
|
||||
@Override
|
||||
public ItemFilter getFilter(String searchText) {
|
||||
@@ -24,8 +26,18 @@ public class NEIItemFilter implements SearchField.ISearchProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrimary() {
|
||||
return false;
|
||||
public char getPrefix() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumChatFormatting getHighlightedColor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchTokenParser.SearchMode getSearchMode() {
|
||||
return SearchTokenParser.SearchMode.ALWAYS;
|
||||
}
|
||||
|
||||
public static class Filter implements ItemFilter {
|
||||
@@ -40,13 +52,13 @@ public class NEIItemFilter implements SearchField.ISearchProvider {
|
||||
public boolean matches(ItemStack itemStack) {
|
||||
if (itemStack.getItem() instanceof IStorageFluidCell) {
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
|
||||
.getCellInventory(itemStack, null, StorageChannel.FLUIDS);
|
||||
.getCellInventory(itemStack, null, StorageChannel.FLUIDS);
|
||||
if (inventory instanceof final IFluidCellInventoryHandler handler) {
|
||||
final IFluidCellInventory cellInventory = handler.getCellInv();
|
||||
if (cellInventory != null) {
|
||||
for (IAEFluidStack fluid : cellInventory.getContents()) {
|
||||
boolean result = pattern.matcher(fluid.getFluidStack().getLocalizedName().toLowerCase())
|
||||
.find();
|
||||
.find();
|
||||
if (result) return true;
|
||||
}
|
||||
|
||||
@@ -57,5 +69,4 @@ public class NEIItemFilter implements SearchField.ISearchProvider {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class NEI_FC_Config implements IConfigureNEI {
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
API.registerNEIGuiHandler(new AE2FC_NEIGuiHandler());
|
||||
API.addSearchProvider(new NEIItemFilter());
|
||||
API.addSearchProvider(new NEISearchFilter());
|
||||
API.registerStackStringifyHandler(new FCStackStringifyHandler());
|
||||
API.registerUsageHandler(new NEICellViewHandler());
|
||||
|
||||
|
||||
@@ -61,12 +61,15 @@ import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import baubles.api.BaublesApi;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public final class Util {
|
||||
|
||||
public static boolean isBaublesLoaded = Loader.isModLoaded("Baubles");
|
||||
|
||||
public static int drainItemPower(AEBaseContainer c, InventoryPlayer ip, int slot, int ticks, double pm,
|
||||
IFluidPortableCell wt) {
|
||||
if (slot != -1) {
|
||||
@@ -183,16 +186,20 @@ public final class Util {
|
||||
return new ImmutablePair<>(i, is);
|
||||
}
|
||||
}
|
||||
IInventory handler = BaublesApi.getBaubles(player);
|
||||
if (handler != null) {
|
||||
invSize = handler.getSizeInventory();
|
||||
for (int i = 0; i < invSize; ++i) {
|
||||
ItemStack is = handler.getStackInSlot(i);
|
||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
return new ImmutablePair<>(GuiHelper.encodeType(i, GuiHelper.InvType.PLAYER_BAUBLES), is);
|
||||
|
||||
if (isBaublesLoaded) {
|
||||
IInventory handler = BaublesApi.getBaubles(player);
|
||||
if (handler != null) {
|
||||
invSize = handler.getSizeInventory();
|
||||
for (int i = 0; i < invSize; ++i) {
|
||||
ItemStack is = handler.getStackInSlot(i);
|
||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
return new ImmutablePair<>(GuiHelper.encodeType(i, GuiHelper.InvType.PLAYER_BAUBLES), is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user