Skip to content

Merge dev/1.19.2 into dev/1.20.1 #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 187 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
4ad1bf2
Goodbye stinky
SirEndii Sep 22, 2022
fd18e23
[#250]Added Fluid Detector
SirEndii Oct 5, 2022
b011743
No Energy
SirEndii Oct 5, 2022
8e7665b
Added the gas detector
SirEndii Oct 7, 2022
d9927a0
Merge branch '1.19' into dev/0.8
SirEndii Oct 7, 2022
f73ec76
Fixed detectors not saving max flow rate
SirEndii Oct 7, 2022
a8cd778
Fixed `getTransferRate()` - gas detector
SirEndii Oct 8, 2022
e70e1c8
[#320] Added the basics of a distance detector
SirEndii Oct 20, 2022
c6e99d8
Added `getRadiation` to the environment detector
SirEndii Oct 20, 2022
12407ea
Merge branch '1.19' into dev/0.8
SirEndii Dec 20, 2022
4e3f144
1.19.3 for 0.8
SirEndii Dec 20, 2022
abd86a5
Merge branch '1.19' into dev/0.8
SirEndii Jan 1, 2023
d07cc59
Adapt me and rs bridge functions. Both bridges now have the same func…
SirEndii Jan 2, 2023
09772d0
Merge branch '1.19' into dev/0.8
SirEndii Feb 12, 2023
02a0732
Merge branch '1.19' into dev/0.8
SirEndii Feb 14, 2023
6d4abd9
Merge branch '1.19' into dev/0.8
SirEndii Feb 20, 2023
c52dac5
Some distance detector stuff
SirEndii Feb 22, 2023
43ddbcb
Some distance detection work, added the ability to also scan for enti…
SirEndii Feb 23, 2023
3891cf1
Merge remote-tracking branch 'origin/dev/0.8' into dev/0.8
SirEndii Feb 23, 2023
8c148c3
Laser pew pew
SirEndii Feb 26, 2023
8f138e8
Remove deprecation of IInventoryBlock.java
SirEndii Mar 2, 2023
71485b5
Merge remote-tracking branch 'origin/dev/0.8' into dev/0.8
SirEndii Mar 4, 2023
a91567f
Update some dependencies
SirEndii Mar 4, 2023
7c2298d
Run on selfhosted
SirEndii Mar 4, 2023
62f9469
Some very very basic smart glasses approaches. This just adds the sma…
SirEndii Mar 5, 2023
6222b3f
Checked the style
SirEndii Mar 5, 2023
4a0533a
Re-add the smart glasses model
SirEndii Mar 8, 2023
e49283f
Merge branch '1.19.3' into dev/0.8
SirEndii Mar 9, 2023
97cfbf3
Away with you
SirEndii Mar 9, 2023
a2af4b5
Add a new memory card texture with a bounded property
SirEndii Mar 9, 2023
8e9aaf4
Added an inventory and an item handler for the glasses
SirEndii Mar 9, 2023
7f582ee
Added a smart glasses interface
SirEndii Mar 13, 2023
7f8cc59
[#423] Fixed that some functions of the me and rs bridge ignore or in…
SirEndii Mar 14, 2023
811b722
tidy
SirEndii Mar 14, 2023
1ac99dd
Refactored the screens into the client package
SirEndii Mar 14, 2023
bc02347
Some UI stuff
SirEndii Mar 15, 2023
159268e
Added a new taiga village structure
SirEndii Mar 15, 2023
306e2a6
Finished the UI. Added a modules and peripheral tab with proper visua…
SirEndii Mar 17, 2023
6296e86
First thoughts about the module system
SirEndii Mar 23, 2023
0897103
Added modules in the form of items, every item which is a module impl…
SirEndii Mar 24, 2023
3ec874b
Remove old ar controller block and peripheral
SirEndii Mar 24, 2023
0c718cc
Some distance detector progress
SirEndii Mar 24, 2023
5dba4d5
[#320] Finished the distance detector. Everything seems to work fine,…
SirEndii Mar 25, 2023
481df9c
Add some documentation and satisfy checkstyle
SirEndii Mar 25, 2023
3195048
🧹
SirEndii Mar 27, 2023
221ba87
Fixed detection type
SirEndii Mar 27, 2023
e9f3fda
Load ap addons statically
SirEndii Mar 27, 2023
ed84d4b
Merge branch '1.19.3' into dev/0.8
SirEndii Apr 8, 2023
c87c2e4
Merge branch '1.19.3' into dev/0.8
SirEndii Apr 14, 2023
147968f
Fixed some compiling issues
SirEndii Apr 14, 2023
568e337
More context please
SirEndii Apr 14, 2023
1e21135
Unify the rs and me bridge methods by using an interface. Adds more f…
SirEndii Apr 20, 2023
6182229
Do the same for the rs bridge.
SirEndii Apr 20, 2023
49de57a
Merge 1.19.3 to 0.8
SirEndii Jun 6, 2023
0fba0ab
I'm casting away
SirEndii Jun 17, 2023
f5267f4
Merge branch '1.19.3' into dev/0.8
SirEndii Jun 21, 2023
77eabce
Port 0.8 pack to 1.19.2 since we do not support 1.19.3 anymore.
SirEndii Jun 30, 2023
f1349b3
Adapt to checkstyle rules
SirEndii Jun 30, 2023
e723288
Merge branch '1.19.2' into dev/0.8
SirEndii Jun 30, 2023
0678a6b
Woopsy
SirEndii Jun 30, 2023
2a96856
Do some safety checks to satisfy sonar
SirEndii Jun 30, 2023
bffd679
Fix creative tab
SirEndii Jun 30, 2023
61255d2
Fixing a bug which I made by mistake
SirEndii Jun 30, 2023
99d9b0b
Minor bug fixes and improvements for the smart glasses system
SirEndii Jul 8, 2023
a155461
Merge remote-tracking branch 'origin/dev/0.8' into dev/0.8
Patprehn Jul 10, 2023
a4b6961
Merge branch '1.19.2' into dev/0.8
Patprehn Jul 10, 2023
7aa2617
Fix some compiling and checkstyle issues. We still have some issues a…
Patprehn Jul 10, 2023
ff0c113
Merge branch '1.19.2' into dev/0.8
Patprehn Jul 12, 2023
f435e63
Merge branch '1.19.2' into dev/0.8
Patprehn Jul 12, 2023
2704ee7
Refactor imports, improve comment clarity and fix that `APAddons` was…
Patprehn Jul 13, 2023
44977a6
Merge branch '1.19.2' into dev/0.8
SirEndii Jul 18, 2023
490eda0
Merge branch '1.19.2' into dev/0.8
SirEndii Jul 20, 2023
f7dd06b
Merge branch '1.19.2' into dev/0.8
SirEndii Jul 22, 2023
04a4238
Merge branch '1.19.2' into dev/0.8
SirEndii Jul 23, 2023
ebd9e14
Remove `DEV` from the version since our pipeline does handle this aut…
SirEndii Jul 23, 2023
4b420e2
Change the loading of our APAddons class to static loading since the …
SirEndii Jul 23, 2023
3d697b3
Merge branch '1.19.2' into dev/0.8
SirEndii Jul 26, 2023
f835c05
Merge branch '1.19.2' into dev/0.8
SirEndii Jul 27, 2023
3a2a71a
Merge branch '1.19.2' into dev/0.8
SirEndii Jul 30, 2023
32ad040
Merge branch '1.19.2' into dev/0.8
SirEndii Aug 11, 2023
98cb712
Check the style
SirEndii Aug 12, 2023
d7ce27e
Merge branch '1.19.2' into dev/0.8
SirEndii Aug 28, 2023
df046e9
Merge branch '1.19.2' into dev/0.8
SirEndii Sep 18, 2023
382963d
copy cat
SirEndii Sep 18, 2023
5551c2c
Runned datagen
SirEndii Sep 25, 2023
59febbb
Fixed that peripherals remain in the glasses computer after removing …
SirEndii Sep 26, 2023
289503e
Cleanups, docs and a ui fix
SirEndii Sep 26, 2023
ebab16e
Fixed smartglasses smithing recipe
SirEndii Sep 27, 2023
aa5336c
Merge branch '1.19.2' into dev/0.8
SirEndii Sep 27, 2023
1c61e27
Prototype for an object bases rendering system. Currently working on …
SirEndii Sep 27, 2023
c7289bc
Implemented mapping functionality via reflections.
SirEndii Sep 27, 2023
11eec61
Starting to use annotations for our properties to improve safety. Thi…
SirEndii Sep 27, 2023
e5849b6
Improve the way how we map the arguments retrieved from the lua endpo…
SirEndii Sep 28, 2023
ee2ab27
swoosh
SirEndii Sep 28, 2023
79f5c86
Trying a way to sync the overlay objects to the client of a player. A…
SirEndii Oct 2, 2023
03c3a40
Move to snake_case peripheral names to better fit with CC:T's standards
SirEndii Oct 2, 2023
203d9a8
Merge remote-tracking branch 'origin/dev/0.8' into dev/0.8
SirEndii Oct 2, 2023
b53a777
Remove our `to/fromPeripheral` functions and add the logic for periph…
SirEndii Oct 4, 2023
64694b8
Merge branch '1.19.2' into dev/0.8
SirEndii Oct 8, 2023
2a4b63c
Don't check dependency licenses
SirEndii Oct 8, 2023
3a19504
Fixed the colony integrator
SirEndii Nov 5, 2023
16d70cf
Merge branch '1.19.2' into dev/0.8
SirEndii Nov 5, 2023
b0a24eb
Add missing applied mekanistics to the build.gradle
SirEndii Nov 5, 2023
cbc4372
Merge remote-tracking branch 'origin/1.19.2' into dev/0.8
SirEndii Nov 10, 2023
4606244
Merge branch '1.19.2' into dev/0.8
SirEndii Dec 15, 2023
ea09ab1
Merge remote-tracking branch 'origin/dev/0.8' into dev/0.8
SirEndii Dec 15, 2023
5bab2e9
Start to implement more of the RS Bridge and ME Bridge IStorageSystem…
SirEndii Dec 15, 2023
4005a48
Implement pattern filtering for the me bridge
SirEndii Dec 16, 2023
09a1874
Fixed pattern listing. AE2 does not offer a way to get all patterns o…
SirEndii Dec 18, 2023
1154d8a
Improve and extend the functionality of the ME Bridge by implementing…
SirEndii Dec 21, 2023
c5eccc7
Implement mekanism chemical integration to the ME Bridge
SirEndii Dec 21, 2023
8e30dd6
Some cleanup
SirEndii Dec 21, 2023
1f9d5da
[#539] Remove the external storage counters from the internal functions
SirEndii Dec 22, 2023
5bfe290
Add Drives and Cells support to the ME Bridge
SirEndii Dec 24, 2023
ab7cdd8
use the BasicCellInventory class instead of trying to get the informa…
SirEndii Dec 24, 2023
a36cbad
[#51] Start an implementation for `getCraftingTasks` and `cancelCraft…
SirEndii Dec 26, 2023
ff2c69e
Set lua function to use the main tread.
Einhornyordle Dec 21, 2023
e031f32
Add peripheral functions for the Dim Chest of the Dimensional Storage…
Einhornyordle Dec 21, 2023
f2ff1ec
Merge pull request #550 from Einhornyordle/dev/0.8
SirEndii Jan 14, 2024
491b3da
Implement prototype of `cancelCraftingTasks` to the ME Bridge
SirEndii Jan 15, 2024
b5d3af8
Merge remote-tracking branch 'origin/dev/0.8' into dev/0.8
SirEndii Jan 15, 2024
e1f7b00
Merge branch 'dev/1.19.2-0.7.33r' into dev/0.8
SirEndii Jan 15, 2024
83da153
Merge branch 'dev/1.19.2' into dev/0.8
SirEndii Feb 19, 2024
ca99ea2
[#13] Add a hotkey module
SirEndii Feb 19, 2024
596200c
[AP-Features-13](https://github.com/IntelligenceModding/Advanced-Peri…
SirEndii Feb 20, 2024
285695d
Fixed the smart glasses ui when playing on servers
SirEndii Feb 23, 2024
4fd1953
Merge branch 'refs/heads/dev/1.19.2' into dev/0.8
SirEndii Feb 23, 2024
a1b7f53
Add the ability for the modules to inventory tick and fix double queu…
SirEndii Mar 18, 2024
44165e2
`!`
SirEndii Mar 18, 2024
a3ebf19
Add a night vision module to the smart glasses
SirEndii Mar 18, 2024
185de41
Merge branch 'refs/heads/dev/1.19.2' into dev/0.8
SirEndii Mar 30, 2024
d6cacfc
Adapt me functions to the internal api changes
SirEndii Mar 30, 2024
26af8c8
Satisfy checkstyle
SirEndii Apr 3, 2024
ab4b47c
Merge branch 'refs/heads/dev/1.19.2' into dev/0.8
SirEndii Apr 11, 2024
8c77231
add advanced place method to the compass peripheral
zyxkad Apr 25, 2024
fcbcc72
costs fuel when tring to use compass to place in far distance
zyxkad Apr 25, 2024
ed3fc3f
add wall operation
zyxkad Apr 25, 2024
bb6f385
rename argument wall -> anchor
zyxkad Apr 25, 2024
3dc0f4a
fix stylecheck
zyxkad Apr 25, 2024
0dd82f8
use nil instead of false
zyxkad Apr 25, 2024
7acb776
use validateSide instaed of Direction.byName
zyxkad Apr 25, 2024
fc35203
call livingEntityToLua but not entityToLua when serializing animal
zyxkad Apr 25, 2024
ab0d58a
Merge branch 'refs/heads/dev/1.19.2' into dev/0.8
SirEndii Apr 26, 2024
b735bde
Implement `cancelCraftingTasks` for the ME Bridge
SirEndii Apr 26, 2024
8116c68
add pitch & yaw argument to automata core
zyxkad Apr 26, 2024
6d7d52a
add player.doActionWithRot instead of writing ton of overload methods
zyxkad Apr 26, 2024
f2506b0
fix java generic
zyxkad Apr 26, 2024
3c487cf
fix missing imports
zyxkad Apr 26, 2024
d167353
remove unused import
zyxkad Apr 26, 2024
8be8351
accept NBTed items as turtle upgrade
zyxkad Apr 27, 2024
39b994f
add slot field to inventoryManager.getItemInHand
zyxkad Apr 25, 2024
62e5583
make inventoryManager.getItem return nil instead of empty table
zyxkad Apr 27, 2024
5062b4d
change slot index starts from 1
zyxkad Apr 27, 2024
7014e65
Merge pull request #595 from zyxkad/env-detector-patch
zyxkad Apr 27, 2024
b74a98c
Merge pull request #602 from IntelligenceModding/dev/1.19.2
zyxkad Apr 27, 2024
9d3e528
add UnsafeConfig for ignore NBT
zyxkad Apr 27, 2024
702ad13
fix null pointer
zyxkad Apr 27, 2024
b6600fa
fix automata core will place two blocks at a time
zyxkad Apr 28, 2024
1c2685d
remove unused imports
zyxkad Apr 28, 2024
761d1b7
Merge pull request #596 from zyxkad/inv-manager-patch
zyxkad Apr 30, 2024
5dc15af
Merge pull request #597 from zyxkad/419-patch
zyxkad Apr 30, 2024
23c8c98
Merge branch 'dev/1.19.2' of https://github.com/IntelligenceModding/A…
zyxkad Apr 30, 2024
6c10759
move place method from compass to automataBlockHandPlugin
zyxkad Apr 30, 2024
eaf8fc3
add comment for placeBlock method
zyxkad Apr 30, 2024
db8b938
add static keyword for internal class
zyxkad Apr 30, 2024
3006ed7
remove extra empty lines
zyxkad Apr 30, 2024
8a2210a
fix typo forward -> front
zyxkad Apr 30, 2024
e40cd53
make the directions makes more sense
zyxkad May 1, 2024
1de7972
fix playNote will not trigger alley
zyxkad May 1, 2024
bd047e5
fix playNote will not trigger alley fix #603
zyxkad May 1, 2024
529d8a6
Merge pull request #605 from zyxkad/603-patch
zyxkad May 1, 2024
70fcad1
Merge branch 'dev/0.8' into dev/1.19.2
zyxkad May 1, 2024
ed906c4
Revert "Merge branch 'dev/0.8' into dev/1.19.2"
SirEndii May 2, 2024
965ccef
Skip the calculation of storage busses without any connected storage …
SirEndii May 8, 2024
c1d14d5
Merge branch 'refs/heads/dev/1.19.2' into fork/zyxkad/dev/1.19.2
SirEndii May 10, 2024
6b299b5
Merge pull request #593
SirEndii May 10, 2024
5f40941
lost -> lose, behaviour -> behavior (American English)
SirEndii May 10, 2024
1309b60
Fixed `isOnEnchantedSoil()` for the mana flower integration
SirEndii May 13, 2024
4350ca5
Satisfy checkstyle
SirEndii May 21, 2024
ee01ac7
fix player can bypass the maximum chatbox range by setting a negative…
zyxkad Jun 2, 2024
8fda0f4
fix playerdetector bypass range issue
zyxkad Jun 2, 2024
a7f3eac
Merge pull request #624 from zyxkad/dev/1.19.2
zyxkad Jun 2, 2024
15788bb
forgot to remove a Math.min
zyxkad Jun 2, 2024
356a814
Merge pull request #625 from zyxkad/dev/1.19.2
zyxkad Jun 2, 2024
a921e37
Merge branch 'dev/1.19.2' into dev/1.20.1
zyxkad Jun 2, 2024
2f3b7b1
fix README link and missing semicolon
zyxkad Jun 2, 2024
b28b7b4
fix version changes
zyxkad Jun 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ body:
multiple: false
options:
- Own compiled build.
- 1.20.1-0.7.39r (Latest 1.20.1)
- 1.20.1-0.7.39r (Latest 1.20.1)
- 1.20.1-0.7.38r
- 1.20.1-0.7.37r
- 1.20.1-0.7.36r
- 1.19.2-0.7.35r (Latest 1.19.2)
- 1.20.1-0.7.36r

- 1.19.2-0.7.35r (Latest 1.19.2)
- 1.19.2-0.7.34r
- 1.19.2-0.7.33r
- 1.19.2-0.7.32r
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ will close pull requests related to translations.
<!----------------------------------------------------------------------------->

[Documentation]: https://advancedperipherals.madefor.cc/
[Contributors]: https://github.com/Seniorendi/AdvancedPeripherals/graphs/contributors
[Contributors]: https://github.com/IntelligenceModding/AdvancedPeripherals/graphs/contributors
[CurseForge]: https://www.curseforge.com/minecraft/mc-mods/advanced-peripherals
[Actions]: https://github.com/Seniorendi/AdvancedPeripherals/actions
[Actions]: https://github.com/IntelligenceModding/AdvancedPeripherals/actions
[Crowdin]: https://crowdin.com/project/advanced-peripherals
[Discord]: https://discord.intelligence-modding.de
[Banner]: https://www.bisecthosting.com/images/CF/Advanced_Peripherals/BH_AP_Header.png 'Advanced Peripherals'
Expand All @@ -77,7 +77,7 @@ will close pull requests related to translations.

[@FatalMerlin]: https://github.com/FatalMerlin
[@SirEdvin]: https://github.com/SirEdvin
[@Srendi]: https://github.com/Seniorendi
[@Srendi]: https://github.com/IntelligenceModding
[@Olfi01]: https://github.com/Olfi01

[License]: LICENSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ public static long getTotalItemStorage(IGridNode node) {
net.minecraft.world.level.Level level = bus.getLevel();
BlockPos connectedInventoryPos = bus.getHost().getBlockEntity().getBlockPos().relative(bus.getSide());
BlockEntity connectedInventoryEntity = level.getBlockEntity(connectedInventoryPos);
if (connectedInventoryEntity == null)
continue;

LazyOptional<IItemHandler> itemHandler = connectedInventoryEntity.getCapability(ForgeCapabilities.ITEM_HANDLER);
if (itemHandler.isPresent()) {
Expand Down Expand Up @@ -410,6 +412,8 @@ public static long getTotalFluidStorage(IGridNode node) {
net.minecraft.world.level.Level level = bus.getLevel();
BlockPos connectedInventoryPos = bus.getHost().getBlockEntity().getBlockPos().relative(bus.getSide());
BlockEntity connectedInventoryEntity = level.getBlockEntity(connectedInventoryPos);
if (connectedInventoryEntity == null)
continue;

LazyOptional<IFluidHandler> fluidHandler = connectedInventoryEntity.getCapability(ForgeCapabilities.FLUID_HANDLER);
if (fluidHandler.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dan200.computercraft.api.lua.LuaFunction;
import de.srendi.advancedperipherals.lib.peripherals.APGenericPeripheral;
import vazkii.botania.api.block_entity.GeneratingFlowerBlockEntity;
import vazkii.botania.common.block.BotaniaBlocks;

public class ManaFlowerIntegration implements APGenericPeripheral {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.NoteBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import org.jetbrains.annotations.NotNull;

public class NoteBlockIntegration extends BlockIntegrationPeripheral<NoteBlock> {
Expand Down Expand Up @@ -50,6 +51,7 @@ public final int getNote() {
public final void playNote() {
if (world.isEmptyBlock(pos.above())) {
world.blockEvent(pos, getBlock(), 0, 0);
world.gameEvent(null, GameEvent.NOTE_BLOCK_PLAY, pos);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public enum SingleOperation implements IPeripheralOperation<SingleOperationConte
SUCK(1000, 1),
USE_ON_ANIMAL(2500, 10),
CAPTURE_ANIMAL(50_000, 100),
WARP(1000, DistancePolicy.IGNORED, CountPolicy.MULTIPLY, 1, DistancePolicy.SQRT, CountPolicy.MULTIPLY);
WARP(1000, DistancePolicy.IGNORED, CountPolicy.MULTIPLY, 1, DistancePolicy.SQRT, CountPolicy.MULTIPLY),
ACCURE_PLACE(1000, DistancePolicy.IGNORED, CountPolicy.MULTIPLY, 1, DistancePolicy.LINEAR, CountPolicy.MULTIPLY);

private final int defaultCooldown;
private final DistancePolicy distanceCooldownPolicy;
Expand Down Expand Up @@ -74,6 +75,7 @@ public void addToConfig(ForgeConfigSpec.Builder builder) {

public enum DistancePolicy {
IGNORED(d -> 1),
LINEAR(d -> d),
SQRT(d -> (int) Math.sqrt(d));

private final Function<Integer, Integer> factorFunction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,10 @@ public Direction getFacing() {
return turtle.getDirection();
}

/**
* Not used for turtles
*/
@NotNull
@Override
public FrontAndTop getOrientation() {
return FrontAndTop.NORTH_UP;
return FrontAndTop.fromFrontAndTop(getFacing(), Direction.UP);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import de.srendi.advancedperipherals.common.configuration.APConfig;
import de.srendi.advancedperipherals.common.events.Events;
import de.srendi.advancedperipherals.common.util.CoordUtil;
import de.srendi.advancedperipherals.common.util.StringUtil;
import de.srendi.advancedperipherals.lib.peripherals.BasePeripheral;
import de.srendi.advancedperipherals.lib.peripherals.IPeripheralFunction;
import de.srendi.advancedperipherals.network.APNetworking;
Expand Down Expand Up @@ -110,8 +111,7 @@ public final MethodResult sendFormattedMessage(@NotNull IArguments arguments) th
return withChatOperation(ignored -> {
String message = arguments.getString(0);
int maxRange = APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get();
int range = arguments.optInt(4, maxRange);
range = maxRange == -1 ? range : Math.min(range, APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get());
int range = arguments.optInt(4, -1);
ResourceKey<Level> dimension = getLevel().dimension();
MutableComponent component = Component.Serializer.fromJson(message);
if (component == null)
Expand All @@ -121,14 +121,14 @@ public final MethodResult sendFormattedMessage(@NotNull IArguments arguments) th
return MethodResult.of(null, "incorrect bracket string (e.g. [], {}, <>, ...)");

MutableComponent preparedMessage = appendPrefix(
arguments.optString(1, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get()).replaceAll("&", "\u00a7"),
StringUtil.convertAndToSectionMark(arguments.optString(1, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get())),
arguments.optString(2, "[]"),
arguments.optString(3, "").replaceAll("&", "\u00a7")
StringUtil.convertAndToSectionMark(arguments.optString(3, ""))
).append(component);
for (ServerPlayer player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) {
if (!APConfig.PERIPHERALS_CONFIG.chatBoxMultiDimensional.get() && player.level().dimension() != dimension)
continue;
if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange))
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange))
player.sendSystemMessage(preparedMessage);
}
return MethodResult.of(true);
Expand All @@ -140,21 +140,20 @@ public final MethodResult sendMessage(@NotNull IArguments arguments) throws LuaE
return withChatOperation(ignored -> {
String message = arguments.getString(0);
int maxRange = APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get();
int range = arguments.optInt(4, maxRange);
range = maxRange == -1 ? range : Math.min(range, APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get());
int range = arguments.optInt(4, -1);
ResourceKey<Level> dimension = getLevel().dimension();
if (checkBrackets(arguments.optString(2)))
return MethodResult.of(null, "incorrect bracket string (e.g. [], {}, <>, ...)");

MutableComponent preparedMessage = appendPrefix(
arguments.optString(1, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get()).replaceAll("&", "\u00a7"),
StringUtil.convertAndToSectionMark(arguments.optString(1, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get())),
arguments.optString(2, "[]"),
arguments.optString(3, "").replaceAll("&", "\u00a7")
StringUtil.convertAndToSectionMark(arguments.optString(3, ""))
).append(message);
for (ServerPlayer player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) {
if (!APConfig.PERIPHERALS_CONFIG.chatBoxMultiDimensional.get() && player.level().dimension() != dimension)
continue;
if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange))
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange))
player.sendSystemMessage(preparedMessage);
}
return MethodResult.of(true);
Expand All @@ -167,8 +166,7 @@ public final MethodResult sendFormattedMessageToPlayer(@NotNull IArguments argum
String message = arguments.getString(0);
String playerName = arguments.getString(1);
int maxRange = APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get();
int range = arguments.optInt(5, maxRange);
range = maxRange == -1 ? range : Math.min(range, APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get());
int range = arguments.optInt(5, -1);
ResourceKey<Level> dimension = getLevel().dimension();
ServerPlayer player = getPlayer(playerName);
if (player == null)
Expand All @@ -182,14 +180,14 @@ public final MethodResult sendFormattedMessageToPlayer(@NotNull IArguments argum
return MethodResult.of(null, "incorrect bracket string (e.g. [], {}, <>, ...)");

MutableComponent preparedMessage = appendPrefix(
arguments.optString(2, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get()).replaceAll("&", "\u00a7"),
StringUtil.convertAndToSectionMark(arguments.optString(2, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get())),
arguments.optString(3, "[]"),
arguments.optString(4, "").replaceAll("&", "\u00a7")
StringUtil.convertAndToSectionMark(arguments.optString(4, ""))
).append(component);
if (!APConfig.PERIPHERALS_CONFIG.chatBoxMultiDimensional.get() && player.level().dimension() != dimension)
return MethodResult.of(false, "NOT_SAME_DIMENSION");

if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange))
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange))
player.sendSystemMessage(preparedMessage);
return MethodResult.of(true);
});
Expand All @@ -203,8 +201,7 @@ public final MethodResult sendFormattedToastToPlayer(@NotNull IArguments argumen
String title = arguments.getString(1);
String playerName = arguments.getString(2);
int maxRange = APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get();
int range = arguments.optInt(6, maxRange);
range = maxRange == -1 ? range : Math.min(range, APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get());
int range = arguments.optInt(6, -1);
ResourceKey<Level> dimension = getLevel().dimension();
ServerPlayer player = getPlayer(playerName);
if (player == null)
Expand All @@ -222,15 +219,15 @@ public final MethodResult sendFormattedToastToPlayer(@NotNull IArguments argumen
return MethodResult.of(null, "incorrect bracket string (e.g. [], {}, <>, ,,,)");

MutableComponent preparedMessage = appendPrefix(
arguments.optString(3, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get()).replaceAll("&", "\u00a7"),
StringUtil.convertAndToSectionMark(arguments.optString(3, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get())),
arguments.optString(4, "[]"),
arguments.optString(5, "").replaceAll("&", "\u00a7")
StringUtil.convertAndToSectionMark(arguments.optString(5, ""))
).append(messageComponent);

if (!APConfig.PERIPHERALS_CONFIG.chatBoxMultiDimensional.get() && player.level().dimension() != dimension)
return MethodResult.of(false, "NOT_SAME_DIMENSION");

if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange)) {
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange)) {
ToastToClientPacket packet = new ToastToClientPacket(titleComponent, preparedMessage);
APNetworking.sendTo(packet, player);
}
Expand All @@ -245,8 +242,7 @@ public final MethodResult sendMessageToPlayer(@NotNull IArguments arguments) thr
String message = arguments.getString(0);
String playerName = arguments.getString(1);
int maxRange = APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get();
int range = arguments.optInt(5, maxRange);
range = maxRange == -1 ? range : Math.min(range, APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get());
int range = arguments.optInt(5, -1);
ResourceKey<Level> dimension = getLevel().dimension();
ServerPlayer player = getPlayer(playerName);
if (player == null)
Expand All @@ -256,14 +252,14 @@ public final MethodResult sendMessageToPlayer(@NotNull IArguments arguments) thr
return MethodResult.of(null, "incorrect bracket string (e.g. [], {}, <>, ...)");

MutableComponent preparedMessage = appendPrefix(
arguments.optString(2, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get()).replaceAll("&", "\u00a7"),
StringUtil.convertAndToSectionMark(arguments.optString(2, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get())),
arguments.optString(3, "[]"),
arguments.optString(4, "").replaceAll("&", "\u00a7")
StringUtil.convertAndToSectionMark(arguments.optString(4, ""))
).append(message);
if (!APConfig.PERIPHERALS_CONFIG.chatBoxMultiDimensional.get() && player.level().dimension() != dimension)
return MethodResult.of(false, "NOT_SAME_DIMENSION");

if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange))
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange))
player.sendSystemMessage(preparedMessage, false);
return MethodResult.of(true);
});
Expand All @@ -276,8 +272,7 @@ public final MethodResult sendToastToPlayer(@NotNull IArguments arguments) throw
String title = arguments.getString(1);
String playerName = arguments.getString(2);
int maxRange = APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get();
int range = arguments.optInt(6, maxRange);
range = maxRange == -1 ? range : Math.min(range, APConfig.PERIPHERALS_CONFIG.chatBoxMaxRange.get());
int range = arguments.optInt(6, -1);
ResourceKey<Level> dimension = getLevel().dimension();
ServerPlayer player = getPlayer(playerName);
if (player == null)
Expand All @@ -287,15 +282,15 @@ public final MethodResult sendToastToPlayer(@NotNull IArguments arguments) throw
return MethodResult.of(null, "incorrect bracket string (e.g. [], {}, <>, ...)");

MutableComponent preparedMessage = appendPrefix(
arguments.optString(3, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get()).replaceAll("&", "\u00a7"),
StringUtil.convertAndToSectionMark(arguments.optString(3, APConfig.PERIPHERALS_CONFIG.defaultChatBoxPrefix.get())),
arguments.optString(4, "[]"),
arguments.optString(5, "").replaceAll("&", "\u00a7")
StringUtil.convertAndToSectionMark(arguments.optString(5, ""))
).append(message);

if (!APConfig.PERIPHERALS_CONFIG.chatBoxMultiDimensional.get() && player.level().dimension() != dimension)
return MethodResult.of(false, "NOT_SAME_DIMENSION");

if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange)) {
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, maxRange)) {
ToastToClientPacket packet = new ToastToClientPacket(Component.literal(title), preparedMessage);
APNetworking.sendTo(packet, player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ public class CompassPeripheral extends BasePeripheral<TurtlePeripheralOwner> {

public static final String PERIPHERAL_TYPE = "compass";

protected CompassPeripheral(TurtlePeripheralOwner owner) {
super(PERIPHERAL_TYPE, owner);
}

public CompassPeripheral(ITurtleAccess turtle, TurtleSide side) {
super(PERIPHERAL_TYPE, new TurtlePeripheralOwner(turtle, side));
this(new TurtlePeripheralOwner(turtle, side));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public final List<String> getPlayersInRange(int range) {
for (ServerPlayer player : getPlayers()) {
if (!isAllowedMultiDimensional() && player.level().dimension() != dimension)
continue;
if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, MAX_RANGE))
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, MAX_RANGE))
playersName.add(player.getName().getString());
}
return playersName;
Expand Down Expand Up @@ -142,7 +142,7 @@ public final boolean isPlayersInRange(int range) {
for (ServerPlayer player : getPlayers()) {
if (!isAllowedMultiDimensional() && player.level().dimension() != dimension)
continue;
if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, MAX_RANGE)) return true;
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, MAX_RANGE)) return true;
}
return false;
}
Expand Down Expand Up @@ -185,7 +185,7 @@ public final boolean isPlayerInRange(int range, String username) {
for (Player player : getPlayers()) {
if (!isAllowedMultiDimensional() && player.level().dimension() != dimension)
continue;
if (range == -1 || CoordUtil.isInRange(getPos(), getLevel(), player, range, MAX_RANGE)) {
if (CoordUtil.isInRange(getPos(), getLevel(), player, range, MAX_RANGE)) {
if(player.getName().getString().equals(username))
return true;
}
Expand Down
Loading
Loading