spotless apply

This commit is contained in:
asdflj committed 2022-12-05 14:41:36 +08:00
1 parent 6acf2bace1
commit 5e31096c7e
191 files changed
+5046 -5165

No files matched your search

@@ -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;
}
}
}
@@ -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) {
@@ -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());
}
}