mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-23 13:30:04 +00:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d650636479 | ||
|
|
2e6bfe6aac | ||
|
|
219f8c313a | ||
|
|
0d5f682d3a | ||
|
|
adee911b77 | ||
|
|
8909e28ea3 | ||
|
|
0207ffe430 | ||
|
|
3bb08974ce | ||
|
|
2a2f22ce44 | ||
|
|
4a2b662dee |
No files matched your search
+1
-2
@@ -35,7 +35,7 @@
|
||||
*/
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.33-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-732-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-739-GTNH:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.9.7:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.8.0:dev")
|
||||
@@ -57,7 +57,6 @@ dependencies {
|
||||
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23: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.7.11:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.0:dev")
|
||||
}
|
||||
@@ -19,9 +19,7 @@ import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
@@ -97,10 +95,6 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
|
||||
IIcon icon = fluid.getIcon();
|
||||
if (icon == null) return;
|
||||
|
||||
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -109,7 +103,7 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
|
||||
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
|
||||
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
|
||||
(fluid.getColor() & 0xFF) / 255.0F);
|
||||
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
|
||||
drawTexturedModelRectFromIcon(posX, posY, icon, 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
@@ -17,10 +17,9 @@ 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;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
@@ -35,7 +34,7 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,31 +48,32 @@ 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();
|
||||
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
|
||||
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 +81,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,
|
||||
|
||||
@@ -13,9 +13,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -46,16 +44,9 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(item);
|
||||
int RGB = 0xFFFFFF;
|
||||
if (fluid != null) {
|
||||
RGB = fluid.getFluid().getColor(fluid);
|
||||
}
|
||||
int RGB = fluid == null ? 0xFFFFFF : fluid.getFluid().getColor(fluid);
|
||||
IIcon icon = fluid == null ? FluidRegistry.WATER.getStillIcon() : fluid.getFluid().getStillIcon();
|
||||
|
||||
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
if (RGB != 0xFFFFFF) {
|
||||
GL11.glColor3f((RGB >> 16 & 0xFF) / 255.0F, (RGB >> 8 & 0xFF) / 255.0F, (RGB & 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,11 @@ 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.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 +106,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -310,6 +310,7 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
@Override
|
||||
public PartP2PTunnel<?> applyMemoryCard(EntityPlayer player, IMemoryCard memoryCard, ItemStack is) {
|
||||
PartP2PTunnel<?> newTunnel = super.applyMemoryCard(player, memoryCard, is);
|
||||
if (Platform.isClient()) return newTunnel;
|
||||
NBTTagCompound data = memoryCard.getData(is);
|
||||
if (newTunnel instanceof PartFluidP2PInterface p2PInterface) {
|
||||
p2PInterface.duality.getConfigManager().readFromNBT(data);
|
||||
@@ -400,6 +401,12 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
for (int i = 0; i < storage.getSizeInventory(); ++i) {
|
||||
newStorage.setInventorySlotContents(i, storage.getStackInSlot(i));
|
||||
}
|
||||
|
||||
IInventory config = fromInterface.duality.getInventoryByName("config");
|
||||
IInventory newConfig = newDuality.getInventoryByName("config");
|
||||
for (int i = 0; i < config.getSizeInventory(); ++i) {
|
||||
newConfig.setInventorySlotContents(i, config.getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
||||
AppEngInternalInventory patterns = fromInterface.duality.getPatterns();
|
||||
|
||||
@@ -219,12 +219,16 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
public long getRemainingFluidCountDist(IAEFluidStack l) {
|
||||
long remaining;
|
||||
long types = 0;
|
||||
for (int i = 0; i < this.getTotalFluidTypes(); i++) {
|
||||
if (this.getConfigInventory().getStackInSlot(i) != null) {
|
||||
long maxFluidTypes = this.getTotalFluidTypes();
|
||||
IInventory configInventory = this.getConfigInventory();
|
||||
for (int i = 0; i < configInventory.getSizeInventory(); i++) {
|
||||
// Check all partition slots to determine min distribution behaviour until max fluid types is reached
|
||||
if (types >= maxFluidTypes) break;
|
||||
if (configInventory.getStackInSlot(i) != null) {
|
||||
types++;
|
||||
}
|
||||
}
|
||||
if (types == 0) types = this.getTotalFluidTypes();
|
||||
if (types == 0) types = maxFluidTypes;
|
||||
if (l != null) {
|
||||
if (restrictionLong > 0) {
|
||||
remaining = Math.min((restrictionLong / types) - l.getStackSize(), getRemainingFluidCount());
|
||||
|
||||
@@ -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,14 +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);
|
||||
private boolean hasUpdate;
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
@@ -38,32 +33,6 @@ 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) {
|
||||
return;
|
||||
}
|
||||
|
||||
FluidStack current = this.tank.getFluid();
|
||||
|
||||
if (current == null || this.lastBeforeUpdate == null) {
|
||||
if (current != this.lastBeforeUpdate) {
|
||||
ChannelLoader.sendPacketToAllPlayers(getDescriptionPacket(), this.worldObj);
|
||||
this.lastBeforeUpdate = current == null ? null : current.copy();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean amountSufficientlyChanged = Math.abs(current.amount - this.lastBeforeUpdate.amount) >= 500;
|
||||
boolean isFull = current.amount == this.tank.getCapacity();
|
||||
boolean wasFull = this.lastBeforeUpdate.amount == this.tank.getCapacity();
|
||||
boolean fullStateChanged = isFull != wasFull;
|
||||
|
||||
if (amountSufficientlyChanged || fullStateChanged) {
|
||||
ChannelLoader.sendPacketToAllPlayers(getDescriptionPacket(), this.worldObj);
|
||||
this.lastBeforeUpdate = current.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public FluidStack drain(FluidStack fluid, boolean doDrain, boolean findMainTank) {
|
||||
if (fluid == null || this.getFluid() == null || this.getFluid() != fluid.getFluid()) {
|
||||
return null;
|
||||
@@ -88,7 +57,9 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
FluidStack drainedFluid = this.tank.drain(fluid.amount, doDrain);
|
||||
int drained = drainedFluid != null ? drainedFluid.amount : 0;
|
||||
|
||||
compareAndUpdate();
|
||||
if (drained > 0) {
|
||||
update();
|
||||
}
|
||||
|
||||
if (drained < fluid.amount) {
|
||||
TileCertusQuartzTank tankBelow = this.getTankBelow();
|
||||
@@ -144,7 +115,10 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
}
|
||||
|
||||
int filled = this.tank.fill(fluid, doFill);
|
||||
compareAndUpdate();
|
||||
|
||||
if (filled > 0) {
|
||||
update();
|
||||
}
|
||||
|
||||
if (filled < fluid.amount) {
|
||||
TileCertusQuartzTank tankAbove = this.getTankAbove();
|
||||
@@ -165,13 +139,6 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
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;
|
||||
@@ -185,31 +152,6 @@ 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() {
|
||||
if (this.tank.getFluid() != null) {
|
||||
TileCertusQuartzTank below = getTankBelow();
|
||||
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 getTankAbove() {
|
||||
TileEntity tile = new BlockPos(this).getOffSet(0, 1, 0).getTileEntity();
|
||||
if (tile instanceof TileCertusQuartzTank tankTile) {
|
||||
@@ -268,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(
|
||||
@@ -290,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);
|
||||
@@ -299,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);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.tile.AEBaseTile;
|
||||
@@ -26,8 +27,9 @@ public class WailaInit {
|
||||
registrar.registerBodyProvider(tile, AEBaseTile.class);
|
||||
registrar.registerNBTProvider(tile, AEBaseTile.class);
|
||||
|
||||
final IWailaDataProvider certusQuartzTank = new CertusQuartzTankWailaDataProvider();
|
||||
registrar.registerBodyProvider(certusQuartzTank, TileCertusQuartzTank.class);
|
||||
|
||||
if (!ModAndClassUtil.WAILA_PLUGINS) {
|
||||
final IWailaDataProvider certusQuartzTank = new CertusQuartzTankWailaDataProvider();
|
||||
registrar.registerBodyProvider(certusQuartzTank, TileCertusQuartzTank.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,6 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.storage.FluidCellInventoryHandler;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TerminalFontSize;
|
||||
@@ -164,10 +162,6 @@ public class NEICellViewHandler implements IUsageHandler {
|
||||
final int line = i % ROW_ITEM_NUM;
|
||||
final int row = i / ROW_ITEM_NUM;
|
||||
|
||||
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite sprite) {
|
||||
sprite.markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
tessellator.setColorRGBA(color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF, 0xFF);
|
||||
tessellator.addVertexWithUV(
|
||||
OFFSET_X + 18 * (line + 1) - 1,
|
||||
|
||||
@@ -32,8 +32,8 @@ 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;
|
||||
|
||||
public static boolean isV2;
|
||||
@@ -147,8 +147,8 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@ import net.minecraft.util.IIcon;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
|
||||
public final class RenderUtil {
|
||||
@@ -53,9 +51,6 @@ public final class RenderUtil {
|
||||
if (aeFluidStack.getStackSize() > 0 && hi > 0) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
IIcon fluidIcon = aeFluidStack.getFluid().getStillIcon();
|
||||
if (ModAndClassUtil.HODGEPODGE && fluidIcon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) fluidIcon).markNeedsAnimationUpdate();
|
||||
}
|
||||
GL11.glColor3f(
|
||||
(float) (aeFluidStack.getFluid().getColor() >> 16 & 255) / 255.0F,
|
||||
(float) (aeFluidStack.getFluid().getColor() >> 8 & 255) / 255.0F,
|
||||
|
||||
Reference in new issue
Block a user