mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 09:34:42 +00:00
add Fluid Buffer
This commit is contained in:
1 parent
5e31096c7e
commit
77ccfb5606
16 files changed
+436
-56
No files matched your search
@@ -1,8 +1,6 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.ItemSubstitution;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
@@ -129,21 +127,22 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
|
||||
this.buttonList.add(this.doubleBtn);
|
||||
combineLeft = 84;
|
||||
}
|
||||
// if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
// combineLeft = 74;
|
||||
// combineTop -= 11;
|
||||
// this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||
// this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS,
|
||||
// PatternBeSubstitution.ENABLED);
|
||||
// this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||
// this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||
//
|
||||
// this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||
// this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS,
|
||||
// PatternBeSubstitution.DISABLED);
|
||||
// this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||
// this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||
// }
|
||||
if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
combineLeft = 74;
|
||||
combineTop -= 11;
|
||||
this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
|
||||
this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||
|
||||
this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 84,
|
||||
this.guiTop + this.ySize - 153,
|
||||
Settings.ACTIONS,
|
||||
PatternBeSubstitution.DISABLED);
|
||||
this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||
}
|
||||
this.combineEnableBtn = new GuiFCImgButton(
|
||||
this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "FORCE_COMBINE", "DO_COMBINE");
|
||||
this.combineEnableBtn.setHalfSize(true);
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.ItemSubstitution;
|
||||
import appeng.api.config.PatternSlotConfig;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
@@ -144,19 +141,20 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 114, "NOT_COMBINE", "DONT_COMBINE");
|
||||
this.combineDisableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineDisableBtn);
|
||||
// if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
// this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||
// this.guiLeft + 87, this.guiTop + this.ySize - 103, Settings.ACTIONS,
|
||||
// PatternBeSubstitution.ENABLED);
|
||||
// this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||
// this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||
//
|
||||
// this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||
// this.guiLeft + 87, this.guiTop + this.ySize - 103, Settings.ACTIONS,
|
||||
// PatternBeSubstitution.DISABLED);
|
||||
// this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||
// this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||
// }
|
||||
if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 87, this.guiTop + this.ySize - 103, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
|
||||
this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||
|
||||
this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 87,
|
||||
this.guiTop + this.ySize - 103,
|
||||
Settings.ACTIONS,
|
||||
PatternBeSubstitution.DISABLED);
|
||||
this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||
}
|
||||
processingScrollBar.setTop(this.ySize - 164);
|
||||
}
|
||||
|
||||
@@ -241,6 +239,8 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
|
||||
substitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
substitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
beSubstitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
beSubstitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
fluidPrioritizedEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
fluidPrioritizedDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
doubleBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import com.glodblock.github.common.block.BlockFluidBuffer;
|
||||
import com.glodblock.github.common.tile.TileFluidBuffer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderBlockFluidBuffer extends BaseBlockRender<BlockFluidBuffer, TileFluidBuffer> {
|
||||
|
||||
public RenderBlockFluidBuffer() {
|
||||
super(false, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(
|
||||
final BlockFluidBuffer block,
|
||||
final IBlockAccess world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final RenderBlocks renderer) {
|
||||
final TileFluidBuffer ti = block.getTileEntity(world, x, y, z);
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
this.renderFluid(ti, x, y, z, renderer);
|
||||
final boolean fz = super.renderInWorld(block, world, x, y, z, renderer);
|
||||
info.setTemporaryRenderIcon(null);
|
||||
return fz;
|
||||
}
|
||||
|
||||
private void renderFluid(TileFluidBuffer tileEntity, double x, double y, double z, RenderBlocks renderer) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
if (tileEntity != null && tileEntity.getFluidStack() != null) {
|
||||
Fluid storedFluid = tileEntity.getFluidStack().getFluid();
|
||||
if (storedFluid != null) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Block id = Block.getBlockById(FluidRegistry.WATER.getID());
|
||||
IIcon fluidIcon = storedFluid.getIcon();
|
||||
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
|
||||
tessellator.setColorRGBA_F(
|
||||
(storedFluid.getColor() >> 16 & 0xFF) / 255.0F,
|
||||
(storedFluid.getColor() >> 8 & 0xFF) / 255.0F,
|
||||
(storedFluid.getColor() & 0xFF) / 255.0F,
|
||||
1.0F);
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
renderer.renderFaceYNeg(id, x, y, z, fluidIcon);
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(id, x, y, z, fluidIcon);
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
renderer.renderFaceZNeg(id, x, y, z, fluidIcon);
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(id, x, y, z, fluidIcon);
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(id, x, y, z, fluidIcon);
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(id, x, y, z, fluidIcon);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.glodblock.github.common.block;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.util.Platform;
|
||||
import com.glodblock.github.client.render.RenderBlockFluidBuffer;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.common.tile.TileFluidBuffer;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class BlockFluidBuffer extends FCBaseBlock {
|
||||
|
||||
public BlockFluidBuffer() {
|
||||
super(Material.iron, NameConst.BLOCK_FLUID_BUFFER);
|
||||
setTileEntity(TileFluidBuffer.class);
|
||||
setFullBlock(false);
|
||||
setOpaque(false);
|
||||
this.lightOpacity = 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack itemStack = player.inventory.getCurrentItem();
|
||||
FluidStack fs = Util.getFluidFromItem(itemStack);
|
||||
if (Platform.isServer()) {
|
||||
TileFluidBuffer tile = getTileEntity(world, x, y, z);
|
||||
if (tile == null) return false;
|
||||
IAEFluidStack ias = tile.getAEStoreFluidStack();
|
||||
if (fs == null && ias != null) {
|
||||
player.addChatMessage(new ChatComponentText(
|
||||
Tooltip.fluidFormat(ias.getFluid().getLocalizedName(), ias.getStackSize())));
|
||||
return false;
|
||||
} else {
|
||||
tile.setFluid(fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return fs != null;
|
||||
}
|
||||
|
||||
public BlockFluidBuffer register() {
|
||||
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_FLUID_BUFFER);
|
||||
GameRegistry.registerTileEntity(TileFluidBuffer.class, NameConst.BLOCK_FLUID_BUFFER);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlockFluidBuffer getRenderer() {
|
||||
return new RenderBlockFluidBuffer();
|
||||
}
|
||||
|
||||
public ItemStack stack(int size) {
|
||||
return new ItemStack(this, size);
|
||||
}
|
||||
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,7 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemFluidEncodedPattern extends ItemEncodedPattern {
|
||||
@@ -31,19 +28,6 @@ public class ItemFluidEncodedPattern extends ItemEncodedPattern {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation(
|
||||
final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo) {
|
||||
NBTTagCompound data = stack.getTagCompound();
|
||||
final boolean combine = data.getBoolean("combine");
|
||||
final boolean prio = data.getBoolean("prioritize");
|
||||
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
|
||||
// lines.add(String.format("%s: %s",combine ?
|
||||
// StatCollector.translateToLocal(NameConst.TT_KEY+"combine"):StatCollector.translateToLocal(NameConst.TT_KEY+"not_combine"),combine ? GuiText.Yes.getLocal() : GuiText.No.getLocal()));
|
||||
// lines.add(String.format("%s: %s",prio ?
|
||||
// StatCollector.translateToLocal(NameConst.TT_KEY+"prio"):StatCollector.translateToLocal(NameConst.TT_KEY+"not_prio"),prio ? GuiText.Yes.getLocal() : GuiText.No.getLocal()));
|
||||
}
|
||||
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
if (newStack != null) {
|
||||
NBTTagCompound data = newStack.getTagCompound();
|
||||
this.setCombineMode(data.getInteger("combine") == 1);
|
||||
// this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
}
|
||||
for (int i = 0; i < this.crafting.getSizeInventory(); i++) {
|
||||
this.crafting.setInventorySlotContents(i, null);
|
||||
|
||||
@@ -166,7 +166,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
if (newStack != null) {
|
||||
NBTTagCompound data = newStack.getTagCompound();
|
||||
this.setCombineMode(data.getInteger("combine") == 1);
|
||||
// this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
}
|
||||
this.setInverted(inputsCount <= 8 && outputCount > 8);
|
||||
this.setActivePage(0);
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileFluidBuffer extends AENetworkTile
|
||||
implements IAEFluidInventory, IFluidHandler, IPowerChannelState, IGridTickable {
|
||||
|
||||
private final AEFluidInventory invFluids = new AEFluidInventory(this, 1, Integer.MAX_VALUE);
|
||||
private final BaseActionSource source;
|
||||
private boolean isPowered;
|
||||
|
||||
public TileFluidBuffer() {
|
||||
getProxy().setIdlePowerUsage(2D);
|
||||
getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.source = new MachineSource(this);
|
||||
}
|
||||
|
||||
public boolean setFluid(FluidStack fs) {
|
||||
return this.setFluid(fs, Actionable.MODULATE);
|
||||
}
|
||||
|
||||
public boolean setFluid(FluidStack fs, Actionable actionable) {
|
||||
if (fs == null) {
|
||||
this.invFluids.setFluidInSlot(0, null);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
IAEFluidStack ias = this.getProxy()
|
||||
.getStorage()
|
||||
.getFluidInventory()
|
||||
.getStorageList()
|
||||
.findPrecise(AEFluidStack.create(fs));
|
||||
if (actionable == Actionable.MODULATE) this.invFluids.setFluidInSlot(0, ias);
|
||||
if (ias != null) return true;
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection forgeDirection, FluidStack fluidStack, boolean b) {
|
||||
IAEFluidStack ifs = this.getAEFluidStack();
|
||||
if (ifs != null && ifs.getFluid() == fluidStack.getFluid()) {
|
||||
try {
|
||||
IAEFluidStack notInserted = this.getProxy()
|
||||
.getStorage()
|
||||
.getFluidInventory()
|
||||
.injectItems(
|
||||
AEFluidStack.create(fluidStack),
|
||||
b ? Actionable.MODULATE : Actionable.SIMULATE,
|
||||
this.source);
|
||||
if (notInserted != null) return fluidStack.amount -= notInserted.getStackSize();
|
||||
return fluidStack.amount;
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection forgeDirection, FluidStack fluidStack, boolean b) {
|
||||
return this.drainFluid(fluidStack, b ? Actionable.MODULATE : Actionable.SIMULATE);
|
||||
}
|
||||
|
||||
public FluidStack drainFluid(FluidStack fs, Actionable actionable) {
|
||||
if (fs == null || fs.amount <= 0) return null;
|
||||
try {
|
||||
IAEFluidStack ias = AEFluidStack.create(fs);
|
||||
IAEFluidStack extracted =
|
||||
this.getProxy().getStorage().getFluidInventory().extractItems(ias, actionable, this.source);
|
||||
if (extracted == null) return null;
|
||||
return extracted.getFluidStack();
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection forgeDirection, int maxDrain, boolean b) {
|
||||
FluidStack fs = this.getFluidStack();
|
||||
if (maxDrain == 0 || fs == null) {
|
||||
return null;
|
||||
}
|
||||
FluidStack tmp = fs.copy();
|
||||
tmp.amount = maxDrain;
|
||||
return this.drainFluid(tmp, b ? Actionable.MODULATE : Actionable.SIMULATE);
|
||||
}
|
||||
|
||||
public IAEFluidStack getAEStoreFluidStack() {
|
||||
try {
|
||||
return this.getProxy()
|
||||
.getStorage()
|
||||
.getFluidInventory()
|
||||
.getStorageList()
|
||||
.findPrecise(this.getAEFluidStack());
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public FluidStack getFluidStack() {
|
||||
return this.getInternalFluid().getFluidStackInSlot(0);
|
||||
}
|
||||
|
||||
public IAEFluidStack getAEFluidStack() {
|
||||
return this.getInternalFluid().getFluidInSlot(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection forgeDirection, Fluid fluid) {
|
||||
FluidStack fs = this.getFluidStack();
|
||||
return fs != null && fs.getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return getInternalFluid().canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
FluidTankInfo[] FluidTankInfos = getInternalFluid().getTankInfo(from);
|
||||
FluidTankInfo[] tmp = FluidTankInfos.clone();
|
||||
for (FluidTankInfo ft : tmp) {
|
||||
if (ft.fluid == null) continue;
|
||||
ft.fluid.amount = 0;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
invFluids.writeToNBT(data, "FluidInv");
|
||||
return data;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
invFluids.readFromNBT(data, "FluidInv");
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStream(final ByteBuf data) {
|
||||
final boolean oldPower = this.isPowered;
|
||||
this.isPowered = data.readBoolean();
|
||||
return this.isPowered != oldPower;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream(final ByteBuf data) {
|
||||
data.writeBoolean(this.isActive());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowered() {
|
||||
return this.isPowered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return this.isPowered;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(final MENetworkPowerStatusChange p) {
|
||||
this.updatePowerState();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public final void bootingRender(final MENetworkBootingStatusChange c) {
|
||||
this.updatePowerState();
|
||||
}
|
||||
|
||||
private void updatePowerState() {
|
||||
boolean newState = false;
|
||||
try {
|
||||
newState = this.getProxy().isActive()
|
||||
&& this.getProxy().getEnergy().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG)
|
||||
> 0.0001;
|
||||
} catch (final GridAccessException ignored) {
|
||||
}
|
||||
if (newState != this.isPowered) {
|
||||
this.isPowered = newState;
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFluidInventoryChanged(IAEFluidTank inv, int slot) {
|
||||
saveChanges();
|
||||
markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEFluidInventory getInternalFluid() {
|
||||
return this.invFluids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(40, 120, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) {
|
||||
return this.canDoBusWork() ? this.doWork() : TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
private TickRateModulation doWork() {
|
||||
return this.setFluid(this.getFluidStack(), Actionable.SIMULATE)
|
||||
? TickRateModulation.SLOWER
|
||||
: TickRateModulation.FASTER;
|
||||
}
|
||||
|
||||
private boolean canDoBusWork() {
|
||||
return this.getProxy().isActive();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class Tooltip {
|
||||
public static String fluidFormat(String name, int amount) {
|
||||
public static String fluidFormat(String name, long amount) {
|
||||
return String.format("%s: %s mB", name, NumberFormat.getInstance().format(amount));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ public class ItemAndBlockHolder {
|
||||
public static BlockFluidPacketDecoder DECODER = new BlockFluidPacketDecoder().register();
|
||||
public static BlockFluidInterface INTERFACE = new BlockFluidInterface().register();
|
||||
public static BlockIngredientBuffer BUFFER = new BlockIngredientBuffer().register();
|
||||
public static BlockFluidBuffer FLUID_BUFFER = new BlockFluidBuffer().register();
|
||||
public static BlockLargeIngredientBuffer LARGE_BUFFER = new BlockLargeIngredientBuffer().register();
|
||||
public static BlockOCPatternEditor OC_EDITOR = new BlockOCPatternEditor().register();
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ public class RecipeLoader implements Runnable {
|
||||
AE2_PROCESS_ENG));
|
||||
GameRegistry.addShapelessRecipe(AE2_BLANK_PATTERN, PATTERN.stack());
|
||||
GameRegistry.addShapelessRecipe(FLUID_TERM.stack(), AE2_TERMINAL, BUFFER);
|
||||
GameRegistry.addShapelessRecipe(FLUID_BUFFER.stack(), LARGE_BUFFER.stack(), CELL1K.getComponent());
|
||||
GameRegistry.addShapelessRecipe(
|
||||
LEVEL_MAINTAINER.stack(), AE2_CRAFTING_CP_UNIT, ENCODER, AE2_PATTERN_CAPACITY_CARD);
|
||||
if (Config.fluidCells) {
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class ModAndClassUtil {
|
||||
}
|
||||
try {
|
||||
Field d = ButtonToolTips.class.getDeclaredField("BeSubstitutionsDescEnabled");
|
||||
// isBeSubstitutionsButton = true;
|
||||
isBeSubstitutionsButton = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isBeSubstitutionsButton = false;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ public class NameConst {
|
||||
public static final String BLOCK_FLUID_PACKET_DECODER = "fluid_packet_decoder";
|
||||
public static final String BLOCK_FLUID_INTERFACE = "fluid_interface";
|
||||
public static final String BLOCK_INGREDIENT_BUFFER = "ingredient_buffer";
|
||||
public static final String BLOCK_FLUID_BUFFER = "fluid_buffer";
|
||||
public static final String BLOCK_LARGE_INGREDIENT_BUFFER = "large_ingredient_buffer";
|
||||
public static final String BLOCK_OC_PATTERN_EDITOR = "oc_pattern_editor";
|
||||
public static final String BLOCK_LEVEL_MAINTAINER = "level_maintainer";
|
||||
|
||||
Reference in new issue
Block a user