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
6acf2bace1
commit
5e31096c7e
191 files changed
+5046
-5165
No files matched your search
+14
-14
@@ -44,7 +44,9 @@ public class DriverDualFluidInterface implements SidedBlock {
|
||||
super(tileEntity, NameConst.BLOCK_FLUID_INTERFACE);
|
||||
}
|
||||
|
||||
@Callback(doc = "function(index:number):table -- Get the configuration of the dual fluid interface on the specified slot.")
|
||||
@Callback(
|
||||
doc =
|
||||
"function(index:number):table -- Get the configuration of the dual fluid interface on the specified slot.")
|
||||
public Object[] getFluidInterfaceConfiguration(Context context, Arguments args) {
|
||||
int index = args.checkInteger(0);
|
||||
if (index >= 0 && index < DualityFluidInterface.NUMBER_OF_TANKS) {
|
||||
@@ -54,12 +56,14 @@ public class DriverDualFluidInterface implements SidedBlock {
|
||||
throw new IllegalArgumentException("invalid slot");
|
||||
}
|
||||
|
||||
@Callback(doc = "function(index:number[, database:address, entry:number]):boolean -- Configure the filter in fluid interface on the specified slot.")
|
||||
@Callback(
|
||||
doc =
|
||||
"function(index:number[, database:address, entry:number]):boolean -- Configure the filter in fluid interface on the specified slot.")
|
||||
public Object[] setFluidInterfaceConfiguration(Context context, Arguments args) {
|
||||
int index = args.checkInteger(0);
|
||||
String address;
|
||||
int entry;
|
||||
if (args.count() == 3){
|
||||
if (args.count() == 3) {
|
||||
address = args.checkString(1);
|
||||
entry = args.checkInteger(2);
|
||||
} else {
|
||||
@@ -68,17 +72,14 @@ public class DriverDualFluidInterface implements SidedBlock {
|
||||
return new Object[] {true};
|
||||
}
|
||||
Node node = node().network().node(address);
|
||||
if (!(node instanceof Component))
|
||||
throw new IllegalArgumentException("no such component");
|
||||
if (!(node.host() instanceof Database))
|
||||
throw new IllegalArgumentException("not a database");
|
||||
if (!(node instanceof Component)) throw new IllegalArgumentException("no such component");
|
||||
if (!(node.host() instanceof Database)) throw new IllegalArgumentException("not a database");
|
||||
Database database = (Database) node.host();
|
||||
if (index >= 0 && index < DualityFluidInterface.NUMBER_OF_TANKS) {
|
||||
ItemStack data = database.getStackInSlot(entry - 1);
|
||||
if (data == null) {
|
||||
tileEntity.getConfig().setFluidInSlot(index, null);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
FluidStack fluid = Util.getFluidFromItem(data);
|
||||
tileEntity.getConfig().setFluidInSlot(index, tileEntity.getStandardFluid(fluid));
|
||||
}
|
||||
@@ -124,17 +125,16 @@ public class DriverDualFluidInterface implements SidedBlock {
|
||||
}
|
||||
|
||||
public static class Provider implements EnvironmentProvider {
|
||||
Provider() {
|
||||
}
|
||||
Provider() {}
|
||||
|
||||
@Override
|
||||
public Class<?> getEnvironment(ItemStack itemStack) {
|
||||
if (itemStack != null && (itemStack.isItemEqual(ItemAndBlockHolder.FLUID_INTERFACE.stack())
|
||||
|| itemStack.isItemEqual(ItemAndBlockHolder.INTERFACE.stack()))) {
|
||||
if (itemStack != null
|
||||
&& (itemStack.isItemEqual(ItemAndBlockHolder.FLUID_INTERFACE.stack())
|
||||
|| itemStack.isItemEqual(ItemAndBlockHolder.INTERFACE.stack()))) {
|
||||
return DriverDualFluidInterface.Environment.class;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+20
-18
@@ -7,6 +7,8 @@ import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import li.cil.oc.api.driver.EnvironmentProvider;
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
import li.cil.oc.api.internal.Database;
|
||||
@@ -23,10 +25,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
@@ -38,8 +36,7 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
return new DriverLevelMaintainer.Environment((TileLevelMaintainer) world.getTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static class Environment extends ManagedTileEntityEnvironment<TileLevelMaintainer>
|
||||
implements NamedBlock {
|
||||
public static class Environment extends ManagedTileEntityEnvironment<TileLevelMaintainer> implements NamedBlock {
|
||||
|
||||
public Environment(TileLevelMaintainer tileEntity) {
|
||||
super(tileEntity, NameConst.BLOCK_LEVEL_MAINTAINER);
|
||||
@@ -103,16 +100,18 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
result.put("hasTag", stack.hasTagCompound());
|
||||
result.put("label", stack.getDisplayName());
|
||||
result.put("maxDamage", stack.getMaxDamage());
|
||||
result.put("name", GameRegistry.findUniqueIdentifierFor(stack.getItem()).toString());
|
||||
result.put(
|
||||
"name",
|
||||
GameRegistry.findUniqueIdentifierFor(stack.getItem()).toString());
|
||||
result.put("quantity", tileEntity.requests.getQuantity(slot));
|
||||
result.put("batch", tileEntity.requests.getBatchSize(slot));
|
||||
result.put("isFluid", ItemFluidDrop.isFluidStack(stack));
|
||||
if (ItemFluidDrop.isFluidStack(stack)) result.put("fluid", ItemFluidDrop.getFluidStack(stack));
|
||||
result.put("isEnable", tileEntity.requests.isEnable(slot));
|
||||
result.put("isDone", tileEntity.requests.isDone(slot));
|
||||
return new Object[]{result};
|
||||
return new Object[] {result};
|
||||
}
|
||||
return new Object[]{null};
|
||||
return new Object[] {null};
|
||||
}
|
||||
|
||||
private void setSlot(int slot, String address, int index) {
|
||||
@@ -124,7 +123,9 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
dbStack.stackSize = 1;
|
||||
((AeItemStackHandler) tileEntity.getInventory()).getAeInventory().setStack(slot, AEItemStack.create(dbStack));
|
||||
((AeItemStackHandler) tileEntity.getInventory())
|
||||
.getAeInventory()
|
||||
.setStack(slot, AEItemStack.create(dbStack));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Not a database");
|
||||
}
|
||||
@@ -133,7 +134,9 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number[,database:address[,index:number]],quantity:number,batch:number):boolean -- Configuration the slot.")
|
||||
@Callback(
|
||||
doc =
|
||||
"function(slot:number[,database:address[,index:number]],quantity:number,batch:number):boolean -- Configuration the slot.")
|
||||
public Object[] setSlot(Context context, Arguments args) {
|
||||
int slot;
|
||||
String address;
|
||||
@@ -159,7 +162,7 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid args");
|
||||
}
|
||||
return new Object[]{true};
|
||||
return new Object[] {true};
|
||||
}
|
||||
|
||||
private boolean isActive() {
|
||||
@@ -168,22 +171,22 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
|
||||
@Callback(doc = "function(slot:number):boolean -- Get the crafting task state.")
|
||||
public Object[] isDone(Context context, Arguments args) {
|
||||
return new Object[]{this.isDone(args)};
|
||||
return new Object[] {this.isDone(args)};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number):boolean -- Get the crafting state of slot.")
|
||||
public Object[] isEnable(Context context, Arguments args) {
|
||||
return new Object[]{this.isEnable(args)};
|
||||
return new Object[] {this.isEnable(args)};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number,value:boolean):boolean -- Set the crafting state of slot.")
|
||||
public Object[] setEnable(Context context, Arguments args) {
|
||||
return new Object[]{this.setEnable(args)};
|
||||
return new Object[] {this.setEnable(args)};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean Get Level Maintainer state")
|
||||
public Object[] active(Context context, Arguments args) {
|
||||
return new Object[]{this.isActive()};
|
||||
return new Object[] {this.isActive()};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,8 +201,7 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
}
|
||||
|
||||
public static class Provider implements EnvironmentProvider {
|
||||
Provider() {
|
||||
}
|
||||
Provider() {}
|
||||
|
||||
@Override
|
||||
public Class<?> getEnvironment(ItemStack itemStack) {
|
||||
|
||||
+36
-42
@@ -29,8 +29,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
|
||||
public DriverOCPatternEditor() {
|
||||
}
|
||||
public DriverOCPatternEditor() {}
|
||||
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
@@ -42,8 +41,7 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
return new DriverOCPatternEditor.Environment((TileOCPatternEditor) world.getTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static class Environment extends ManagedTileEntityEnvironment<TileOCPatternEditor>
|
||||
implements NamedBlock {
|
||||
public static class Environment extends ManagedTileEntityEnvironment<TileOCPatternEditor> implements NamedBlock {
|
||||
|
||||
public Environment(TileOCPatternEditor tileEntity) {
|
||||
super(tileEntity, NameConst.BLOCK_OC_PATTERN_EDITOR);
|
||||
@@ -56,8 +54,7 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
throw new IllegalArgumentException("invalid slot");
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
@@ -69,8 +66,7 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
throw new IllegalArgumentException("invalid slot");
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new IllegalArgumentException("invalid slot");
|
||||
}
|
||||
}
|
||||
@@ -79,7 +75,8 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
if (pattern == null) {
|
||||
throw new IllegalArgumentException("No pattern here!");
|
||||
}
|
||||
if (pattern.getItem() instanceof ItemEncodedPattern && !(pattern.getItem() instanceof ItemFluidEncodedPattern)) {
|
||||
if (pattern.getItem() instanceof ItemEncodedPattern
|
||||
&& !(pattern.getItem() instanceof ItemFluidEncodedPattern)) {
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) pattern.getItem();
|
||||
return iep.getOutput(pattern) == null;
|
||||
}
|
||||
@@ -95,8 +92,7 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
address = args.checkString(0);
|
||||
entry = args.checkInteger(1);
|
||||
size = args.optInteger(2, 1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
address = args.checkString(1);
|
||||
entry = args.checkInteger(2);
|
||||
size = args.optInteger(3, 1);
|
||||
@@ -107,21 +103,17 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
ItemStack dbStack = ((Database) node.host()).getStackInSlot(entry - 1);
|
||||
if (dbStack == null || size < 1) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dbStack.stackSize = Math.min(size, dbStack.getMaxStackSize());
|
||||
return dbStack;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new IllegalArgumentException("not a database");
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new IllegalArgumentException("no such component");
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -132,12 +124,10 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
if (validPattern(pattern)) {
|
||||
NBTTagCompound encodedValue = pattern.getTagCompound();
|
||||
int slot = checkSlot(args, inv, 0);
|
||||
if (encodedValue == null)
|
||||
throw new IllegalArgumentException("No pattern here!");
|
||||
if (encodedValue == null) throw new IllegalArgumentException("No pattern here!");
|
||||
NBTTagList nbt = encodedValue.getTagList(tag, 10);
|
||||
int index = args.checkInteger(1) - 1;
|
||||
if (index < 0)
|
||||
throw new IllegalArgumentException("Invalid index!");
|
||||
if (index < 0) throw new IllegalArgumentException("Invalid index!");
|
||||
nbt.removeTag(index);
|
||||
encodedValue.setTag(tag, nbt);
|
||||
pattern.setTagCompound(encodedValue);
|
||||
@@ -159,24 +149,20 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
stack = ItemFluidDrop.newStack(fluids);
|
||||
}
|
||||
int index = args.checkInteger(4) - 1;
|
||||
if (index < 0 || index > 511)
|
||||
throw new IllegalArgumentException("Invalid index!");
|
||||
if (index < 0 || index > 511) throw new IllegalArgumentException("Invalid index!");
|
||||
ItemStack pattern = inv.getStackInSlot(slot);
|
||||
if (validPattern(pattern)) {
|
||||
NBTTagCompound encodedValue = pattern.getTagCompound();
|
||||
if (encodedValue == null)
|
||||
throw new IllegalArgumentException("No pattern here!");
|
||||
if (encodedValue == null) throw new IllegalArgumentException("No pattern here!");
|
||||
|
||||
NBTTagList inTag = encodedValue.getTagList(tag, 10);
|
||||
while (inTag.tagCount() <= index)
|
||||
inTag.appendTag(new NBTTagCompound());
|
||||
while (inTag.tagCount() <= index) inTag.appendTag(new NBTTagCompound());
|
||||
if (stack != null) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
AEItemStack aeStack = AEItemStack.create(stack);
|
||||
aeStack.writeToNBT(nbt);
|
||||
inTag.func_150304_a(index, nbt);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
inTag.removeTag(index);
|
||||
}
|
||||
encodedValue.setTag(tag, inTag);
|
||||
@@ -194,14 +180,16 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
public Object[] getInterfaceConfiguration(Context context, Arguments args) {
|
||||
IInventory config = tileEntity.getInternalInventory();
|
||||
int slot = optSlot(args, config, 0, 0);
|
||||
ItemStack stack = config.getStackInSlot(slot);
|
||||
if (!validPattern(stack )) {
|
||||
ItemStack stack = config.getStackInSlot(slot);
|
||||
if (!validPattern(stack)) {
|
||||
throw new IllegalArgumentException("Not Fluid Encoded pattern!");
|
||||
}
|
||||
return new Object[]{stack};
|
||||
return new Object[] {stack};
|
||||
}
|
||||
|
||||
@Callback(doc = "function([slot:number][, database:address, entry:number[, size:number]]):boolean -- Configure the interface.")
|
||||
@Callback(
|
||||
doc =
|
||||
"function([slot:number][, database:address, entry:number[, size:number]]):boolean -- Configure the interface.")
|
||||
public Object[] setInterfaceConfiguration(Context context, Arguments args) {
|
||||
IInventory config = tileEntity.getInternalInventory();
|
||||
int slot = args.isString(0) ? 0 : optSlot(args, config, 0, 0);
|
||||
@@ -218,22 +206,30 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
return new Object[] {stack};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number, database:address, entry:number, size:number, index:number):boolean -- Set the pattern item input at the given index.")
|
||||
@Callback(
|
||||
doc =
|
||||
"function(slot:number, database:address, entry:number, size:number, index:number):boolean -- Set the pattern item input at the given index.")
|
||||
public Object[] setInterfacePatternItemInput(Context context, Arguments args) {
|
||||
return setPatternSlot(context, args, "in", false);
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number, database:address, entry:number, size:number, index:number):boolean -- Set the pattern item output at the given index.")
|
||||
@Callback(
|
||||
doc =
|
||||
"function(slot:number, database:address, entry:number, size:number, index:number):boolean -- Set the pattern item output at the given index.")
|
||||
public Object[] setInterfacePatternItemOutput(Context context, Arguments args) {
|
||||
return setPatternSlot(context, args, "out", false);
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number, database:address, entry:number, size:number, index:number):boolean -- Set the pattern fluid input at the given index.")
|
||||
@Callback(
|
||||
doc =
|
||||
"function(slot:number, database:address, entry:number, size:number, index:number):boolean -- Set the pattern fluid input at the given index.")
|
||||
public Object[] setInterfacePatternFluidInput(Context context, Arguments args) {
|
||||
return setPatternSlot(context, args, "in", true);
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number, database:address, entry:number, size:number, index:number):boolean -- Set the pattern fluid output at the given index.")
|
||||
@Callback(
|
||||
doc =
|
||||
"function(slot:number, database:address, entry:number, size:number, index:number):boolean -- Set the pattern fluid output at the given index.")
|
||||
public Object[] setInterfacePatternFluidOutput(Context context, Arguments args) {
|
||||
return setPatternSlot(context, args, "out", true);
|
||||
}
|
||||
@@ -260,8 +256,7 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
}
|
||||
|
||||
public static class Provider implements EnvironmentProvider {
|
||||
Provider() {
|
||||
}
|
||||
Provider() {}
|
||||
|
||||
@Override
|
||||
public Class<?> getEnvironment(ItemStack itemStack) {
|
||||
@@ -271,5 +266,4 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,5 +12,4 @@ public class OCDriverInit {
|
||||
Driver.add(new DriverDualFluidInterface());
|
||||
Driver.add(new DriverDualFluidInterface.Provider());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.util.Util;
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.handlers.nei.TooltipHandlerWaila;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -9,8 +10,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FCTooltipHandlerWaila extends TooltipHandlerWaila {
|
||||
@Override
|
||||
public List<String> handleItemDisplayName(GuiContainer arg0, ItemStack itemstack, List<String> currenttip) {
|
||||
@@ -18,13 +17,21 @@ public class FCTooltipHandlerWaila extends TooltipHandlerWaila {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer arg0, ItemStack itemstack, int arg2, int arg3, List<String> currenttip) {
|
||||
public List<String> handleItemTooltip(
|
||||
GuiContainer arg0, ItemStack itemstack, int arg2, int arg3, List<String> currenttip) {
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemFluidDrop && currenttip.size() > 0) {
|
||||
FluidStack fs = ItemFluidDrop.getFluidStack(itemstack);
|
||||
if (fs == null) return currenttip;
|
||||
currenttip.set(0, Tooltip.partFluidTerminalFluidFormat(fs));
|
||||
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips) {
|
||||
currenttip.set(1, EnumChatFormatting.GRAY + String.format("%s:%s", Util.getFluidModID(fs.getFluid()), fs.getFluid().getName()) + EnumChatFormatting.RESET);
|
||||
currenttip.set(
|
||||
1,
|
||||
EnumChatFormatting.GRAY
|
||||
+ String.format(
|
||||
"%s:%s",
|
||||
Util.getFluidModID(fs.getFluid()),
|
||||
fs.getFluid().getName())
|
||||
+ EnumChatFormatting.RESET);
|
||||
}
|
||||
String modName = Util.getFluidModName(fs.getFluid());
|
||||
if (modName != null && !modName.equals(""))
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.glodblock.github.crossmod.waila.part.FluidInvWailaDataProvider;
|
||||
import com.glodblock.github.crossmod.waila.part.SpeedWailaDataProvider;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
@@ -18,8 +19,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PartWailaDataProvider implements IWailaDataProvider {
|
||||
private final List<IPartWailaDataProvider> providers;
|
||||
private final PartAccessor accessor = new PartAccessor();
|
||||
@@ -55,10 +54,10 @@ public class PartWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final MovingObjectPosition mop = accessor.getPosition();
|
||||
|
||||
@@ -77,10 +76,10 @@ public class PartWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final MovingObjectPosition mop = accessor.getPosition();
|
||||
|
||||
@@ -99,10 +98,10 @@ public class PartWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final MovingObjectPosition mop = accessor.getPosition();
|
||||
|
||||
@@ -121,13 +120,13 @@ public class PartWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
final MovingObjectPosition mop = this.tracer.retraceBlock(world, player, x, y, z);
|
||||
|
||||
if (mop != null) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.glodblock.github.crossmod.waila;
|
||||
import com.glodblock.github.crossmod.waila.tile.FluidInvWailaDataProvider;
|
||||
import com.glodblock.github.crossmod.waila.tile.LevelMaintainerWailaDataProvide;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
@@ -12,8 +13,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileWailaDataProvider implements IWailaDataProvider {
|
||||
private final List<IWailaDataProvider> providers;
|
||||
|
||||
@@ -30,10 +29,10 @@ public class TileWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaHead(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
@@ -43,10 +42,10 @@ public class TileWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaBody(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
@@ -56,10 +55,10 @@ public class TileWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaTail(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
@@ -69,13 +68,13 @@ public class TileWailaDataProvider implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getNBTData(player, te, tag, world, x, y, z);
|
||||
}
|
||||
|
||||
@@ -2,30 +2,37 @@ package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
import java.text.NumberFormat;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
public class Tooltip {
|
||||
public static String fluidFormat(String name, int amount) {
|
||||
return String.format("%s: %s mB", name, NumberFormat.getInstance().format(amount));
|
||||
}
|
||||
|
||||
public static String partFluidBusFormat(int amount) {
|
||||
return String.format("%s: %s mB/t", I18n.format(NameConst.WAILA_SPEED), NumberFormat.getInstance().format(amount));
|
||||
return String.format(
|
||||
"%s: %s mB/t",
|
||||
I18n.format(NameConst.WAILA_SPEED), NumberFormat.getInstance().format(amount));
|
||||
}
|
||||
|
||||
public static String tileFluidInterfaceFormat(String name, int amount, int face) {
|
||||
return String.format("%s %s: %s mB", I18n.format(NameConst.GUI_FLUID_INTERFACE + "." + face), name, NumberFormat.getInstance().format(amount));
|
||||
return String.format(
|
||||
"%s %s: %s mB",
|
||||
I18n.format(NameConst.GUI_FLUID_INTERFACE + "." + face),
|
||||
name,
|
||||
NumberFormat.getInstance().format(amount));
|
||||
}
|
||||
|
||||
public static String tileLevelMaintainerFormat(String name, long quantity, long batch, boolean isEnable) {
|
||||
return String.format("%s: %s / %s %s",
|
||||
name, NumberFormat.getInstance().format(quantity), NumberFormat.getInstance().format(batch),
|
||||
isEnable ? I18n.format(NameConst.WAILA_ENABLE) : I18n.format(NameConst.WAILA_DISABLE)
|
||||
);
|
||||
return String.format(
|
||||
"%s: %s / %s %s",
|
||||
name,
|
||||
NumberFormat.getInstance().format(quantity),
|
||||
NumberFormat.getInstance().format(batch),
|
||||
isEnable ? I18n.format(NameConst.WAILA_ENABLE) : I18n.format(NameConst.WAILA_DISABLE));
|
||||
}
|
||||
|
||||
public static String partFluidTerminalFluidFormat(FluidStack fs) {
|
||||
|
||||
@@ -23,5 +23,4 @@ public class WailaInit {
|
||||
registrar.registerBodyProvider(tile, AEBaseTile.class);
|
||||
registrar.registerNBTProvider(tile, AEBaseTile.class);
|
||||
}
|
||||
|
||||
}
|
||||
+13
-14
@@ -5,6 +5,7 @@ import appeng.integration.modules.waila.part.BasePartWailaDataProvider;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -13,15 +14,13 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FluidInvWailaDataProvider extends BasePartWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final IPart part,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final IPart part,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
if (part instanceof IAEFluidInventory) {
|
||||
((IAEFluidInventory) part).getInternalFluid().readFromNBT(accessor.getNBTData(), "fluidInv");
|
||||
AEFluidInventory fluidInventory = ((IAEFluidInventory) part).getInternalFluid();
|
||||
@@ -36,14 +35,14 @@ public class FluidInvWailaDataProvider extends BasePartWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final IPart part,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
final EntityPlayerMP player,
|
||||
final IPart part,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
if (part instanceof IAEFluidInventory) {
|
||||
((IAEFluidInventory) part).getInternalFluid().writeToNBT(tag, "fluidInv");
|
||||
}
|
||||
|
||||
+13
-14
@@ -4,6 +4,7 @@ import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.BasePartWailaDataProvider;
|
||||
import com.glodblock.github.common.parts.PartSharedFluidBus;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -11,16 +12,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SpeedWailaDataProvider extends BasePartWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final IPart part,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final IPart part,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
if (part instanceof PartSharedFluidBus) {
|
||||
part.readFromNBT(accessor.getNBTData());
|
||||
currentToolTip.add(Tooltip.partFluidBusFormat(((PartSharedFluidBus) part).calculateAmountToSend() / 5));
|
||||
@@ -30,14 +29,14 @@ public class SpeedWailaDataProvider extends BasePartWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final IPart part,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
final EntityPlayerMP player,
|
||||
final IPart part,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
if (part instanceof PartSharedFluidBus) {
|
||||
part.writeToNBT(tag);
|
||||
}
|
||||
|
||||
+14
-14
@@ -7,6 +7,7 @@ import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -17,16 +18,14 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FluidInvWailaDataProvider extends BaseWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if (te instanceof TileFluidInterface) {
|
||||
((IAEFluidInventory) te).getInternalFluid().readFromNBT(accessor.getNBTData(), "fluidInv");
|
||||
@@ -53,7 +52,8 @@ public class FluidInvWailaDataProvider extends BaseWailaDataProvider {
|
||||
if (ft.getFluidInSlot(i) == null) continue;
|
||||
FluidStack fs = ft.getFluidInSlot(i).getFluidStack();
|
||||
if (prefix) {
|
||||
currentToolTip.add(Tooltip.tileFluidInterfaceFormat(fs.getFluid().getLocalizedName(), fs.amount, i));
|
||||
currentToolTip.add(
|
||||
Tooltip.tileFluidInterfaceFormat(fs.getFluid().getLocalizedName(), fs.amount, i));
|
||||
} else {
|
||||
currentToolTip.add(Tooltip.fluidFormat(fs.getFluid().getLocalizedName(), fs.amount));
|
||||
}
|
||||
@@ -66,13 +66,13 @@ public class FluidInvWailaDataProvider extends BaseWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
if (te instanceof IAEFluidInventory) {
|
||||
((IAEFluidInventory) te).getInternalFluid().writeToNBT(tag, "fluidInv");
|
||||
} else if (te instanceof TileFluidPacketDecoder) {
|
||||
|
||||
+18
-20
@@ -4,6 +4,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import java.util.List;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -12,43 +13,40 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LevelMaintainerWailaDataProvide extends BaseWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if (te instanceof TileLevelMaintainer) {
|
||||
te.readFromNBT(accessor.getNBTData());
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
IAEItemStack ias = ((TileLevelMaintainer) te).requests.getRequestStacks().getStack(i);
|
||||
IAEItemStack ias =
|
||||
((TileLevelMaintainer) te).requests.getRequestStacks().getStack(i);
|
||||
if (ias != null) {
|
||||
currentToolTip.add(Tooltip.tileLevelMaintainerFormat(
|
||||
ias.getItemStack().getDisplayName(),
|
||||
((TileLevelMaintainer) te).requests.getQuantity(i),
|
||||
((TileLevelMaintainer) te).requests.getBatchSize(i),
|
||||
((TileLevelMaintainer) te).requests.isEnable(i)
|
||||
));
|
||||
ias.getItemStack().getDisplayName(),
|
||||
((TileLevelMaintainer) te).requests.getQuantity(i),
|
||||
((TileLevelMaintainer) te).requests.getBatchSize(i),
|
||||
((TileLevelMaintainer) te).requests.isEnable(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
if (te instanceof TileLevelMaintainer) {
|
||||
te.writeToNBT(tag);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user