Skip to content

Commit

Permalink
snake case peripheral types, some ae2 test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SirEndii committed Sep 7, 2024
1 parent 32b2eaf commit 21c4f6f
Show file tree
Hide file tree
Showing 20 changed files with 41 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public NoteBlockIntegration(Level world, BlockPos pos) {
@NotNull
@Override
public String getType() {
return "noteBlock";
return "note_block";
}

@LuaFunction(mainThread = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

public class FluidDetectorPeripheral extends BasePeripheral<BlockEntityPeripheralOwner<FluidDetectorEntity>> {

public static final String TYPE = "fluid_detector";
public static final String PERIPHERAL_TYPE = "fluid_detector";

public FluidDetectorPeripheral(FluidDetectorEntity tileEntity) {
super(TYPE, new BlockEntityPeripheralOwner<>(tileEntity));
super(PERIPHERAL_TYPE, new BlockEntityPeripheralOwner<>(tileEntity));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

public class GasDetectorPeripheral extends BasePeripheral<BlockEntityPeripheralOwner<GasDetectorEntity>> {

public static final String TYPE = "gas_detector";
public static final String PERIPHERAL_TYPE = "gas_detector";

public GasDetectorPeripheral(GasDetectorEntity tileEntity) {
super(TYPE, new BlockEntityPeripheralOwner<>(tileEntity));
super(PERIPHERAL_TYPE, new BlockEntityPeripheralOwner<>(tileEntity));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

public class MeBridgePeripheral extends BasePeripheral<BlockEntityPeripheralOwner<MeBridgeEntity>> implements IStorageSystemPeripheral {

public static final String PERIPHERAL_TYPE = "meBridge";
public static final String PERIPHERAL_TYPE = "me_bridge";
private final MeBridgeEntity tile;
private IGridNode node;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import dan200.computercraft.shared.Registry;
import de.srendi.advancedperipherals.AdvancedPeripherals;
import de.srendi.advancedperipherals.client.KeyBindings;
import de.srendi.advancedperipherals.common.util.EnumColor;
import de.srendi.advancedperipherals.common.util.StringUtil;
import net.minecraft.ResourceLocationException;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

sleep(3)

chatBox = peripheral.find("chatBox")
chatBox = peripheral.find("chat_box")
test.assert(chatBox, "Peripheral not found")
config = chatBox.getConfiguration()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
--- `sendFormattedMessage`, `sendFormattedMessageToPlayer`
---

chatBox = peripheral.find("chatBox")
chatBox = peripheral.find("chat_box")
test.assert(chatBox, "Peripheral not found")

function assertMessage(msg, hidden)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
---

-- Test for Entropinnyum (Flower has full mana store and is on enchanted soil)
test.eq("manaFlower", peripheral.getType("left"), "Peripheral should be manaFlower")
test.eq("mana_flower", peripheral.getType("left"), "Peripheral should be manaFlower")
entropinnyum = peripheral.wrap("left")
test.assert(entropinnyum, "Peripheral not found")

Expand All @@ -17,7 +17,7 @@ test.assert(not entropinnyum.isFloating(), "Entropinnyum should not be floating"
-- test.assert(not entropinnyum.isEmpty(), "Entropinnyum should not be empty") TODO: uncomment for 1.20.1 AP versions

-- Test for Endoflame (Flower has no mana stored and is on normal soil)
test.eq("manaFlower", peripheral.getType("right"), "Peripheral should be manaFlower")
test.eq("mana_flower", peripheral.getType("right"), "Peripheral should be manaFlower")
endoflame = peripheral.wrap("right")
test.assert(endoflame, "Peripheral not found")

Expand All @@ -29,7 +29,7 @@ test.assert(not endoflame.isFloating(), "Endoflame should not be floating")
-- test.assert(endoflame.isEmpty(), "Endoflame should be empty") TODO: uncomment for 1.20.1 AP versions

-- Test for Kekimurus (Flower has 1800 mana stored and is floating)
test.eq("manaFlower", peripheral.getType("back"), "Peripheral should be manaFlower")
test.eq("mana_flower", peripheral.getType("back"), "Peripheral should be manaFlower")
kekimurus = peripheral.wrap("back")
test.assert(kekimurus, "Peripheral not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-- TODO Add tests for canChargeItem, hasItems and getItems in 1.20.1 AP versions

-- Test Fabulous Mana Pool (should be empty)
test.eq("manaPool", peripheral.getType("left"), "Peripheral should be manaPool")
test.eq("mana_pool", peripheral.getType("left"), "Peripheral should be manaPool")
fabulous = peripheral.wrap("left")
test.assert(fabulous, "Peripheral not found")

Expand All @@ -18,7 +18,7 @@ test.eq(1000000, fabulous.getManaNeeded(), "Mana needed should be 1000000")
test.assert(not fabulous.isFull(), "Mana pool should not be full")

-- Test Mana Pool (should have 36000 mana)
test.eq("manaPool", peripheral.getType("right"), "Peripheral should be manaPool")
test.eq("mana_pool", peripheral.getType("right"), "Peripheral should be manaPool")
manaPool = peripheral.wrap("right")
test.assert(manaPool, "Peripheral not found")

Expand All @@ -29,7 +29,7 @@ test.eq(964000, manaPool.getManaNeeded(), "Mana needed should be 964000")
test.assert(not manaPool.isFull(), "Mana pool should not be full")

-- Test Creative Mana Pool (should have 1000000 mana)
test.eq("manaPool", peripheral.getType("back"), "Peripheral should be manaPool")
test.eq("mana_pool", peripheral.getType("back"), "Peripheral should be manaPool")
creative = peripheral.wrap("back")
test.assert(creative, "Peripheral not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-- TODO Add tests for hasLens and getLens in 1.20.1 AP versions

-- Test basic Mana Spreader that is empty and directed towards a Mana Pool
test.eq("manaSpreader", peripheral.getType("left"), "Peripheral should be manaSpreader")
test.eq("mana_spreader", peripheral.getType("left"), "Peripheral should be manaSpreader")
spreader = peripheral.wrap("left")
test.assert(spreader, "Peripheral not found")

Expand All @@ -27,7 +27,7 @@ test.eq(computerPos.y, bounding.y, "Bounding y should be set to Mana pool (same
test.eq(computerPos.z - 1, bounding.z, "Bounding z should be set to Mana pool (-1 relative to computer")

-- Test Gaia Mana Spreader that is full
test.eq("manaSpreader", peripheral.getType("right"), "Peripheral should be manaSpreader")
test.eq("mana_spreader", peripheral.getType("right"), "Peripheral should be manaSpreader")
gaiaSpreader = peripheral.wrap("right")
test.assert(gaiaSpreader, "Peripheral not found")

Expand All @@ -40,7 +40,7 @@ test.assert(gaiaSpreader.isFull(), "Mana Spreader should be full")
test.assert(not gaiaSpreader.getBounding(), "Mana Spreader should not be bound to anything")

-- Test Elven Mana Spreader that has 177 mana
test.eq("manaSpreader", peripheral.getType("back"), "Peripheral should be manaSpreader")
test.eq("mana_spreader", peripheral.getType("back"), "Peripheral should be manaSpreader")
elvenSpreader = peripheral.wrap("back")
test.assert(elvenSpreader, "Peripheral not found")

Expand All @@ -53,7 +53,7 @@ test.assert(not elvenSpreader.isFull(), "Mana Spreader should not be full")
test.assert(not elvenSpreader.getBounding(), "Mana Spreader should not be bound to anything")

-- Test Pulse Mana Spreader that is empty
test.eq("manaSpreader", peripheral.getType("top"), "Peripheral should be manaSpreader")
test.eq("mana_spreader", peripheral.getType("top"), "Peripheral should be manaSpreader")
pulseSpreader = peripheral.wrap("top")
test.assert(pulseSpreader, "Peripheral not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--- Covers `playNote`, `getNote`, `changeNoteBy`, `changeNote`
---

test.eq("noteBlock", peripheral.getType("left"), "Peripheral should be noteBlock")
test.eq("note_block", peripheral.getType("left"), "Peripheral should be noteBlock")
noteBlock = peripheral.wrap("left")
test.assert(noteBlock, "Peripheral not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function tableLength(T)
end

-- Test Block Reader functions on a simple block
test.eq("blockReader", peripheral.getType("left"), "Peripheral should be blockReader")
test.eq("block_reader", peripheral.getType("left"), "Peripheral should be blockReader")
simpleReader = peripheral.wrap("left")
test.assert(simpleReader, "Peripheral not found")

Expand All @@ -20,7 +20,7 @@ test.assert(not simpleReader.isTileEntity(), "Block should not be a TileEntity")
test.eq(0, tableLength(simpleReader.getBlockStates()), "Block State should be empty")

-- Test Block Reader functions on a stair block
test.eq("blockReader", peripheral.getType("back"), "Peripheral should be blockReader")
test.eq("block_reader", peripheral.getType("back"), "Peripheral should be blockReader")
stairReader = peripheral.wrap("back")
test.assert(stairReader, "Peripheral not found")

Expand All @@ -35,7 +35,7 @@ test.eq("straight", stairReader.getBlockStates()["shape"], "Stair Shape should b
test.assert(not stairReader.getBlockStates()["waterlogged"], "Stair Waterlogged should be false")

-- Test Block Reader functions on a sign block
test.eq("blockReader", peripheral.getType("right"), "Peripheral should be blockReader")
test.eq("block_reader", peripheral.getType("right"), "Peripheral should be blockReader")
signReader = peripheral.wrap("right")
test.assert(signReader, "Peripheral not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--- Covers `getTransferRate`, `setTransferRateLimit`, `getTransferRateLimit`
---

test.eq("energyDetector", peripheral.getType("right"), "Peripheral should be energyDetector")
test.eq("energy_detector", peripheral.getType("right"), "Peripheral should be energyDetector")

det = peripheral.wrap("right")
det.setTransferRateLimit(0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
detector = peripheral.find("environmentDetector")
detector = peripheral.find("environment_detector")
test.assert(detector, true, "Peripheral not found")

isRaining = detector.isRaining()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function testBlockAt(result, x, y, z, expectedName, expectedTag)
test.assert(tagFound, ("Block at %d, %d, %d has the wrong tags"):format(x, y, z))
end

scanner = peripheral.find("geoScanner")
scanner = peripheral.find("geo_scanner")
test.assert(scanner, "Peripheral not found")

config = scanner.getConfiguration()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ test.assert(isOnline, "Bridge is not connected/system is not online")
energyUsage = bridge.getEnergyUsage()
test.assert(energyUsage > 18, tostring(energyUsage) .. " Consumption does not seem right")

maxEnergyStorage = bridge.getMaxEnergyStorage()
maxEnergyStorage = bridge.getEnergyCapacity()
test.assert(maxEnergyStorage == 1608800, tostring(maxEnergyStorage) .. " Max Energy Storage does not seem right")

energyStorage = bridge.getEnergyStorage()
energyStorage = bridge.getStoredEnergy()
test.assert(energyStorage > 1590000, tostring(energyStorage) .. " Energy Storage does not seem right")

totalItemStorage = bridge.getTotalItemStorage()
test.assert(totalItemStorage == 67264, "Total item storage is not valid")
test.assert(totalItemStorage == 65536, "Total item storage is not valid")

totalFluidStorage = bridge.getTotalFluidStorage()
test.assert(totalFluidStorage == 81536, "Total fluid storage is not valid")
test.assert(totalFluidStorage == 65536, "Total fluid storage is not valid")

usedItemStorage = bridge.getUsedItemStorage()
test.assert(usedItemStorage == 1120, "Used item storage is not valid")
test.assert(usedItemStorage == 1088, "Used item storage is not valid")

usedFluidStorage = bridge.getUsedFluidStorage()
test.assert(usedFluidStorage == 2025, "Used fluid storage is not valid")
test.assert(usedFluidStorage == 1025, "Used fluid storage is not valid")

availableItemStorage = bridge.getAvailableItemStorage()
test.assert(availableItemStorage == 66144, "Available item storage is not valid")
test.assert(availableItemStorage == 64448, "Available item storage is not valid")

availableFluidStorage = bridge.getAvailableFluidStorage()
test.assert(availableFluidStorage == 79511, "Available fluid storage is not valid")
test.assert(availableFluidStorage == 64511, "Available fluid storage is not valid")

cells = bridge.listCells()
test.assert(#cells == 2, "There should be 2 cells")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
---

sleep(4)
bridge = peripheral.wrap("meBridge_3")
bridge = peripheral.wrap("me_bridge_3")
chest = peripheral.wrap("minecraft:chest_2")
test.assert(bridge, "Peripheral not found")
test.assert(chest, "Chest not found")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TEST_FLOAT = 3.14
TEST_VALUE = "AP Game Test"
TEST_JSON_VALUE = "AP Game Test JSON"

test.eq("nbtStorage", peripheral.getType("left"), "Peripheral should be nbtStorage")
test.eq("nbt_storage", peripheral.getType("left"), "Peripheral should be nbtStorage")
storage = peripheral.wrap("left")
test.assert(storage, "Peripheral not found")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
--- `getAnalogOutput`, `setOutput`, `setAnalogOutput`
---

test.eq("redstoneIntegrator", peripheral.getType("left"), "Peripheral should be redstoneIntegrator")
test.eq("redstoneIntegrator", peripheral.getType("right"), "Peripheral should be redstoneIntegrator")
test.eq("redstone_integrator", peripheral.getType("left"), "Peripheral should be redstone_integrator")
test.eq("redstone_integrator", peripheral.getType("right"), "Peripheral should be redstone_integrator")

first = peripheral.wrap("left")
test.assert(first, "Peripheral not found")
Expand Down

0 comments on commit 21c4f6f

Please sign in to comment.