Made LuaFunction's final

This commit is contained in:
caelwarner 2022-10-19 22:45:47 -07:00
parent 56a1210fff
commit 7d47fdcd06
Failed to generate hash of commit
6 changed files with 19 additions and 23 deletions

View file

@ -24,34 +24,34 @@ public class DisplayLinkPeripheral extends PeripheralBase<DisplayLinkTileEntity>
} }
@LuaFunction @LuaFunction
public void setCursorPos(int x, int y) { public final void setCursorPos(int x, int y) {
cursorX.set(x - 1); cursorX.set(x - 1);
cursorY.set(y - 1); cursorY.set(y - 1);
} }
@LuaFunction @LuaFunction
public Object[] getCursorPos() { public final Object[] getCursorPos() {
return new Object[] {cursorX.get() + 1, cursorY.get() + 1}; return new Object[] {cursorX.get() + 1, cursorY.get() + 1};
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public Object[] getSize() { public final Object[] getSize() {
DisplayTargetStats stats = tile.activeTarget.provideStats(new DisplayLinkContext(tile.getLevel(), tile)); DisplayTargetStats stats = tile.activeTarget.provideStats(new DisplayLinkContext(tile.getLevel(), tile));
return new Object[]{stats.maxRows(), stats.maxColumns()}; return new Object[]{stats.maxRows(), stats.maxColumns()};
} }
@LuaFunction @LuaFunction
public boolean isColor() { public final boolean isColor() {
return false; return false;
} }
@LuaFunction @LuaFunction
public boolean isColour() { public final boolean isColour() {
return false; return false;
} }
@LuaFunction @LuaFunction
public void write(String text) { public final void write(String text) {
ListTag tag = tile.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING); ListTag tag = tile.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
int x = cursorX.get(); int x = cursorX.get();
@ -74,7 +74,7 @@ public class DisplayLinkPeripheral extends PeripheralBase<DisplayLinkTileEntity>
} }
@LuaFunction @LuaFunction
public void clearLine() { public final void clearLine() {
ListTag tag = tile.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING); ListTag tag = tile.getSourceConfig().getList(TAG_KEY, Tag.TAG_STRING);
if (tag.size() > cursorY.get()) if (tag.size() > cursorY.get())
@ -86,14 +86,14 @@ public class DisplayLinkPeripheral extends PeripheralBase<DisplayLinkTileEntity>
} }
@LuaFunction @LuaFunction
public void clear() { public final void clear() {
synchronized (tile) { synchronized (tile) {
tile.getSourceConfig().put(TAG_KEY, new ListTag()); tile.getSourceConfig().put(TAG_KEY, new ListTag());
} }
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public void update() { public final void update() {
tile.tickSource(); tile.tickSource();
} }

View file

@ -18,17 +18,17 @@ public class SequencedGearshiftPeripheral extends PeripheralBase<SequencedGearsh
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public void rotate(IArguments arguments) throws LuaException { public final void rotate(IArguments arguments) throws LuaException {
runInstruction(arguments, SequencerInstructions.TURN_ANGLE); runInstruction(arguments, SequencerInstructions.TURN_ANGLE);
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public void move(IArguments arguments) throws LuaException { public final void move(IArguments arguments) throws LuaException {
runInstruction(arguments, SequencerInstructions.TURN_DISTANCE); runInstruction(arguments, SequencerInstructions.TURN_DISTANCE);
} }
@LuaFunction @LuaFunction
public boolean isRunning() { public final boolean isRunning() {
return !this.tile.isIdle(); return !this.tile.isIdle();
} }

View file

@ -17,12 +17,12 @@ public class SpeedControllerPeripheral extends PeripheralBase<SpeedControllerTil
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public void setTargetSpeed(int speed) { public final void setTargetSpeed(int speed) {
this.targetSpeed.setValue(speed); this.targetSpeed.setValue(speed);
} }
@LuaFunction @LuaFunction
public float getTargetSpeed() { public final float getTargetSpeed() {
return this.targetSpeed.getValue(); return this.targetSpeed.getValue();
} }

View file

@ -13,7 +13,7 @@ public class SpeedGaugePeripheral extends PeripheralBase<SpeedGaugeTileEntity> {
} }
@LuaFunction @LuaFunction
public float getSpeed() { public final float getSpeed() {
return this.tile.getSpeed(); return this.tile.getSpeed();
} }

View file

@ -4,11 +4,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.Supplier; import java.util.function.Supplier;
import com.simibubi.create.compat.computercraft.CreateLuaTable;
import com.simibubi.create.compat.computercraft.peripherals.PeripheralBase;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import com.simibubi.create.compat.computercraft.CreateLuaTable;
import com.simibubi.create.content.logistics.trains.entity.Train; import com.simibubi.create.content.logistics.trains.entity.Train;
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.GlobalStation; import com.simibubi.create.content.logistics.trains.management.edgePoint.station.GlobalStation;
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.StationTileEntity; import com.simibubi.create.content.logistics.trains.management.edgePoint.station.StationTileEntity;
@ -32,7 +30,7 @@ public class StationPeripheral extends PeripheralBase<StationTileEntity> {
} }
@LuaFunction(mainThread = true) @LuaFunction(mainThread = true)
public void setSchedule(IArguments arguments) throws LuaException { public final void setSchedule(IArguments arguments) throws LuaException {
GlobalStation station = tile.getStation(); GlobalStation station = tile.getStation();
if (station == null) if (station == null)
throw new LuaException("train station does not exist"); throw new LuaException("train station does not exist");

View file

@ -1,7 +1,5 @@
package com.simibubi.create.compat.computercraft.peripherals; package com.simibubi.create.compat.computercraft.peripherals;
import com.simibubi.create.compat.computercraft.peripherals.PeripheralBase;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity; import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity;
@ -15,12 +13,12 @@ public class StressGaugePeripheral extends PeripheralBase<StressGaugeTileEntity>
} }
@LuaFunction @LuaFunction
public float getStress() { public final float getStress() {
return this.tile.getNetworkStress(); return this.tile.getNetworkStress();
} }
@LuaFunction @LuaFunction
public float getStressCapacity() { public final float getStressCapacity() {
return this.tile.getNetworkCapacity(); return this.tile.getNetworkCapacity();
} }