mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-23 13:30:04 +00:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64d2987c2d | ||
|
|
2688a312b9 | ||
|
|
2255d354e2 | ||
|
|
b3dc12ec3d | ||
|
|
a32f66e26b | ||
|
|
9b81cbb9c3 | ||
|
|
80aa78c784 | ||
|
|
101a465841 | ||
|
|
21ccf74f16 | ||
|
|
e614e9b5d2 | ||
|
|
aedd476ada | ||
|
|
ef2073bf02 | ||
|
|
7663cfcc2f | ||
|
|
9c69b39f13 | ||
|
|
5a766cdf69 | ||
|
|
fb20a8e9cb |
No files matched your search
+11
-11
@@ -34,30 +34,30 @@
|
||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||
*/
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.7.91-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-690-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.25-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-695-GTNH:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.8.14:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.40:dev")
|
||||
api('com.github.GTNewHorizons:waila:1.9.7:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.7.3:dev")
|
||||
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.7:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.15-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.2-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.17:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.26:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.469:dev') {
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.0:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.3:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.83:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.19-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.4-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.14-GTNH:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.108:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.7:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.0:dev")
|
||||
}
|
||||
+3
-1
@@ -96,7 +96,9 @@ usesMixinDebug = false
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.42'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.47'
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.render.tank.ModelCertusTank;
|
||||
import com.glodblock.github.common.item.ItemCertusQuartzTank;
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
@@ -35,7 +36,7 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,21 +50,22 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
.bindTexture(FluidCraft.resource("textures/blocks/certus_quartz_tank/map.png"));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glScalef(1, -1, -1);
|
||||
this.model.render(0.0625f);
|
||||
GL11.glScalef(1, -1, 1);
|
||||
this.model.render(0.0625f);
|
||||
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
if (item != null && item.hasTagCompound()) {
|
||||
FluidStack storedFluid = FluidStack
|
||||
.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("tileEntity"));
|
||||
int tankCapacity = 32000;
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
this.model.render(0.0625f);
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
|
||||
if (item.getItem() instanceof ItemCertusQuartzTank itemCertusQuartzTank) {
|
||||
FluidStack storedFluid = itemCertusQuartzTank.getFluid(item);
|
||||
int tankCapacity = itemCertusQuartzTank.getCapacity(item);
|
||||
|
||||
if (storedFluid != null && storedFluid.getFluid() != null) {
|
||||
IIcon fluidIcon = storedFluid.getFluid().getIcon();
|
||||
@@ -71,9 +73,12 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
if (ModAndClassUtil.HODGEPODGE && fluidIcon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) fluidIcon).markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
RenderBlocks renderer = new RenderBlocks();
|
||||
GL11.glScalef(1, 1, -1);
|
||||
Block waterBlock = FluidRegistry.WATER.getBlock();
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
renderer.setRenderBounds(
|
||||
0.08F,
|
||||
0.001F,
|
||||
@@ -81,9 +86,12 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
0.92F,
|
||||
(float) storedFluid.amount / (float) tankCapacity * 0.999F,
|
||||
0.92F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Block waterBlock = FluidRegistry.WATER.getBlock();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(
|
||||
(storedFluid.getFluid().getColor() >> 16 & 0xFF) / 255.0F,
|
||||
|
||||
@@ -25,8 +25,7 @@ public class ModelCertusTank extends ModelBase {
|
||||
this.textureHeight = 64;
|
||||
|
||||
this.Shape1 = new ModelRenderer(this, 0, 0);
|
||||
this.Shape1.addBox(0F, 0F, 0F, 14, 16, 14);
|
||||
this.Shape1.setRotationPoint(-7F, -8F, -7F);
|
||||
this.Shape1.addBox(-7F, -8F, -7F, 14, 16, 14);
|
||||
this.Shape1.setTextureSize(this.textureWidth, this.textureHeight);
|
||||
this.Shape1.mirror = true;
|
||||
setRotation(this.Shape1, 0F, 0F, 0F);
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.glodblock.github.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -16,11 +16,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import com.glodblock.github.common.item.ItemCertusQuartzTank;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
@@ -106,71 +107,104 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldObj, int x, int y, int z, EntityPlayer entityplayer, int blockID,
|
||||
float offsetX, float offsetY, float offsetZ) {
|
||||
ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
public boolean onBlockActivated(World worldObj, int x, int y, int z, EntityPlayer player, int side, float offsetX,
|
||||
float offsetY, float offsetZ) {
|
||||
ItemStack itemInHand = player.inventory.getCurrentItem();
|
||||
|
||||
if (entityplayer.isSneaking() && current != null) {
|
||||
if (current.getItem() instanceof IAEWrench
|
||||
&& ((IAEWrench) current.getItem()).canWrench(current, entityplayer, x, y, z)) {
|
||||
if (itemInHand == null || itemInHand.getItem() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// In case if we're holding a IFluidContainerItem which is also a block we'll just allow to place a block
|
||||
// instead of trying to fill or drain it. In other cases we don't need to handle blocks either way
|
||||
if (itemInHand.getItem() instanceof ItemBlock) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.isSneaking()) {
|
||||
if (itemInHand.getItem() instanceof IAEWrench wrench && wrench.canWrench(itemInHand, player, x, y, z)) {
|
||||
dropBlockAsItem(worldObj, x, y, z, getDropWithNBT(worldObj, x, y, z));
|
||||
worldObj.setBlockToAir(x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (current != null) {
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
|
||||
TileCertusQuartzTank tank = (TileCertusQuartzTank) worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if (liquid != null) {
|
||||
int amountFilled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
if (amountFilled != 0 && !entityplayer.capabilities.isCreativeMode && current.getItem() != null) {
|
||||
ItemStack empty;
|
||||
if (FluidContainerRegistry.isContainer(current)) {
|
||||
empty = FluidContainerRegistry.drainFluidContainer(current);
|
||||
} else {
|
||||
// Try this as a fallback.
|
||||
entityplayer.inventory.addItemStackToInventory(current.getItem().getContainerItem(current));
|
||||
empty = current.getItem().getContainerItem(current);
|
||||
}
|
||||
if (current.stackSize > 1) {
|
||||
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem].stackSize -= 1;
|
||||
entityplayer.inventory.addItemStackToInventory(empty);
|
||||
} else {
|
||||
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = empty;
|
||||
}
|
||||
TileCertusQuartzTank tank = (TileCertusQuartzTank) worldObj.getTileEntity(x, y, z);
|
||||
boolean isCreativeMode = player.capabilities.isCreativeMode;
|
||||
|
||||
if (FluidContainerRegistry.isFilledContainer(itemInHand)) {
|
||||
// Fill the tank from the container in hand
|
||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(itemInHand);
|
||||
|
||||
if (fluid == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int amountFilled = tank.fill(ForgeDirection.UNKNOWN, fluid, true);
|
||||
if (amountFilled > 0 && !isCreativeMode) {
|
||||
ItemStack empty = FluidContainerRegistry.drainFluidContainer(itemInHand);
|
||||
replaceItemInInventory(worldObj, player, itemInHand, empty);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (FluidContainerRegistry.isEmptyContainer(itemInHand)) {
|
||||
// Fill the container in hand from the tank
|
||||
FluidStack available = tank.getTankInfo(true)[0].fluid;
|
||||
ItemStack filled = FluidContainerRegistry.fillFluidContainer(available, itemInHand);
|
||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(filled);
|
||||
|
||||
if (fluid == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
tank.drain(ForgeDirection.UNKNOWN, fluid.amount, true);
|
||||
if (!isCreativeMode) {
|
||||
replaceItemInInventory(worldObj, player, itemInHand, filled);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (itemInHand.getItem() instanceof IFluidContainerItem) {
|
||||
ItemStack singleContainerItem = itemInHand.copy();
|
||||
singleContainerItem.stackSize = 1;
|
||||
|
||||
IFluidContainerItem fluidContainer = (IFluidContainerItem) singleContainerItem.getItem();
|
||||
assert fluidContainer != null;
|
||||
|
||||
FluidStack fluid = fluidContainer.getFluid(itemInHand);
|
||||
|
||||
if (fluid != null && fluid.amount > 0) {
|
||||
// Fill the tank from the container in hand
|
||||
int filled = tank.fill(ForgeDirection.UNKNOWN, fluid, true);
|
||||
if (filled > 0 && !isCreativeMode) {
|
||||
fluidContainer.drain(singleContainerItem, filled, true);
|
||||
replaceItemInInventory(worldObj, player, itemInHand, singleContainerItem);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
FluidStack available = tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
|
||||
if (available != null) {
|
||||
ItemStack filled = FluidContainerRegistry.fillFluidContainer(available, current);
|
||||
|
||||
liquid = FluidContainerRegistry.getFluidForFilledItem(filled);
|
||||
|
||||
if (liquid != null) {
|
||||
tank.drain(ForgeDirection.UNKNOWN, liquid.amount, true);
|
||||
if (!entityplayer.capabilities.isCreativeMode) {
|
||||
if (current.stackSize == 1) {
|
||||
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = filled;
|
||||
} else {
|
||||
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem].stackSize--;
|
||||
if (!entityplayer.inventory.addItemStackToInventory(filled))
|
||||
entityplayer.entityDropItem(filled, 0);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Fill the container in hand from the tank
|
||||
int containerCapacity = fluidContainer.getCapacity(itemInHand);
|
||||
FluidStack drained = tank.drain(ForgeDirection.UNKNOWN, containerCapacity, true);
|
||||
if (drained != null && drained.amount > 0 && !isCreativeMode) {
|
||||
fluidContainer.fill(singleContainerItem, drained, true);
|
||||
replaceItemInInventory(worldObj, player, itemInHand, singleContainerItem);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighborBlock) {
|
||||
if (!world.isRemote) {
|
||||
ChannelLoader.sendPacketToAllPlayers(world.getTileEntity(x, y, z).getDescriptionPacket(), world);
|
||||
private void replaceItemInInventory(World world, EntityPlayer player, ItemStack item, ItemStack replacement) {
|
||||
if (item.stackSize > 1) {
|
||||
item.stackSize--;
|
||||
// This method meant to be called both from client and server side, and trying to drop an item
|
||||
// from the client side would create a doubled ghost item, so we don't allow to do that
|
||||
if (!player.inventory.addItemStackToInventory(replacement) && !world.isRemote) {
|
||||
player.entityDropItem(replacement, 0);
|
||||
}
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, replacement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,4 +243,22 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World worldIn, int x, int y, int z, int side) {
|
||||
TileEntity tileEntity = worldIn.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileCertusQuartzTank tileCertusQuartzTank) {
|
||||
FluidTankInfo info = tileCertusQuartzTank.getTankInfo(false)[0];
|
||||
if (info.fluid != null) {
|
||||
int nonEmptyBump = info.fluid.amount > 0 ? 1 : 0;
|
||||
return (int) (14.0 * info.fluid.amount / info.capacity) + nonEmptyBump;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -138,19 +138,14 @@ public class ItemCertusQuartzTank extends BaseItemBlockContainer implements IFlu
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float hitX, float hitY, float hitZ, int metadata) {
|
||||
if (!world.setBlock(x, y, z, this.field_150939_a, metadata, 3)) {
|
||||
if (!super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlock(x, y, z) == this.field_150939_a) {
|
||||
this.field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
this.field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
if (stack != null) {
|
||||
((TileCertusQuartzTank) world.getTileEntity(x, y, z)).readFromItemNBT(stack.getTagCompound());
|
||||
}
|
||||
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
((TileCertusQuartzTank) world.getTileEntity(x, y, z))
|
||||
.readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
@@ -48,7 +49,6 @@ import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
@@ -230,6 +230,7 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
|
||||
}
|
||||
duality.setStorage(p2p.duality.getStorage());
|
||||
duality.setSlotInv(p2p.duality.getSlotInv());
|
||||
duality.sharedInventory = true;
|
||||
} else {
|
||||
if (duality.sharedInventory) {
|
||||
@@ -303,9 +304,13 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteMemoryCardData(PartP2PTunnel<?> newTunnel, NBTTagCompound data) throws GridAccessException {
|
||||
this.duality.getConfigManager().readFromNBT(data);
|
||||
super.pasteMemoryCardData(newTunnel, data);
|
||||
public PartP2PTunnel<?> applyMemoryCard(EntityPlayer player, IMemoryCard memoryCard, ItemStack is) {
|
||||
PartP2PTunnel<?> newTunnel = super.applyMemoryCard(player, memoryCard, is);
|
||||
NBTTagCompound data = memoryCard.getData(is);
|
||||
if (newTunnel instanceof PartFluidP2PInterface p2PInterface) {
|
||||
p2PInterface.duality.getConfigManager().readFromNBT(data);
|
||||
}
|
||||
return newTunnel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -341,41 +346,7 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer p, final Vec3 pos) {
|
||||
AppEngInternalInventory patterns = this.duality.getPatterns();
|
||||
|
||||
if (super.onPartActivate(p, pos)) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
if (patterns.getStackInSlot(i) == null) continue;
|
||||
drops.add(patterns.getStackInSlot(i));
|
||||
}
|
||||
|
||||
final IPart tile = this.getHost().getPart(this.getSide());
|
||||
if (tile instanceof PartFluidP2PInterface dualTile) {
|
||||
DualityInterface newDuality = dualTile.duality;
|
||||
// Copy interface storage, upgrades, and settings over
|
||||
UpgradeInventory upgrades = (UpgradeInventory) duality.getInventoryByName("upgrades");
|
||||
dualTile.duality.getStorage();
|
||||
UpgradeInventory newUpgrade = (UpgradeInventory) newDuality.getInventoryByName("upgrades");
|
||||
for (int i = 0; i < upgrades.getSizeInventory(); ++i) {
|
||||
newUpgrade.setInventorySlotContents(i, upgrades.getStackInSlot(i));
|
||||
}
|
||||
|
||||
if (!duality.sharedInventory) {
|
||||
IInventory storage = duality.getStorage();
|
||||
IInventory newStorage = newDuality.getStorage();
|
||||
for (int i = 0; i < storage.getSizeInventory(); ++i) {
|
||||
newStorage.setInventorySlotContents(i, storage.getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
||||
IConfigManager config = duality.getConfigManager();
|
||||
config.getSettings().forEach(
|
||||
setting -> newDuality.getConfigManager().putSetting(setting, config.getSetting(setting)));
|
||||
}
|
||||
TileEntity te = getTileEntity();
|
||||
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -395,6 +366,64 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
return true;
|
||||
}
|
||||
|
||||
private void dropPatterns(final PartFluidP2PInterface p2p) {
|
||||
final AppEngInternalInventory patterns = p2p.duality.getPatterns();
|
||||
final List<ItemStack> drops = new ArrayList<>();
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
if (patterns.getStackInSlot(i) == null) continue;
|
||||
drops.add(patterns.getStackInSlot(i));
|
||||
}
|
||||
if (!drops.isEmpty()) {
|
||||
final TileEntity te = p2p.getTileEntity();
|
||||
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyContents(final PartP2PTunnel<?> from) {
|
||||
if (from instanceof PartFluidP2PInterface fromInterface) {
|
||||
DualityInterface newDuality = this.duality;
|
||||
// Copy interface storage, upgrades, and settings over
|
||||
UpgradeInventory upgrades = (UpgradeInventory) fromInterface.duality.getInventoryByName("upgrades");
|
||||
UpgradeInventory newUpgrade = (UpgradeInventory) newDuality.getInventoryByName("upgrades");
|
||||
for (int i = 0; i < upgrades.getSizeInventory(); ++i) {
|
||||
newUpgrade.setInventorySlotContents(i, upgrades.getStackInSlot(i));
|
||||
}
|
||||
|
||||
if (!fromInterface.duality.sharedInventory) {
|
||||
IInventory storage = fromInterface.duality.getStorage();
|
||||
IInventory newStorage = newDuality.getStorage();
|
||||
for (int i = 0; i < storage.getSizeInventory(); ++i) {
|
||||
newStorage.setInventorySlotContents(i, storage.getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
||||
AppEngInternalInventory patterns = fromInterface.duality.getPatterns();
|
||||
boolean drop = true;
|
||||
if (!from.isOutput() && !this.isOutput()) { // input to input
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
newDuality.getPatterns().setInventorySlotContents(i, patterns.getStackInSlot(i));
|
||||
}
|
||||
drop = false;
|
||||
}
|
||||
|
||||
if (drop) {
|
||||
this.dropPatterns(fromInterface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copySettings(final PartP2PTunnel<?> from) {
|
||||
if (from instanceof PartFluidP2PInterface fromInterface) {
|
||||
DualityInterface newDuality = this.duality;
|
||||
|
||||
IConfigManager config = fromInterface.duality.getConfigManager();
|
||||
config.getSettings()
|
||||
.forEach(setting -> newDuality.getConfigManager().putSetting(setting, config.getSetting(setting)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getBreakingTexture() {
|
||||
return this.getItemStack().getIconIndex();
|
||||
|
||||
@@ -159,6 +159,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
final long bytesFree = this.getFreeBytes();
|
||||
return (bytesFree > this.getBytesPerType()
|
||||
|| (bytesFree == this.getBytesPerType() && this.getUnusedFluidCount() > 0))
|
||||
&& (restrictionLong <= 0 || restrictionLong > getStoredFluidCount())
|
||||
&& this.getRemainingFluidTypes() > 0;
|
||||
}
|
||||
|
||||
@@ -361,7 +362,12 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
if (cardDistribution) {
|
||||
remainingFluidSlots = this.getRemainingFluidCountDist(l);
|
||||
} else {
|
||||
remainingFluidSlots = this.getRemainingFluidCount();
|
||||
if (restrictionLong > 0) {
|
||||
remainingFluidSlots = this.getRemainingFluidCount();
|
||||
} else {
|
||||
remainingFluidSlots = this.getRemainingFluidCount()
|
||||
- (long) this.getBytesPerType() * singleByteAmount;
|
||||
}
|
||||
}
|
||||
|
||||
if (remainingFluidSlots <= 0) {
|
||||
|
||||
@@ -57,6 +57,7 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
|
||||
final IInventory upgrades = ci.getUpgradesInventory();
|
||||
boolean hasSticky = false;
|
||||
boolean hasInverter = false;
|
||||
|
||||
for (int x = 0; x < upgrades.getSizeInventory(); x++) {
|
||||
final ItemStack is = upgrades.getStackInSlot(x);
|
||||
@@ -64,11 +65,14 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
final Upgrades u = ((IUpgradeModule) is.getItem()).getType(is);
|
||||
if (u == Upgrades.STICKY) {
|
||||
hasSticky = true;
|
||||
break;
|
||||
} else if (u == Upgrades.INVERTER) {
|
||||
hasInverter = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setWhitelist(hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST);
|
||||
|
||||
if (hasSticky) {
|
||||
setSticky(true);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -14,26 +12,11 @@ import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
|
||||
private FluidStack lastBeforeUpdate = null;
|
||||
public FluidTank tank = new FluidTank(32000) {
|
||||
|
||||
@Override
|
||||
public FluidTank readFromNBT(NBTTagCompound nbt) {
|
||||
if (!nbt.hasKey("Empty")) {
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt);
|
||||
setFluid(fluid);
|
||||
} else {
|
||||
setFluid(null);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
private boolean hasUpdate;
|
||||
public FluidTank tank = new FluidTank(32000);
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
@@ -50,80 +33,51 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
return tankFluid == null || tankFluid.amount == 0 ? 0 : tankFluid.getFluid().getLuminosity(tankFluid);
|
||||
}
|
||||
|
||||
public void compareAndUpdate() {
|
||||
if (!this.worldObj.isRemote) {
|
||||
FluidStack current = this.tank.getFluid();
|
||||
if (current != null) {
|
||||
if (this.lastBeforeUpdate != null) {
|
||||
if (Math.abs(current.amount - this.lastBeforeUpdate.amount) >= 500) {
|
||||
ChannelLoader.sendPacketToAllPlayers(getDescriptionPacket(), this.worldObj);
|
||||
this.lastBeforeUpdate = current.copy();
|
||||
} else if (this.lastBeforeUpdate.amount < this.tank.getCapacity()
|
||||
&& current.amount == this.tank.getCapacity()
|
||||
|| this.lastBeforeUpdate.amount == this.tank.getCapacity()
|
||||
&& current.amount < this.tank.getCapacity()) {
|
||||
ChannelLoader.sendPacketToAllPlayers(getDescriptionPacket(), this.worldObj);
|
||||
this.lastBeforeUpdate = current.copy();
|
||||
}
|
||||
} else {
|
||||
ChannelLoader.sendPacketToAllPlayers(getDescriptionPacket(), this.worldObj);
|
||||
this.lastBeforeUpdate = current.copy();
|
||||
}
|
||||
} else if (this.lastBeforeUpdate != null) {
|
||||
ChannelLoader.sendPacketToAllPlayers(getDescriptionPacket(), this.worldObj);
|
||||
this.lastBeforeUpdate = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FluidStack drain(FluidStack fluid, boolean doDrain, boolean findMainTank) {
|
||||
if (fluid == null || this.getFluid() == null || this.getFluid() != fluid.getFluid()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (findMainTank) {
|
||||
int yOff = 0;
|
||||
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord + yOff, this.zCoord);
|
||||
// Main tank is the highest tank in the column with desired fluid
|
||||
TileCertusQuartzTank mainTank = this;
|
||||
while (true) {
|
||||
if (offTE instanceof TileCertusQuartzTank) {
|
||||
Fluid offFluid = ((TileCertusQuartzTank) offTE).getFluid();
|
||||
if (offFluid != null && offFluid == fluid.getFluid()) {
|
||||
mainTank = (TileCertusQuartzTank) this.worldObj
|
||||
.getTileEntity(this.xCoord, this.yCoord + yOff, this.zCoord);
|
||||
yOff++;
|
||||
offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord + yOff, this.zCoord);
|
||||
continue;
|
||||
}
|
||||
TileCertusQuartzTank tankAbove;
|
||||
|
||||
while ((tankAbove = mainTank.getTankAbove()) != null) {
|
||||
// We can't drain tank with different or null fluid
|
||||
if (fluid.getFluid() != tankAbove.getFluid()) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
mainTank = tankAbove;
|
||||
}
|
||||
|
||||
return mainTank != null ? mainTank.drain(fluid, doDrain, false) : null;
|
||||
return mainTank.drain(fluid, doDrain, false);
|
||||
}
|
||||
|
||||
FluidStack drained = this.tank.drain(fluid.amount, doDrain);
|
||||
compareAndUpdate();
|
||||
FluidStack drainedFluid = this.tank.drain(fluid.amount, doDrain);
|
||||
int drained = drainedFluid != null ? drainedFluid.amount : 0;
|
||||
|
||||
if (drained == null || drained.amount < fluid.amount) {
|
||||
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord);
|
||||
if (offTE instanceof TileCertusQuartzTank tileCertusQuartzTank) {
|
||||
FluidStack externallyDrained = tileCertusQuartzTank.drain(
|
||||
new FluidStack(fluid.getFluid(), fluid.amount - (drained != null ? drained.amount : 0)),
|
||||
doDrain,
|
||||
false);
|
||||
if (drained > 0) {
|
||||
update();
|
||||
}
|
||||
|
||||
if (externallyDrained != null) return new FluidStack(
|
||||
fluid.getFluid(),
|
||||
(drained != null ? drained.amount : 0) + externallyDrained.amount);
|
||||
else return drained;
|
||||
if (drained < fluid.amount) {
|
||||
TileCertusQuartzTank tankBelow = this.getTankBelow();
|
||||
if (tankBelow != null) {
|
||||
FluidStack fluidToDrain = new FluidStack(fluid.getFluid(), fluid.amount - drained);
|
||||
FluidStack externallyDrained = tankBelow.drain(fluidToDrain, doDrain, false);
|
||||
|
||||
if (externallyDrained != null) {
|
||||
return new FluidStack(fluid.getFluid(), drained + externallyDrained.amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return drained;
|
||||
return drainedFluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
if (this.tank.getFluid() == null || resource == null || resource.getFluid() != this.tank.getFluid().getFluid())
|
||||
return null;
|
||||
|
||||
return drain(resource, doDrain, true);
|
||||
}
|
||||
|
||||
@@ -135,35 +89,42 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
}
|
||||
|
||||
public int fill(FluidStack fluid, boolean doFill, boolean findMainTank) {
|
||||
if (fluid == null || this.getFluid() != null && this.getFluid() != fluid.getFluid()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (findMainTank) {
|
||||
int yOff = 0;
|
||||
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - yOff, this.zCoord);
|
||||
// Main tank is the lowest tank in the column with desired fluid
|
||||
TileCertusQuartzTank mainTank = this;
|
||||
while (true) {
|
||||
if (offTE instanceof TileCertusQuartzTank) {
|
||||
Fluid offFluid = ((TileCertusQuartzTank) offTE).getFluid();
|
||||
if (offFluid == null || offFluid == fluid.getFluid()) {
|
||||
mainTank = (TileCertusQuartzTank) this.worldObj
|
||||
.getTileEntity(this.xCoord, this.yCoord - yOff, this.zCoord);
|
||||
yOff++;
|
||||
offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - yOff, this.zCoord);
|
||||
continue;
|
||||
}
|
||||
TileCertusQuartzTank tankBelow;
|
||||
|
||||
while ((tankBelow = mainTank.getTankBelow()) != null) {
|
||||
FluidStack fluidBelow = tankBelow.tank.getFluid();
|
||||
// We can't fill already full tank
|
||||
if (fluidBelow != null && fluidBelow.amount == tankBelow.tank.getCapacity()) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// We can't fill tank with different fluid
|
||||
if (tankBelow.getFluid() != null && fluid.getFluid() != tankBelow.getFluid()) {
|
||||
break;
|
||||
}
|
||||
mainTank = tankBelow;
|
||||
}
|
||||
|
||||
return mainTank != null ? mainTank.fill(fluid, doFill, false) : 0;
|
||||
return mainTank.fill(fluid, doFill, false);
|
||||
}
|
||||
|
||||
int filled = this.tank.fill(fluid, doFill);
|
||||
compareAndUpdate();
|
||||
|
||||
if (filled > 0) {
|
||||
update();
|
||||
}
|
||||
|
||||
if (filled < fluid.amount) {
|
||||
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
||||
if (offTE instanceof TileCertusQuartzTank tileCertusQuartzTank) {
|
||||
return filled + tileCertusQuartzTank
|
||||
.fill(new FluidStack(fluid.getFluid(), fluid.amount - filled), doFill, false);
|
||||
TileCertusQuartzTank tankAbove = this.getTankAbove();
|
||||
if (tankAbove != null) {
|
||||
FluidStack fluidToFill = new FluidStack(fluid.getFluid(), fluid.amount - filled);
|
||||
return filled + tankAbove.fill(fluidToFill, doFill, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,18 +136,9 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
*/
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
if (resource == null || this.tank.getFluid() != null && resource.getFluid() != this.tank.getFluid().getFluid())
|
||||
return 0;
|
||||
return fill(resource, doFill, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag);
|
||||
}
|
||||
|
||||
public Fluid getFluid() {
|
||||
FluidStack tankFluid = this.tank.getFluid();
|
||||
return tankFluid != null && tankFluid.amount > 0 ? tankFluid.getFluid() : null;
|
||||
@@ -200,84 +152,57 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
return (float) this.tank.getFluidAmount() / this.tank.getCapacity();
|
||||
}
|
||||
|
||||
private void onComparatorUpdate(World world, int x, int y, int z, Block block) {
|
||||
world.func_147453_f(x, y, z, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (this.tank.getFluid() != null) {
|
||||
TileCertusQuartzTank below = getTankBelow(this);
|
||||
if (below != null) {
|
||||
FluidStack filled = this.tank.getFluid().copy();
|
||||
filled.amount = below.fill(this.tank.getFluid(), true, true);
|
||||
if (filled.amount >= 0) {
|
||||
this.drain(filled, true, true);
|
||||
this.hasUpdate = true;
|
||||
below.hasUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasUpdate) {
|
||||
onComparatorUpdate(this.worldObj, this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
|
||||
this.hasUpdate = false;
|
||||
}
|
||||
}
|
||||
|
||||
private TileCertusQuartzTank getTankBelow(TileEntity tile) {
|
||||
TileEntity tank = new BlockPos(tile).getOffSet(0, -1, 0).getTileEntity();
|
||||
if (tank instanceof TileCertusQuartzTank) {
|
||||
return (TileCertusQuartzTank) tank;
|
||||
private TileCertusQuartzTank getTankAbove() {
|
||||
TileEntity tile = new BlockPos(this).getOffSet(0, 1, 0).getTileEntity();
|
||||
if (tile instanceof TileCertusQuartzTank tankTile) {
|
||||
return tankTile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public FluidTankInfo[] getTankInfo(boolean goToMainTank) {
|
||||
if (!goToMainTank) return new FluidTankInfo[] { this.tank.getInfo() };
|
||||
private TileCertusQuartzTank getTankBelow() {
|
||||
TileEntity tile = new BlockPos(this).getOffSet(0, -1, 0).getTileEntity();
|
||||
if (tile instanceof TileCertusQuartzTank tankTile) {
|
||||
return tankTile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
int amount = 0, capacity = 0;
|
||||
Fluid fluid = null;
|
||||
|
||||
int yOff = 0;
|
||||
TileEntity offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - yOff, this.zCoord);
|
||||
TileCertusQuartzTank mainTank;
|
||||
while (true) {
|
||||
if (offTE instanceof TileCertusQuartzTank) {
|
||||
if (((TileCertusQuartzTank) offTE).getFluid() == null
|
||||
|| ((TileCertusQuartzTank) offTE).getFluid() == getFluid()) {
|
||||
yOff++;
|
||||
offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - yOff, this.zCoord);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
public FluidTankInfo[] getTankInfo(boolean countAllTanksInColumn) {
|
||||
if (!countAllTanksInColumn) {
|
||||
return new FluidTankInfo[] { this.tank.getInfo() };
|
||||
}
|
||||
|
||||
yOff -= 1;
|
||||
offTE = this.worldObj.getTileEntity(this.xCoord, this.yCoord - yOff, this.zCoord);
|
||||
while (true) {
|
||||
if (offTE instanceof TileCertusQuartzTank) {
|
||||
mainTank = (TileCertusQuartzTank) offTE;
|
||||
if (mainTank.getFluid() == null || getFluid() == null || mainTank.getFluid() == getFluid()) {
|
||||
FluidTankInfo info = mainTank.getTankInfo(false)[0];
|
||||
if (info != null) {
|
||||
capacity += info.capacity;
|
||||
if (info.fluid != null) {
|
||||
amount += info.fluid.amount;
|
||||
if (info.fluid.getFluid() != null) fluid = info.fluid.getFluid();
|
||||
}
|
||||
}
|
||||
offTE = new BlockPos(offTE).getOffSet(0, 1, 0).getTileEntity();
|
||||
continue;
|
||||
}
|
||||
final FluidStack tankFluidStack = this.tank.getFluid();
|
||||
final Fluid mainFluid = tankFluidStack != null ? tankFluidStack.getFluid() : null;
|
||||
|
||||
int amount = tankFluidStack == null ? 0 : tankFluidStack.amount;
|
||||
int capacity = this.tank.getCapacity();
|
||||
|
||||
TileCertusQuartzTank tankAbove = this;
|
||||
while ((tankAbove = tankAbove.getTankAbove()) != null) {
|
||||
if (tankAbove.getFluid() == null || mainFluid != tankAbove.getFluid()) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
FluidTankInfo info = tankAbove.tank.getInfo();
|
||||
amount += info.fluid == null ? 0 : info.fluid.amount;
|
||||
capacity += info.capacity;
|
||||
}
|
||||
|
||||
TileCertusQuartzTank tankBelow = this;
|
||||
while ((tankBelow = tankBelow.getTankBelow()) != null) {
|
||||
if (mainFluid == null || mainFluid != tankBelow.getFluid()) {
|
||||
break;
|
||||
}
|
||||
|
||||
FluidTankInfo info = tankBelow.tank.getInfo();
|
||||
amount += info.fluid == null ? 0 : info.fluid.amount;
|
||||
capacity += info.capacity;
|
||||
}
|
||||
|
||||
return new FluidTankInfo[] {
|
||||
new FluidTankInfo(fluid != null ? new FluidStack(fluid, amount) : null, capacity) };
|
||||
new FluidTankInfo(mainFluid != null ? new FluidStack(mainFluid, amount) : null, capacity) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,6 +210,49 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
return getTankInfo(true);
|
||||
}
|
||||
|
||||
public FluidTankInfo[] getInternalFluid() {
|
||||
return this.getTankInfo(true);
|
||||
}
|
||||
|
||||
private void flowFluidDown(boolean checkTankAbove) {
|
||||
if (this.getFluid() != null) {
|
||||
TileCertusQuartzTank below = getTankBelow();
|
||||
if (below != null) {
|
||||
FluidStack fluid = this.tank.getFluid().copy();
|
||||
int amount = below.tank.fill(fluid, true);
|
||||
if (amount > 0) {
|
||||
this.tank.drain(amount, true);
|
||||
this.update();
|
||||
below.update();
|
||||
below.flowFluidDown(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (checkTankAbove) {
|
||||
TileCertusQuartzTank above = getTankAbove();
|
||||
if (above != null && above.getFluid() != null) {
|
||||
if (this.getFluid() == null || this.getFluid() == above.getFluid()) {
|
||||
above.flowFluidDown(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
if (!this.worldObj.isRemote) {
|
||||
markDirty();
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
this.worldObj.markBlockRangeForRenderUpdate(
|
||||
@@ -307,6 +275,15 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
this.tank.readFromNBT(tag);
|
||||
}
|
||||
|
||||
// Specifically used when player is placing a tank in world,
|
||||
// so we can apply the item's NBT and flow down its fluid in lower tanks
|
||||
public void readFromItemNBT(NBTTagCompound tag) {
|
||||
if (tag != null) {
|
||||
this.readFromNBTWithoutCoords(tag.getCompoundTag("tileEntity"));
|
||||
}
|
||||
this.flowFluidDown(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
@@ -316,8 +293,4 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
public void writeToNBTWithoutCoords(NBTTagCompound tag) {
|
||||
this.tank.writeToNBT(tag);
|
||||
}
|
||||
|
||||
public FluidTankInfo[] getInternalFluid() {
|
||||
return this.getTankInfo(true);
|
||||
}
|
||||
}
|
||||
@@ -182,22 +182,28 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out, int iteration) {
|
||||
if (itemCache == null) {
|
||||
itemCache = AEApi.instance().storage().createItemList();
|
||||
if (this.itemCache == null) {
|
||||
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
|
||||
if (fluidGrid != null) {
|
||||
for (IAEFluidStack fluid : fluidGrid.getStorageList()) {
|
||||
final IItemList<IAEFluidStack> fluidStorage = fluidGrid.getStorageList();
|
||||
this.itemCache = AEApi.instance().storage().createItemList();
|
||||
|
||||
for (IAEFluidStack fluid : fluidStorage) {
|
||||
IAEItemStack stack = ItemFluidDrop.newAeStack(fluid);
|
||||
if (stack != null
|
||||
&& !FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getFluid().getClass())) {
|
||||
itemCache.add(stack);
|
||||
this.itemCache.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (IAEItemStack stack : itemCache) {
|
||||
out.addStorage(stack);
|
||||
|
||||
if (this.itemCache != null) {
|
||||
for (IAEItemStack stack : this.itemCache) {
|
||||
out.addStorage(stack);
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,24 +252,24 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added) {
|
||||
switch (mc) {
|
||||
case setInventorySlotContents -> {
|
||||
if (added != null) {
|
||||
if (inv == cell) {
|
||||
if (inv == cell) {
|
||||
if (added != null) {
|
||||
if (added.getItem() instanceof ItemBasicStorageCell ibsc) {
|
||||
totalBytes = ibsc.getBytesLong(added);
|
||||
} else if (added.getItem() instanceof FCBaseItemCell fcbic) {
|
||||
totalBytes = fcbic.getBytes(added);
|
||||
}
|
||||
getProxy().setIdlePowerUsage(Math.sqrt(Math.pow(totalBytes, 0.576D)));
|
||||
} else if (inv == invItems) {
|
||||
storedItemCount += added.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
if (removed != null) {
|
||||
if (inv == cell) {
|
||||
} else if (removed != null) {
|
||||
totalBytes = 0;
|
||||
getProxy().setIdlePowerUsage(4d);
|
||||
} else if (inv == invItems) {
|
||||
}
|
||||
} else if (inv == invItems) {
|
||||
if (added != null) {
|
||||
storedItemCount += added.stackSize;
|
||||
}
|
||||
|
||||
if (removed != null) {
|
||||
storedItemCount -= removed.stackSize;
|
||||
}
|
||||
}
|
||||
@@ -279,11 +279,12 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
totalBytes = 0;
|
||||
getProxy().setIdlePowerUsage(4d);
|
||||
}
|
||||
|
||||
if (inv == invItems) {
|
||||
storedItemCount -= removed.stackSize;
|
||||
}
|
||||
}
|
||||
case markDirty -> {}
|
||||
case markDirty -> markDirty();
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
public class CertusQuartzTankWailaDataProvider extends BaseWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
TileEntity tileEntity = accessor.getTileEntity();
|
||||
if (tileEntity instanceof TileCertusQuartzTank quartzTank) {
|
||||
FluidTankInfo info = quartzTank.getTankInfo(true)[0];
|
||||
if (info.fluid != null) {
|
||||
currentToolTip
|
||||
.add(Tooltip.fluidFormat(info.fluid.getLocalizedName(), info.fluid.amount, info.capacity));
|
||||
}
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.crossmod.waila.vanilla.FluidInvWailaDataProvider;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class VanillaTileWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
private final List<IWailaDataProvider> providers;
|
||||
|
||||
public VanillaTileWailaDataProvider() {
|
||||
final IWailaDataProvider fluidInv = new FluidInvWailaDataProvider();
|
||||
this.providers = Lists.newArrayList(fluidInv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaHead(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaBody(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaTail(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getNBTData(player, te, tag, world, x, y, z);
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.tile.AEBaseTile;
|
||||
@@ -26,9 +27,9 @@ public class WailaInit {
|
||||
registrar.registerBodyProvider(tile, AEBaseTile.class);
|
||||
registrar.registerNBTProvider(tile, AEBaseTile.class);
|
||||
|
||||
final IWailaDataProvider vanillaTile = new VanillaTileWailaDataProvider();
|
||||
registrar.registerBodyProvider(vanillaTile, TileEntity.class);
|
||||
registrar.registerNBTProvider(vanillaTile, TileEntity.class);
|
||||
|
||||
if (!ModAndClassUtil.WAILA_PLUGINS) {
|
||||
final IWailaDataProvider certusQuartzTank = new CertusQuartzTankWailaDataProvider();
|
||||
registrar.registerBodyProvider(certusQuartzTank, TileCertusQuartzTank.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
package com.glodblock.github.crossmod.waila.vanilla;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
public class FluidInvWailaDataProvider extends BaseWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if (te instanceof TileCertusQuartzTank) {
|
||||
if (accessor.getNBTData().hasKey("fluidInv")) {
|
||||
NBTTagCompound data = (NBTTagCompound) accessor.getNBTData().getTag("fluidInv");
|
||||
for (FluidTankInfo info : Util.FluidUtil.fluidTankInfoReadFromNBT(data)) {
|
||||
if (info.fluid == null) continue;
|
||||
currentToolTip
|
||||
.add(Tooltip.fluidFormat(info.fluid.getLocalizedName(), info.fluid.amount, info.capacity));
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
if (te instanceof TileCertusQuartzTank) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
Util.FluidUtil.fluidTankInfoWriteToNBT(((TileCertusQuartzTank) te).getInternalFluid(), data);
|
||||
tag.setTag("fluidInv", data);
|
||||
te.writeToNBT(tag);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
|
||||
private final HashMap<IMEMonitorHandlerReceiver<IAEFluidStack>, Object> listeners = new HashMap<>();
|
||||
private BaseActionSource mySource;
|
||||
private StorageFilter mode;
|
||||
private boolean init = false;
|
||||
|
||||
public MEMonitorIFluidHandler(IFluidHandler handler, ForgeDirection side) {
|
||||
this.mode = StorageFilter.EXTRACTABLE_ONLY;
|
||||
@@ -223,7 +224,10 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
|
||||
}
|
||||
|
||||
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
|
||||
|
||||
if (!init) {
|
||||
this.onTick();
|
||||
init = true;
|
||||
}
|
||||
for (IAEFluidStack fs : this.cache) {
|
||||
out.addStorage(fs);
|
||||
}
|
||||
@@ -233,6 +237,10 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
|
||||
|
||||
@Override
|
||||
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
|
||||
if (!init) {
|
||||
this.onTick();
|
||||
init = true;
|
||||
}
|
||||
return this.cache.findPrecise(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.glodblock.github.loader;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.network.CPacketCraftRequest;
|
||||
import com.glodblock.github.network.CPacketDumpTank;
|
||||
@@ -100,12 +96,4 @@ public class ChannelLoader implements Runnable {
|
||||
id++,
|
||||
Side.CLIENT);
|
||||
}
|
||||
|
||||
public static void sendPacketToAllPlayers(Packet packet, World world) {
|
||||
for (Object player : world.playerEntities) {
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,6 +136,18 @@ public class CommonProxy {
|
||||
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.QUANTUM_CELL), 1);
|
||||
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.SINGULARITY_CELL), 1);
|
||||
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_VOID_CELL), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL1K), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL4K), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL16K), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL64K), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL256K), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024K), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096K), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384K), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.QUANTUM_CELL), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.SINGULARITY_CELL), 1);
|
||||
|
||||
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL1K), 1);
|
||||
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL4K), 1);
|
||||
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL16K), 1);
|
||||
@@ -156,6 +168,16 @@ public class CommonProxy {
|
||||
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384KM), 1);
|
||||
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.ARTIFICIAL_UNIVERSE_CELL), 1);
|
||||
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL1KM), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL4KM), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL16KM), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL64KM), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL256KM), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024KM), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096KM), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384KM), 1);
|
||||
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.ARTIFICIAL_UNIVERSE_CELL), 1);
|
||||
|
||||
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL1KM), 1);
|
||||
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL4KM), 1);
|
||||
Upgrades.VOID_OVERFLOW.registerItem(new ItemStack(ItemAndBlockHolder.CELL16KM), 1);
|
||||
|
||||
@@ -32,6 +32,7 @@ public final class ModAndClassUtil {
|
||||
public static boolean COFH = false;
|
||||
public static boolean GTPP = false;
|
||||
public static boolean WAILA = false;
|
||||
public static boolean WAILA_PLUGINS = false;
|
||||
public static boolean AVARITIA = false;
|
||||
public static boolean HODGEPODGE = false;
|
||||
public static boolean NEW_HORIZONS_CORE_MOD = false;
|
||||
@@ -147,6 +148,7 @@ public final class ModAndClassUtil {
|
||||
if (Loader.isModLoaded("CoFHCore")) COFH = true;
|
||||
if (Loader.isModLoaded("miscutils")) GTPP = true;
|
||||
if (Loader.isModLoaded("Waila")) WAILA = true;
|
||||
if (Loader.isModLoaded("wailaplugins")) WAILA_PLUGINS = true;
|
||||
if (Loader.isModLoaded("Avaritia")) AVARITIA = true;
|
||||
if (Loader.isModLoaded("hodgepodge")) HODGEPODGE = true;
|
||||
if (Loader.isModLoaded("dreamcraft")) NEW_HORIZONS_CORE_MOD = true;
|
||||
|
||||
@@ -7,8 +7,6 @@ import static com.glodblock.github.util.Util.DimensionalCoordSide.hasEnergyCard;
|
||||
import static net.minecraft.init.Items.glass_bottle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -24,7 +22,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
@@ -510,36 +507,6 @@ public final class Util {
|
||||
|
||||
public static final ItemStack water_bucket = new ItemStack(Items.water_bucket, 1);
|
||||
|
||||
public static void fluidTankInfoWriteToNBT(FluidTankInfo[] infos, NBTTagCompound data) {
|
||||
int i = 0;
|
||||
for (FluidTankInfo info : infos) {
|
||||
if (info.fluid != null && info.fluid.amount > 0) {
|
||||
NBTTagCompound fs = new NBTTagCompound();
|
||||
info.fluid.writeToNBT(fs);
|
||||
fs.setInteger("capacity", info.capacity);
|
||||
data.setTag("#" + i, fs);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
data.setInteger("fluidInvSize", i);
|
||||
}
|
||||
|
||||
public static FluidTankInfo[] fluidTankInfoReadFromNBT(NBTTagCompound data) {
|
||||
int i = 0;
|
||||
List<FluidTankInfo> infos = new ArrayList<>();
|
||||
while (data.hasKey("fluidInvSize") && i < data.getInteger("fluidInvSize")) {
|
||||
if (data.hasKey("#" + i)) {
|
||||
NBTTagCompound tag = (NBTTagCompound) data.getTag("#" + i);
|
||||
FluidStack fs = FluidStack.loadFluidStackFromNBT(tag);
|
||||
infos.add(new FluidTankInfo(fs, tag.getInteger("capacity")));
|
||||
} else {
|
||||
infos.add(new FluidTankInfo(null, 0));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return infos.toArray(new FluidTankInfo[0]);
|
||||
}
|
||||
|
||||
public static IAEFluidStack createAEFluidStack(Fluid fluid) {
|
||||
return createAEFluidStack(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user