Debug Fluid Storage Disk
This commit is contained in:
@@ -47,6 +47,7 @@ public enum EnumFluidStorageType implements IStringSerializable {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TYPE_CREATIVE;
|
return TYPE_CREATIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public enum EnumItemStorageType implements IStringSerializable {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TYPE_CREATIVE;
|
return TYPE_CREATIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,14 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.inventory.InventoryHelper;
|
import net.minecraft.inventory.InventoryHelper;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import refinedstorage.RefinedStorageItems;
|
import refinedstorage.RefinedStorageItems;
|
||||||
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
|
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
|
||||||
import refinedstorage.block.EnumFluidStorageType;
|
import refinedstorage.block.EnumFluidStorageType;
|
||||||
@@ -23,6 +27,9 @@ public class ItemFluidStorageDisk extends ItemBase {
|
|||||||
public static final int TYPE_256K = 2;
|
public static final int TYPE_256K = 2;
|
||||||
public static final int TYPE_512K = 3;
|
public static final int TYPE_512K = 3;
|
||||||
public static final int TYPE_CREATIVE = 4;
|
public static final int TYPE_CREATIVE = 4;
|
||||||
|
public static final int TYPE_DEBUG = 5;
|
||||||
|
|
||||||
|
private NBTTagCompound debugDiskTag;
|
||||||
|
|
||||||
public ItemFluidStorageDisk() {
|
public ItemFluidStorageDisk() {
|
||||||
super("fluid_storage_disk");
|
super("fluid_storage_disk");
|
||||||
@@ -39,12 +46,37 @@ public class ItemFluidStorageDisk extends ItemBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyDebugDiskData(ItemStack stack) {
|
||||||
|
if (debugDiskTag == null) {
|
||||||
|
debugDiskTag = FluidStorageNBT.createNBT();
|
||||||
|
|
||||||
|
FluidStorageNBT storage = new FluidStorageNBT(debugDiskTag, -1, null) {
|
||||||
|
@Override
|
||||||
|
public int getPriority() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
|
||||||
|
storage.insertFluid(new FluidStack(fluid, 0), Fluid.BUCKET_VOLUME * 1000, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
storage.writeToNBT();
|
||||||
|
}
|
||||||
|
|
||||||
|
stack.setTagCompound(debugDiskTag.copy());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
|
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
|
||||||
super.onUpdate(stack, world, entity, slot, selected);
|
super.onUpdate(stack, world, entity, slot, selected);
|
||||||
|
|
||||||
if (!stack.hasTagCompound()) {
|
if (!stack.hasTagCompound()) {
|
||||||
FluidStorageNBT.createStackWithNBT(stack);
|
if (stack.getMetadata() == TYPE_DEBUG) {
|
||||||
|
applyDebugDiskData(stack);
|
||||||
|
} else {
|
||||||
|
FluidStorageNBT.createStackWithNBT(stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ item.refinedstorage:fluid_storage_disk.1.name=128k Fluid Storage Disk
|
|||||||
item.refinedstorage:fluid_storage_disk.2.name=256k Fluid Storage Disk
|
item.refinedstorage:fluid_storage_disk.2.name=256k Fluid Storage Disk
|
||||||
item.refinedstorage:fluid_storage_disk.3.name=512k Fluid Storage Disk
|
item.refinedstorage:fluid_storage_disk.3.name=512k Fluid Storage Disk
|
||||||
item.refinedstorage:fluid_storage_disk.4.name=Creative Fluid Storage Disk
|
item.refinedstorage:fluid_storage_disk.4.name=Creative Fluid Storage Disk
|
||||||
|
item.refinedstorage:fluid_storage_disk.5.name=Debug Fluid Storage Disk
|
||||||
item.refinedstorage:wireless_grid.0.name=Wireless Grid
|
item.refinedstorage:wireless_grid.0.name=Wireless Grid
|
||||||
item.refinedstorage:wireless_grid.1.name=Creative Wireless Grid
|
item.refinedstorage:wireless_grid.1.name=Creative Wireless Grid
|
||||||
item.refinedstorage:quartz_enriched_iron.name=Quartz Enriched Iron
|
item.refinedstorage:quartz_enriched_iron.name=Quartz Enriched Iron
|
||||||
|
|||||||
Reference in New Issue
Block a user