mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
pain
This commit is contained in:
parent
622330b4cf
commit
1495dfc2b5
@ -24,6 +24,7 @@ public class HbmKeybinds {
|
||||
public static KeyBinding reloadKey = new KeyBinding(category + ".reload", Keyboard.KEY_R, category);
|
||||
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_LSHIFT, category);
|
||||
public static KeyBinding trainKey = new KeyBinding(category + ".trainInv", Keyboard.KEY_R, category);
|
||||
public static KeyBinding copyToolAlt = new KeyBinding(category + ".copyTool", Keyboard.KEY_LMENU, category);
|
||||
|
||||
public static KeyBinding craneUpKey = new KeyBinding(category + ".craneMoveUp", Keyboard.KEY_UP, category);
|
||||
public static KeyBinding craneDownKey = new KeyBinding(category + ".craneMoveDown", Keyboard.KEY_DOWN, category);
|
||||
@ -38,6 +39,7 @@ public class HbmKeybinds {
|
||||
ClientRegistry.registerKeyBinding(reloadKey);
|
||||
ClientRegistry.registerKeyBinding(dashKey);
|
||||
ClientRegistry.registerKeyBinding(trainKey);
|
||||
ClientRegistry.registerKeyBinding(copyToolAlt);
|
||||
|
||||
ClientRegistry.registerKeyBinding(craneUpKey);
|
||||
ClientRegistry.registerKeyBinding(craneDownKey);
|
||||
@ -72,6 +74,7 @@ public class HbmKeybinds {
|
||||
RELOAD,
|
||||
DASH,
|
||||
TRAIN,
|
||||
COPY_TOOL,
|
||||
CRANE_UP,
|
||||
CRANE_DOWN,
|
||||
CRANE_LEFT,
|
||||
|
||||
@ -6,5 +6,5 @@ public interface ICopiable {
|
||||
|
||||
NBTTagCompound getSettings();
|
||||
|
||||
void pasteSettings(NBTTagCompound nbt);
|
||||
void pasteSettings(NBTTagCompound nbt, boolean alt);
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.HbmKeybinds;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyBase;
|
||||
import com.hbm.tileentity.network.IDroneLinkable;
|
||||
import com.hbm.util.ChatBuilder;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
@ -33,29 +36,28 @@ public class ItemSettingsTool extends Item {
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof ICopiable) {
|
||||
ICopiable te = ((ICopiable) tile);
|
||||
|
||||
if (player.isSneaking()) {
|
||||
stack.stackTagCompound = ((ICopiable) tile).getSettings();
|
||||
stack.stackTagCompound.setString("tileName", tile.getBlockType().getLocalizedName());
|
||||
|
||||
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("] ").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("Copied settings of " + tile.getBlockType().getLocalizedName()).color(EnumChatFormatting.AQUA).flush());
|
||||
|
||||
} else if (stack.hasTagCompound()) {
|
||||
te.pasteSettings(stack.stackTagCompound);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntityProxyBase){
|
||||
tile = ((TileEntityProxyBase) tile).getTE();
|
||||
}
|
||||
return false;
|
||||
if (tile instanceof ICopiable) {
|
||||
ICopiable te = ((ICopiable) tile);
|
||||
|
||||
if (player.isSneaking()) {
|
||||
stack.stackTagCompound = ((ICopiable) tile).getSettings();
|
||||
stack.stackTagCompound.setString("tileName", tile.getBlockType().getLocalizedName());
|
||||
|
||||
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("] ").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("Copied settings of " + tile.getBlockType().getLocalizedName()).color(EnumChatFormatting.AQUA).flush());
|
||||
|
||||
} else if (stack.hasTagCompound()) {
|
||||
boolean alt = HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.COPY_TOOL);
|
||||
te.pasteSettings(stack.stackTagCompound, alt);
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public interface IControlReceiverFilter extends IControlReceiver, ICopiable {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void pasteSettings(NBTTagCompound nbt) {
|
||||
default void pasteSettings(NBTTagCompound nbt, boolean alt) {
|
||||
TileEntity tile = (TileEntity) this;
|
||||
IInventory inv = (IInventory) this;
|
||||
NBTTagList items = nbt.getTagList("items", 10);
|
||||
|
||||
54
src/main/java/com/hbm/tileentity/IFluidCopiable.java
Normal file
54
src/main/java/com/hbm/tileentity/IFluidCopiable.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public interface IFluidCopiable extends ICopiable {
|
||||
/**
|
||||
* @return First type for the normal paste, second type for the alt paste, none if there is no alt paste support
|
||||
*/
|
||||
default int[] getFluidIDToCopy(){
|
||||
IFluidStandardTransceiver tile = (IFluidStandardTransceiver) this;
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
|
||||
if(tile.getReceivingTanks() != null && !tile.getReceivingTanks()[0].getTankType().hasNoID())
|
||||
types.add(tile.getReceivingTanks()[0].getTankType().getID());
|
||||
|
||||
if(tile.getSendingTanks() != null && !tile.getSendingTanks()[0].getTankType().hasNoID())
|
||||
types.add(tile.getSendingTanks()[0].getTankType().getID());
|
||||
|
||||
return BobMathUtil.intCollectionToArray(types);
|
||||
}
|
||||
|
||||
default FluidTank getTankToPaste(){
|
||||
IFluidStandardTransceiver tile = (IFluidStandardTransceiver) this;
|
||||
return tile.getReceivingTanks() != null ? tile.getReceivingTanks()[0] : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
default NBTTagCompound getSettings(){
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
if(getFluidIDToCopy().length > 0)
|
||||
tag.setIntArray("fluidID", getFluidIDToCopy());
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
default void pasteSettings(NBTTagCompound nbt, boolean alt) {
|
||||
if(getTankToPaste() != null) {
|
||||
int[] ids = nbt.getIntArray("fluidID");
|
||||
if(ids.length > 0) {
|
||||
int id = ids[alt ? 1 : 0];
|
||||
getTankToPaste().setTankType(Fluids.fromID(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,8 +8,10 @@ import com.hbm.inventory.fluid.trait.FT_Flammable;
|
||||
import com.hbm.inventory.fluid.trait.FluidTrait.FluidReleaseType;
|
||||
import com.hbm.inventory.gui.GUIOilburner;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IFluidCopiable;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachinePolluting;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
@ -24,7 +26,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implements IGUIProvider, IFluidStandardTransceiver, IHeatSource, IControlReceiver {
|
||||
import java.util.Arrays;
|
||||
|
||||
public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implements IGUIProvider, IFluidStandardTransceiver, IHeatSource, IControlReceiver, IFluidCopiable {
|
||||
|
||||
public boolean isOn = false;
|
||||
public FluidTank tank;
|
||||
@ -217,4 +221,19 @@ public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implem
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return this.getSmokeTanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getSettings() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setIntArray("fluidID", new int[]{tank.getTankType().getID()});
|
||||
tag.setInteger("burnRate", setting);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, boolean alt) {
|
||||
int id = nbt.getIntArray("fluidID")[alt ? 1 : 0];
|
||||
tank.setTankType(Fluids.fromID(id));
|
||||
setting = nbt.getInteger("burnRate");
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IFluidCopiable;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
@ -39,7 +40,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineCrystallizer extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiver, IGUIProvider, IUpgradeInfoProvider {
|
||||
public class TileEntityMachineCrystallizer extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiver, IGUIProvider, IUpgradeInfoProvider, IFluidCopiable {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
|
||||
@ -6,6 +6,7 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.UpgradeManager;
|
||||
import com.hbm.inventory.container.ContainerMixer;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMixer;
|
||||
@ -13,10 +14,7 @@ import com.hbm.inventory.recipes.MixerRecipes;
|
||||
import com.hbm.inventory.recipes.MixerRecipes.MixerRecipe;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.*;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
@ -35,7 +33,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachineMixer extends TileEntityMachineBase implements INBTPacketReceiver, IControlReceiver, IGUIProvider, IEnergyReceiverMK2, IFluidStandardTransceiver, IUpgradeInfoProvider {
|
||||
public class TileEntityMachineMixer extends TileEntityMachineBase implements INBTPacketReceiver, IControlReceiver, IGUIProvider, IEnergyReceiverMK2, IFluidStandardTransceiver, IUpgradeInfoProvider, IFluidCopiable {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 10_000;
|
||||
@ -374,4 +372,14 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
|
||||
if(type == UpgradeType.OVERDRIVE) return 6;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getTankToPaste() {
|
||||
return this.tanks[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getFluidIDToCopy() {
|
||||
return new int[]{tanks[2].getTankType().getID()};
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import com.hbm.inventory.fluid.trait.FluidTrait.FluidReleaseType;
|
||||
import com.hbm.inventory.gui.GUIBarrel;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
import com.hbm.tileentity.IFluidCopiable;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
@ -45,7 +46,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||
public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcceptor, IFluidSource, SimpleComponent, IFluidStandardTransceiver, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent {
|
||||
public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcceptor, IFluidSource, SimpleComponent, IFluidStandardTransceiver, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable {
|
||||
|
||||
public FluidTank tank;
|
||||
public short mode = 0;
|
||||
@ -373,6 +374,16 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getFluidIDToCopy() {
|
||||
return new int[] {tank.getTankType().getID()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getTankToPaste() {
|
||||
return tank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
if(tank.getFill() == 0) return;
|
||||
|
||||
@ -24,11 +24,7 @@ import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IOverpressurable;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.IRepairable;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.*;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
@ -56,7 +52,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements IFluidContainer, SimpleComponent, OCComponent, IFluidSource, IFluidAcceptor, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable {
|
||||
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements IFluidContainer, SimpleComponent, OCComponent, IFluidSource, IFluidAcceptor, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable {
|
||||
|
||||
public FluidTank tank;
|
||||
public short mode = 0;
|
||||
@ -454,6 +450,16 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
return (mode == 0 || mode == 1) ? new FluidTank[] {tank} : new FluidTank[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getFluidIDToCopy() {
|
||||
return new int[] {tank.getTankType().getID()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getTankToPaste() {
|
||||
return tank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerMachineFluidTank(player.inventory, (TileEntityMachineFluidTank) world.getTileEntity(x, y, z));
|
||||
|
||||
@ -136,35 +136,37 @@ public abstract class TileEntityCraneBase extends TileEntityMachineBase implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("outputSide")) {
|
||||
outputOverride = ForgeDirection.getOrientation(nbt.getInteger("outputSide"));
|
||||
onBlockChanged();
|
||||
}
|
||||
if (nbt.hasKey("inputSide")) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, nbt.getInteger("inputSide"), 3);
|
||||
}
|
||||
public void pasteSettings(NBTTagCompound nbt, boolean alt) {
|
||||
if(alt) {
|
||||
if (nbt.hasKey("outputSide")) {
|
||||
outputOverride = ForgeDirection.getOrientation(nbt.getInteger("outputSide"));
|
||||
onBlockChanged();
|
||||
}
|
||||
if (nbt.hasKey("inputSide")) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, nbt.getInteger("inputSide"), 3);
|
||||
}
|
||||
} else {
|
||||
if (this instanceof IControlReceiverFilter) {
|
||||
IControlReceiverFilter filter = ((IControlReceiverFilter) this);
|
||||
IInventory inv = this;
|
||||
|
||||
if (this instanceof IControlReceiverFilter) {
|
||||
IControlReceiverFilter filter = ((IControlReceiverFilter) this);
|
||||
IInventory inv = this;
|
||||
|
||||
NBTTagList items = nbt.getTagList("items", 10);
|
||||
int listSize = items.tagCount();
|
||||
if (listSize > 0) {
|
||||
int count = 0;
|
||||
for (int i = filter.getFilterSlots()[0]; i < filter.getFilterSlots()[1]; i++) {
|
||||
if (i < listSize) {
|
||||
NBTTagCompound slotNBT = items.getCompoundTagAt(count);
|
||||
byte slot = slotNBT.getByte("slot");
|
||||
ItemStack loadedStack = ItemStack.loadItemStackFromNBT(slotNBT);
|
||||
if (loadedStack != null) {
|
||||
inv.setInventorySlotContents(slot + filter.getFilterSlots()[0], ItemStack.loadItemStackFromNBT(slotNBT));
|
||||
filter.nextMode(slot);
|
||||
this.getWorldObj().markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
|
||||
NBTTagList items = nbt.getTagList("items", 10);
|
||||
int listSize = items.tagCount();
|
||||
if (listSize > 0) {
|
||||
int count = 0;
|
||||
for (int i = filter.getFilterSlots()[0]; i < filter.getFilterSlots()[1]; i++) {
|
||||
if (i < listSize) {
|
||||
NBTTagCompound slotNBT = items.getCompoundTagAt(count);
|
||||
byte slot = slotNBT.getByte("slot");
|
||||
ItemStack loadedStack = ItemStack.loadItemStackFromNBT(slotNBT);
|
||||
if (loadedStack != null) {
|
||||
inv.setInventorySlotContents(slot + filter.getFilterSlots()[0], ItemStack.loadItemStackFromNBT(slotNBT));
|
||||
filter.nextMode(slot);
|
||||
this.getWorldObj().markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import com.hbm.inventory.fluid.Fluids;
|
||||
import api.hbm.fluid.IFluidConductor;
|
||||
import api.hbm.fluid.IPipeNet;
|
||||
import api.hbm.fluid.PipeNet;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.tileentity.IFluidCopiable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
@ -14,7 +16,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor {
|
||||
public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor, IFluidCopiable {
|
||||
|
||||
protected IPipeNet network;
|
||||
protected FluidType type = Fluids.NONE;
|
||||
@ -166,4 +168,23 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor
|
||||
super.onChunkUnload();
|
||||
this.isLoaded = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getFluidIDToCopy() {
|
||||
return new int[]{ type.getID() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getTankToPaste() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, boolean alt) {
|
||||
int[] ids = nbt.getIntArray("fluidID");
|
||||
if(ids.length > 0) {
|
||||
int id = ids[alt ? 1 : 0];
|
||||
this.setType(Fluids.fromID(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,9 +4,8 @@ import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
|
||||
@ -206,4 +205,19 @@ public class BobMathUtil {
|
||||
double delta = (beta - alpha + 180) % 360 - 180;
|
||||
return delta < -180 ? delta + 360 : delta;
|
||||
}
|
||||
|
||||
// I am sick of trying to remember the ridiculous quirks of Java 8
|
||||
// so I wrote this thing that can shit any int-ish list-ish into a regular fucking int[]
|
||||
// made by mellow, thrown here by 70k
|
||||
public static int[] intCollectionToArray(Collection<Integer> in) {
|
||||
return intCollectionToArray(in, i -> (int)i);
|
||||
}
|
||||
|
||||
public static int[] intCollectionToArray(Collection<Integer> in, ToIntFunction<? super Object> mapper) {
|
||||
return Arrays.stream(in.toArray()).mapToInt(mapper).toArray();
|
||||
}
|
||||
|
||||
public static int[] collectionToIntArray(Collection<? extends Object> in, ToIntFunction<? super Object> mapper) {
|
||||
return Arrays.stream(in.toArray()).mapToInt(mapper).toArray();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user