mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 18:44:42 +00:00
spotless apply
This commit is contained in:
1 parent
1f6dc04a71
commit
99f8e98017
14 files changed
+190
-147
No files matched your search
@@ -1,19 +1,5 @@
|
||||
package com.glodblock.github.common.block;
|
||||
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.factory.BlockTank;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
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.IRegister;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import extracells.tileentity.TileEntityCertusTank;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -26,6 +12,22 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.factory.BlockTank;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
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.IRegister;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCertusQuartzTank extends BlockTank implements IRegister<BlockTank> {
|
||||
|
||||
private IIcon textureStackedSide;
|
||||
@@ -72,16 +74,8 @@ public class BlockCertusQuartzTank extends BlockTank implements IRegister<BlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World worldObj,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer p,
|
||||
int blockID,
|
||||
float offsetX,
|
||||
float offsetY,
|
||||
float offsetZ) {
|
||||
public boolean onBlockActivated(World worldObj, int x, int y, int z, EntityPlayer p, int blockID, float offsetX,
|
||||
float offsetY, float offsetZ) {
|
||||
ItemStack current = p.inventory.getCurrentItem();
|
||||
|
||||
if (p.isSneaking() && current != null) {
|
||||
@@ -106,7 +100,7 @@ public class BlockCertusQuartzTank extends BlockTank implements IRegister<BlockT
|
||||
|
||||
if (current != null) {
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
|
||||
TileEntityCertusTank tank = (TileEntityCertusTank) worldObj.getTileEntity(x, y, z);
|
||||
TileCertusQuartzTank tank = (TileCertusQuartzTank) worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if (liquid != null) {
|
||||
int amountFilled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
@@ -116,8 +110,8 @@ public class BlockCertusQuartzTank extends BlockTank implements IRegister<BlockT
|
||||
p.inventory.mainInventory[p.inventory.currentItem].stackSize -= 1;
|
||||
p.inventory.addItemStackToInventory(current.getItem().getContainerItem(current));
|
||||
} else {
|
||||
p.inventory.mainInventory[p.inventory.currentItem] =
|
||||
current.getItem().getContainerItem(current);
|
||||
p.inventory.mainInventory[p.inventory.currentItem] = current.getItem()
|
||||
.getContainerItem(current);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
package com.glodblock.github.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.glodblock.github.common.item.FCBaseItemBlock;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.common.tile.TileFluidAutoFiller;
|
||||
@@ -11,11 +18,6 @@ import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockFluidAutoFiller extends FCBaseBlock {
|
||||
|
||||
@@ -36,8 +38,8 @@ public class BlockFluidAutoFiller extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX,
|
||||
float hitY, float hitZ) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,8 @@ package com.glodblock.github.common.item;
|
||||
|
||||
import static com.glodblock.github.common.tile.TileCertusQuartzTank.CAPACITY;
|
||||
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -16,7 +13,14 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemCertusQuartzTank extends ItemBlock implements IFluidContainerItem {
|
||||
|
||||
private final String tagKey = "tank";
|
||||
|
||||
private final int capacity = CAPACITY;
|
||||
@@ -25,14 +29,13 @@ public class ItemCertusQuartzTank extends ItemBlock implements IFluidContainerIt
|
||||
super(block);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
if (FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag(tagKey)) != null) {
|
||||
FluidStack fs =
|
||||
FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag(tagKey));
|
||||
FluidStack fs = FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag(tagKey));
|
||||
list.add(Tooltip.fluidFormat(fs.getFluid().getLocalizedName(fs), fs.amount));
|
||||
}
|
||||
}
|
||||
@@ -40,8 +43,7 @@ public class ItemCertusQuartzTank extends ItemBlock implements IFluidContainerIt
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) {
|
||||
if (container.stackTagCompound == null
|
||||
|| !container.stackTagCompound.hasKey(tagKey)
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey(tagKey)
|
||||
|| container.stackTagCompound.getCompoundTag(tagKey).hasKey("Empty")) {
|
||||
return null;
|
||||
}
|
||||
@@ -145,18 +147,8 @@ public class ItemCertusQuartzTank extends ItemBlock implements IFluidContainerIt
|
||||
}
|
||||
|
||||
@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) {
|
||||
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)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.glodblock.github.common.parts.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -9,6 +10,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
|
||||
public abstract class FCFluidEncodeTerminal extends FCPart {
|
||||
|
||||
protected AppEngInternalInventory crafting;
|
||||
@@ -154,4 +157,34 @@ public abstract class FCFluidEncodeTerminal extends FCPart {
|
||||
|
||||
return super.getInventoryByName(name);
|
||||
}
|
||||
|
||||
public void sortCraftingItems() {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
List<ItemStack> fluids = new ArrayList<ItemStack>();
|
||||
for (ItemStack is : this.crafting) {
|
||||
if (is == null) continue;
|
||||
if (is.getItem() instanceof ItemFluidPacket) {
|
||||
fluids.add(is);
|
||||
} else {
|
||||
items.add(is);
|
||||
}
|
||||
}
|
||||
if (this.prioritize) {
|
||||
fluids.addAll(items);
|
||||
items.clear();
|
||||
} else {
|
||||
items.addAll(fluids);
|
||||
fluids.clear();
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.crafting.getSizeInventory(); i++) {
|
||||
if (this.crafting.getStackInSlot(i) == null) break;
|
||||
if (items.isEmpty()) {
|
||||
this.crafting.setInventorySlotContents(i, fluids.get(i));
|
||||
} else {
|
||||
this.crafting.setInventorySlotContents(i, items.get(i));
|
||||
}
|
||||
}
|
||||
saveChanges();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import buildcraft.factory.TileTank;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
||||
import buildcraft.factory.TileTank;
|
||||
|
||||
public class TileCertusQuartzTank extends TileTank {
|
||||
|
||||
public static final int CAPACITY = FluidContainerRegistry.BUCKET_VOLUME * 32;
|
||||
|
||||
public TileCertusQuartzTank() {
|
||||
|
||||
@@ -2,6 +2,21 @@ package com.glodblock.github.common.tile;
|
||||
|
||||
import static com.glodblock.github.loader.RecipeLoader.BUCKET;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -35,29 +50,18 @@ import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkInvTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.util.Util;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
implements ICraftingProvider, IMEMonitorHandlerReceiver<IAEFluidStack>, IGridTickable {
|
||||
|
||||
private final AppEngInternalInventory inventory = new AppEngInternalInventory(this, 1);
|
||||
private final BaseActionSource source = new MachineSource(this);
|
||||
private IItemList<IAEFluidStack> fluids = AEApi.instance().storage().createFluidList();
|
||||
public ItemStack containerItem;
|
||||
private final Item encodedPattern =
|
||||
AEApi.instance().definitions().items().encodedPattern().maybeItem().orNull();
|
||||
private final Item encodedPattern = AEApi.instance().definitions().items().encodedPattern().maybeItem().orNull();
|
||||
private IAEItemStack returnStack;
|
||||
private boolean isPowered;
|
||||
|
||||
@@ -132,15 +136,15 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
|
||||
IStorageGrid storage = getStorageGrid();
|
||||
if (storage == null) return;
|
||||
IItemList<IAEFluidStack> fluidStorage =
|
||||
this.fluids.isEmpty() ? storage.getFluidInventory().getStorageList() : this.fluids;
|
||||
IItemList<IAEFluidStack> fluidStorage = this.fluids.isEmpty() ? storage.getFluidInventory().getStorageList()
|
||||
: this.fluids;
|
||||
for (IAEFluidStack fluidStack : fluidStorage) {
|
||||
Fluid fluid = fluidStack.getFluid();
|
||||
if (fluid == null) continue;
|
||||
int maxCapacity = Util.FluidUtil.getCapacity(this.containerItem, fluid);
|
||||
if (maxCapacity == 0) continue;
|
||||
MutablePair<Integer, ItemStack> filled =
|
||||
Util.FluidUtil.fillStack(this.containerItem.copy(), new FluidStack(fluid, maxCapacity));
|
||||
MutablePair<Integer, ItemStack> filled = Util.FluidUtil
|
||||
.fillStack(this.containerItem.copy(), new FluidStack(fluid, maxCapacity));
|
||||
if (filled.right == null) continue;
|
||||
ItemStack pattern = getPattern(this.containerItem, filled.right);
|
||||
ICraftingPatternItem patter = (ICraftingPatternItem) pattern.getItem();
|
||||
@@ -175,8 +179,8 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table) {
|
||||
this.returnStack =
|
||||
AEApi.instance().storage().createItemStack(patternDetails.getCondensedOutputs()[0].getItemStack());
|
||||
this.returnStack = AEApi.instance().storage()
|
||||
.createItemStack(patternDetails.getCondensedOutputs()[0].getItemStack());
|
||||
try {
|
||||
this.getProxy().getTick().alertDevice(this.getProxy().getNode());
|
||||
} catch (GridAccessException ignored) {
|
||||
@@ -196,12 +200,11 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(
|
||||
IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource source) {
|
||||
public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change,
|
||||
BaseActionSource source) {
|
||||
if (this.getProxy().isActive() && this.getStorageGrid() != null) {
|
||||
boolean hasChanged = false;
|
||||
IItemList<IAEFluidStack> stored = this.getStorageGrid()
|
||||
.getFluidInventory()
|
||||
IItemList<IAEFluidStack> stored = this.getStorageGrid().getFluidInventory()
|
||||
.getAvailableItems(AEApi.instance().storage().createFluidList());
|
||||
for (IAEFluidStack tmp : change) {
|
||||
if (stored.findPrecise(tmp) == null || this.fluids.findPrecise(tmp) == null) {
|
||||
@@ -216,8 +219,7 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
|
||||
private boolean postEvent() {
|
||||
try {
|
||||
this.getProxy()
|
||||
.getGrid()
|
||||
this.getProxy().getGrid()
|
||||
.postEvent(new MENetworkCraftingPatternChange(this, getGridNode(ForgeDirection.UNKNOWN)));
|
||||
return true;
|
||||
} catch (GridAccessException ignored) {
|
||||
@@ -247,8 +249,7 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
if (newState != this.isPowered && newState) {
|
||||
this.getProxy().getStorage().getFluidInventory().addListener(this, null);
|
||||
}
|
||||
} catch (final GridAccessException ignored) {
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
if (newState != this.isPowered) {
|
||||
this.isPowered = newState;
|
||||
this.markForUpdate();
|
||||
@@ -259,8 +260,7 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
public void gridChanged() {
|
||||
try {
|
||||
this.getProxy().getStorage().getFluidInventory().removeListener(this);
|
||||
} catch (final GridAccessException ignored) {
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
super.gridChanged();
|
||||
}
|
||||
|
||||
@@ -274,8 +274,8 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
if (this.getStorageGrid() == null) {
|
||||
return TickRateModulation.SLOWER;
|
||||
}
|
||||
IAEItemStack nodAdded =
|
||||
getStorageGrid().getItemInventory().injectItems(this.returnStack, Actionable.SIMULATE, this.source);
|
||||
IAEItemStack nodAdded = getStorageGrid().getItemInventory()
|
||||
.injectItems(this.returnStack, Actionable.SIMULATE, this.source);
|
||||
if (nodAdded == null) {
|
||||
getStorageGrid().getItemInventory().injectItems(this.returnStack, Actionable.MODULATE, this.source);
|
||||
this.returnStack = null;
|
||||
|
||||
Reference in new issue
Block a user