Skip to content

Commit dd0edc0

Browse files
committed
Finished port with some features temporarily removed
1 parent d83dae5 commit dd0edc0

File tree

89 files changed

+445
-1154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+445
-1154
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ build
1919

2020
# other
2121
eclipse
22-
run
22+
runs
2323
server
2424

2525
# Files from Forge MDK

build.gradle

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
id 'org.jetbrains.changelog' version '1.2.1'
99
id "com.modrinth.minotaur" version "2.+"
1010
//id "org.jetbrains.kotlin.jvm" version "1.6.10"
11-
id 'net.neoforged.gradle.userdev' version '7.0.105'
11+
id 'net.neoforged.gradle.userdev' version '7.0.145'
1212
id "com.github.breadmoirai.github-release" version "2.5.2"
1313
id 'checkstyle'
1414
id 'java'
@@ -22,7 +22,7 @@ java {
2222
}
2323

2424
wrapper {
25-
gradleVersion = '8.7'
25+
gradleVersion = '8.11'
2626
distributionType = Wrapper.DistributionType.BIN
2727
}
2828

@@ -55,17 +55,9 @@ def repositoryKey = secretEnv["PUBLIC_REP_KEY"] ?: System.getenv("PUBLIC_REP_KEY
5555
def githubKey = secretEnv["GITHUB_KEY"] ?: System.getenv("GITHUB_KEY")
5656

5757
// Include resources generated by data generators.
58-
sourceSets {
59-
main.resources {
60-
srcDir 'src/generated/resources'
61-
}
62-
}
63-
58+
sourceSets.main.resources { srcDir 'src/generated/resources' }
6459
minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
6560

66-
67-
// Default run configurations.
68-
// These can be tweaked, removed, or duplicated as needed.
6961
runs {
7062
// applies to all the run configs below
7163
configureEach {
@@ -109,7 +101,6 @@ runs {
109101
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
110102
}
111103
}
112-
113104
repositories {
114105
mavenCentral()
115106
maven {
@@ -203,6 +194,8 @@ configurations {
203194
implementationExtra
204195
testModImplementation.extendsFrom(implementation)
205196
testModImplementation.extendsFrom(testImplementation)
197+
runtimeClasspath.extendsFrom localRuntime
198+
206199
}
207200

208201
dependencies {
@@ -229,8 +222,8 @@ dependencies {
229222
implementation "curse.maven:applied-mekanistics-574300:${appliedmekanistics_version}"
230223

231224
// Curios
232-
runtimeOnly "top.theillusivec4.curios:curios-forge:${curios_version}"
233-
compileOnly "top.theillusivec4.curios:curios-forge:${curios_version}:api"
225+
runtimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}"
226+
compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api"
234227

235228
// Refined Storage
236229
implementation "curse.maven:refined-storage-243076:${refinedstorage_version}"
@@ -338,7 +331,7 @@ tasks.withType(Checkstyle) {
338331
outputs.upToDateWhen { false }
339332
}
340333

341-
tasks.named('processResources', ProcessResources).configure {
334+
tasks.withType(ProcessResources).configureEach {
342335
var replaceProperties = [minecraft_version : minecraft_version,
343336
neo_version : neo_version,
344337
loader_version : loader_version,
@@ -357,8 +350,8 @@ tasks.named('processResources', ProcessResources).configure {
357350

358351
inputs.properties replaceProperties
359352

360-
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
361-
expand replaceProperties + [project: project]
353+
filesMatching(['META-INF/mods.toml']) {
354+
expand replaceProperties
362355
}
363356
}
364357

@@ -405,12 +398,12 @@ githubRelease {
405398
tagName = "${minecraft_version}-${version}"
406399
releaseName = "${minecraft_version}-${version}"
407400
targetCommitish = "release/${minecraft_version}"
408-
generateReleaseNotes = false
401+
generateReleaseNotes = true
409402
try {
410-
body = "${project.changelog.get("${minecraft_version}-${version}").withHeader(false).toText()}"
403+
//body = "${project.changelog.get("${minecraft_version}-${version}").withHeader(false).toText()}"
411404
} catch (err) {
412405
System.out.println(err)
413-
body = ""
406+
//body = ""
414407
}
415408
draft = false
416409
prerelease = !release_type.equalsIgnoreCase("release")
@@ -498,3 +491,11 @@ publishing {
498491
}
499492
}
500493
}
494+
495+
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
496+
idea {
497+
module {
498+
downloadSources = true
499+
downloadJavadoc = true
500+
}
501+
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ mod_id=advancedperipherals
77
minecraft_version=1.20.4
88
neo_version=20.4.231
99
loader_version=20
10-
mod_version=0.7.41r
11-
release_type=release
10+
mod_version=0.7.41a
11+
release_type=alpha
1212
neogradle.subsystems.parchment.minecraftVersion=1.20.4
1313
neogradle.subsystems.parchment.mappingsVersion=2024.04.14
1414
jb_annotations=21.0.1

src/main/java/de/srendi/advancedperipherals/AdvancedPeripherals.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ public AdvancedPeripherals(IEventBus modBus) {
3333
APConfig.register(ModLoadingContext.get());
3434

3535
modBus.addListener(this::commonSetup);
36+
modBus.addListener(this::registerCapabilities);
37+
3638
Registration.register(modBus);
3739
}
3840

3941
public static void debug(String message) {
4042
if (APConfig.GENERAL_CONFIG.enableDebugMode.get())
41-
LOGGER.debug("[DEBUG] {}", message);
43+
LOGGER.info("[DEBUG] {}", message);
4244
}
4345

4446
public static void debug(String message, Level level) {

src/main/java/de/srendi/advancedperipherals/client/ClientRegistry.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package de.srendi.advancedperipherals.client;
22

3+
import dan200.computercraft.api.ComputerCraftAPI;
4+
import dan200.computercraft.api.client.turtle.RegisterTurtleModellersEvent;
35
import dan200.computercraft.api.client.turtle.TurtleUpgradeModeller;
46
import de.srendi.advancedperipherals.AdvancedPeripherals;
57
import de.srendi.advancedperipherals.common.container.InventoryManagerScreen;
@@ -30,19 +32,22 @@ public static void registerModels(ModelEvent.RegisterAdditional event) {
3032
@SubscribeEvent
3133
public static void onClientSetup(FMLClientSetupEvent event) {
3234
MenuScreens.register(ContainerTypes.INVENTORY_MANAGER_CONTAINER.get(), InventoryManagerScreen::new);
33-
34-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.CHUNKY_TURTLE.get(), TurtleUpgradeModeller.flatItem());
35-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.COMPASS_TURTLE.get(), TurtleUpgradeModeller.flatItem());
36-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.CHAT_BOX_TURTLE.get(), TurtleUpgradeModeller.sided(new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_chat_box_upgrade_left"), "inventory"), new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_chat_box_upgrade_right"), "inventory")));
37-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.ENVIRONMENT_TURTLE.get(), TurtleUpgradeModeller.sided(new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_environment_upgrade_left"), "inventory"), new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_environment_upgrade_right"), "inventory")));
38-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.GEO_SCANNER_TURTLE.get(), TurtleUpgradeModeller.sided(new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_geoscanner_upgrade_left"), "inventory"), new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_geoscanner_upgrade_right"), "inventory")));
39-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.PLAYER_DETECTOR_TURTLE.get(), TurtleUpgradeModeller.sided(new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_player_upgrade_left"), "inventory"), new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_player_upgrade_right"), "inventory")));
40-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.OP_END_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
41-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.OP_HUSBANDRY_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
42-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.OP_WEAK_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
43-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.HUSBANDRY_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
44-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.END_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
45-
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.WEAK_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
35+
}
36+
37+
@SubscribeEvent
38+
public static void onUpgradeModeller(RegisterTurtleModellersEvent event) {
39+
event.register(CCRegistration.CHUNKY_TURTLE.get(), TurtleUpgradeModeller.flatItem());
40+
event.register(CCRegistration.COMPASS_TURTLE.get(), TurtleUpgradeModeller.flatItem());
41+
event.register(CCRegistration.CHAT_BOX_TURTLE.get(), TurtleUpgradeModeller.sided(new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_chat_box_upgrade_left"), "inventory"), new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_chat_box_upgrade_right"), "inventory")));
42+
event.register(CCRegistration.ENVIRONMENT_TURTLE.get(), TurtleUpgradeModeller.sided(new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_environment_upgrade_left"), "inventory"), new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_environment_upgrade_right"), "inventory")));
43+
event.register(CCRegistration.GEO_SCANNER_TURTLE.get(), TurtleUpgradeModeller.sided(new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_geoscanner_upgrade_left"), "inventory"), new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_geoscanner_upgrade_right"), "inventory")));
44+
event.register(CCRegistration.PLAYER_DETECTOR_TURTLE.get(), TurtleUpgradeModeller.sided(new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_player_upgrade_left"), "inventory"), new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_player_upgrade_right"), "inventory")));
45+
event.register(CCRegistration.OP_END_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
46+
event.register(CCRegistration.OP_HUSBANDRY_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
47+
event.register(CCRegistration.OP_WEAK_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
48+
event.register(CCRegistration.HUSBANDRY_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
49+
event.register(CCRegistration.END_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
50+
event.register(CCRegistration.WEAK_TURTLE.get(), new MetaTurtleUpgradeModeller<>());
4651
}
4752

4853
@SubscribeEvent

src/main/java/de/srendi/advancedperipherals/client/MetaTurtleUpgradeModeller.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
import dan200.computercraft.api.turtle.TurtleSide;
1010
import de.srendi.advancedperipherals.common.util.DataStorageUtil;
1111
import de.srendi.advancedperipherals.lib.turtle.ClockwiseAnimatedTurtleUpgrade;
12+
import net.minecraft.nbt.CompoundTag;
1213
import org.jetbrains.annotations.NotNull;
1314
import org.jetbrains.annotations.Nullable;
1415

1516
public class MetaTurtleUpgradeModeller<T extends ClockwiseAnimatedTurtleUpgrade<?>> implements TurtleUpgradeModeller<T> {
1617

1718
@NotNull
1819
@Override
19-
public TransformedModel getModel(T upgrade, @Nullable ITurtleAccess turtle, @NotNull TurtleSide side) {
20+
public TransformedModel getModel(T upgrade, @Nullable ITurtleAccess turtle, @NotNull TurtleSide side, CompoundTag compoundTag) {
2021
if (upgrade.getLeftModel() == null) {
2122
PoseStack stack = new PoseStack();
2223
stack.pushPose();

src/main/java/de/srendi/advancedperipherals/common/addons/APAddons.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ public class APAddons {
1212

1313
public static final String CURIOS_MODID = "curios";
1414
public static final String REFINEDSTORAGE_MODID = "refinedstorage";
15-
public static final String AE_THINGS_MODID = "ae2things";
16-
public static final String AE_ADDITIONS_MODID = "ae2additions";
1715
public static final String APP_MEKANISTICS_MODID = "appmek";
16+
public static final String PATCHOULI_MODID = "patchouli";
1817

1918
public static boolean curiosLoaded;
2019
public static boolean refinedStorageLoaded;
21-
public static boolean aeThingsLoaded;
22-
public static boolean aeAdditionsLoaded;
2320
public static boolean appMekLoaded;
21+
public static boolean patchouliLoaded ;
2422

2523
private APAddons() {
2624
}
@@ -29,9 +27,8 @@ public static void commonSetup() {
2927
ModList modList = ModList.get();
3028
curiosLoaded = modList.isLoaded(CURIOS_MODID);
3129
refinedStorageLoaded = modList.isLoaded(REFINEDSTORAGE_MODID);
32-
aeThingsLoaded = modList.isLoaded(AE_THINGS_MODID);
33-
aeAdditionsLoaded = modList.isLoaded(AE_ADDITIONS_MODID);
3430
appMekLoaded = modList.isLoaded(APP_MEKANISTICS_MODID);
31+
patchouliLoaded = modList.isLoaded(PATCHOULI_MODID);
3532

3633
if (refinedStorageLoaded)
3734
RefinedStorage.instance = new RefinedStorage();

src/main/java/de/srendi/advancedperipherals/common/addons/computercraft/integrations/IntegrationPeripheralProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.util.function.Function;
2020
import java.util.function.Predicate;
2121

22-
public class IntegrationPeripheralProvider implements IPeripheralProvider {
22+
public class IntegrationPeripheralProvider {
2323

2424
private static final String[] SUPPORTED_MODS = new String[]{"powah", "create", "mekanism", "botania"};
2525

@@ -89,13 +89,13 @@ public static void load() {
8989
}
9090
}
9191

92-
@NotNull
92+
/*@NotNull
9393
@Override
9494
public LazyOptional<IPeripheral> getPeripheral(@NotNull Level level, @NotNull BlockPos blockPos, @NotNull Direction direction) {
9595
for (IPeripheralIntegration integration : integrations) {
9696
if (integration.isSuitable(level, blockPos, direction))
9797
return LazyOptional.of(() -> integration.buildPeripheral(level, blockPos, direction));
9898
}
9999
return LazyOptional.empty();
100-
}
100+
}*/
101101
}

src/main/java/de/srendi/advancedperipherals/common/addons/computercraft/integrations/NoteBlockIntegration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.minecraft.world.level.block.NoteBlock;
99
import net.minecraft.world.level.block.state.BlockState;
1010
import net.minecraft.world.level.gameevent.GameEvent;
11+
import net.neoforged.neoforge.common.CommonHooks;
1112
import org.jetbrains.annotations.NotNull;
1213

1314
public class NoteBlockIntegration extends BlockIntegrationPeripheral<NoteBlock> {
@@ -25,7 +26,7 @@ public String getType() {
2526
@LuaFunction(mainThread = true)
2627
public final int changeNote() {
2728
BlockState state = world.getBlockState(pos);
28-
int newNote = net.neoforged.common.ForgeHooks.onNoteChange(world, pos, state, state.getValue(NoteBlock.NOTE), state.cycle(NoteBlock.NOTE).getValue(NoteBlock.NOTE));
29+
int newNote = CommonHooks.onNoteChange(world, pos, state, state.getValue(NoteBlock.NOTE), state.cycle(NoteBlock.NOTE).getValue(NoteBlock.NOTE));
2930
if (newNote == -1) return -1;
3031
state = state.setValue(NoteBlock.NOTE, newNote);
3132
world.setBlock(pos, state, 3);

src/main/java/de/srendi/advancedperipherals/common/addons/computercraft/operations/AutomataCoreTier.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package de.srendi.advancedperipherals.common.addons.computercraft.operations;
22

33
import de.srendi.advancedperipherals.lib.metaphysics.IAutomataCoreTier;
4+
import net.neoforged.neoforge.common.ModConfigSpec;
45

56
public enum AutomataCoreTier implements IAutomataCoreTier {
67
TIER1(2, 2),
@@ -10,8 +11,8 @@ public enum AutomataCoreTier implements IAutomataCoreTier {
1011

1112
private final int defaultInteractionRadius;
1213
private final int defaultMaxFuelConsumptionRate;
13-
private ForgeConfigSpec.IntValue interactionRadius;
14-
private ForgeConfigSpec.IntValue maxFuelConsumptionRate;
14+
private ModConfigSpec.IntValue interactionRadius;
15+
private ModConfigSpec.IntValue maxFuelConsumptionRate;
1516

1617
AutomataCoreTier(int defaultInteractionRadius, int defaultMaxFuelConsumptionRate) {
1718
this.defaultInteractionRadius = defaultInteractionRadius;
@@ -31,7 +32,7 @@ public int getMaxFuelConsumptionRate() {
3132
}
3233

3334
@Override
34-
public void addToConfig(ForgeConfigSpec.Builder builder) {
35+
public void addToConfig(ModConfigSpec.Builder builder) {
3536
interactionRadius = builder.defineInRange(settingsName() + "InteractionRadius", defaultInteractionRadius, 1, 64);
3637
maxFuelConsumptionRate = builder.defineInRange(settingsName() + "MaxFuelConsumptionRate", defaultMaxFuelConsumptionRate, 1, 32);
3738
}

0 commit comments

Comments
 (0)