Jump to content

[Solved][1.18] Crash when attempting to use getDistance() to get distance between player and entity


Recommended Posts

Posted (edited)

Currently getting a TickingEntity crash from usage of getDistance() in this method, occurs frequently when my projectile entity hits another entity:

    @Override
    protected void onHitEntity(EntityHitResult hitResult) {
        LivingEntity target = (LivingEntity) hitResult.getEntity();
        Entity shooter = getOwner();

        System.out.println("HIT");
        System.out.println("DISTANCE: " + Objects.requireNonNull(getOwner()).distanceTo(target));

        double armor = target.getArmorValue() * (1 - piercing);
        double toughness = Objects.requireNonNull(target.getAttribute(Attributes.ARMOR_TOUGHNESS)).getValue();
        float finalDamage = (float) (damage * (1 - (Math.min(20, Math.max((armor / 5), armor - ((4 * damage) / (toughness + 8))))) / 25));
        target.hurt(causeBulletDamage(this, shooter).bypassArmor(), finalDamage);

        if (bulletType == BulletType.COPPER) {
            target.invulnerableTime = 0;
        }
    }

Full code here:
https://github.com/CrackedScreen/Mod_1.18

Error log:
 

Spoiler

---- Minecraft Crash Report ----
// Don't be sad, have a hug! ❤️

Time: 12/17/21, 5:54 PM
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
    at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?] {}
    at com.example.examplemod.entity.BulletEntity.onHitEntity(BulletEntity.java:78) ~[%2381!:?] {re:classloading}
    at net.minecraft.world.entity.projectile.Projectile.onHit(Projectile.java:135) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.world.entity.projectile.ThrowableProjectile.tick(ThrowableProjectile.java:62) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading}
    at com.example.examplemod.entity.BulletEntity.tick(BulletEntity.java:51) ~[%2381!:?] {re:classloading}
    at net.minecraft.client.multiplayer.ClientLevel.tickNonPassenger(ClientLevel.java:222) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.world.level.Level.guardEntityTick(Level.java:487) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.multiplayer.ClientLevel.lambda$tickEntities$4(ClientLevel.java:204) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:54) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading}
    at net.minecraft.client.multiplayer.ClientLevel.tickEntities(ClientLevel.java:202) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.tick(Minecraft.java:1674) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1015) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.18-38.0.16.jar%230!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
    at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?] {}
    at com.example.examplemod.entity.BulletEntity.onHitEntity(BulletEntity.java:78) ~[%2381!:?] {re:classloading}
    at net.minecraft.world.entity.projectile.Projectile.onHit(Projectile.java:135) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.world.entity.projectile.ThrowableProjectile.tick(ThrowableProjectile.java:62) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading}
    at com.example.examplemod.entity.BulletEntity.tick(BulletEntity.java:51) ~[%2381!:?] {re:classloading}
    at net.minecraft.client.multiplayer.ClientLevel.tickNonPassenger(ClientLevel.java:222) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.world.level.Level.guardEntityTick(Level.java:487) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.multiplayer.ClientLevel.lambda$tickEntities$4(ClientLevel.java:204) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:54) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading}
    at net.minecraft.client.multiplayer.ClientLevel.tickEntities(ClientLevel.java:202) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
-- Entity being ticked --
Details:
    Entity Type: examplemod:bullet (com.example.examplemod.entity.BulletEntity)
    Entity ID: 399
    Entity Name: entity.examplemod.bullet
    Entity's Exact location: 23.47, 65.68, 242.20
    Entity's Block location: World: (23,65,242), Section: (at 7,1,2 in 1,4,15; chunk contains blocks 16,-64,240 to 31,319,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511)
    Entity's Momentum: 1.18, -2.34, -2.09
    Entity's Passengers: []
    Entity's Vehicle: null
Stacktrace:
    at net.minecraft.world.level.Level.guardEntityTick(Level.java:487) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.client.multiplayer.ClientLevel.lambda$tickEntities$4(ClientLevel.java:204) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:54) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading}
    at net.minecraft.client.multiplayer.ClientLevel.tickEntities(ClientLevel.java:202) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.tick(Minecraft.java:1674) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1015) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.18-38.0.16.jar%230!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


-- Affected level --
Details:
    All players: 1 total; [LocalPlayer['Dev'/97, l='ClientLevel', x=14.92, y=81.12, z=257.36]]
    Chunk stats: 961, 557
    Level dimension: minecraft:overworld
    Level spawn location: World: (-80,63,48), Section: (at 0,15,0 in -5,3,3; chunk contains blocks -80,-64,48 to -65,319,63), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,-64,0 to -1,319,511)
    Level time: 301500 game time, 280978 day time
    Server brand: forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.ClientLevel.fillReportDetails(ClientLevel.java:407) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2249) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:677) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18-38.0.16_mapped_official_1.18-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.18-38.0.16.jar%230!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%2310!:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


-- Last reload --
Details:
    Reload number: 1
    Reload reason: initial
    Finished: Yes
    Packs: Default, Mod Resources

-- System Details --
Details:
    Minecraft Version: 1.18
    Minecraft Version ID: 1.18
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 17.0.1, Eclipse Adoptium
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium
    Memory: 2797753744 bytes (2668 MiB) / 4664066048 bytes (4448 MiB) up to 8573157376 bytes (8176 MiB)
    CPUs: 24
    Processor Vendor: AuthenticAMD
    Processor Name: AMD Ryzen 9 5900X 12-Core Processor            
    Identifier: AuthenticAMD Family 25 Model 33 Stepping 0
    Microarchitecture: Zen 3
    Frequency (GHz): 3.69
    Number of physical packages: 1
    Number of physical CPUs: 12
    Number of logical CPUs: 24
    Graphics card #0 name: NVIDIA GeForce GTX 1060 3GB
    Graphics card #0 vendor: NVIDIA (0x10de)
    Graphics card #0 VRAM (MB): 3072.00
    Graphics card #0 deviceId: 0x1c02
    Graphics card #0 versionInfo: DriverVersion=30.0.14.9709
    Memory slot #0 capacity (MB): 16384.00
    Memory slot #0 clockSpeed (GHz): 3.60
    Memory slot #0 type: DDR4
    Memory slot #1 capacity (MB): 16384.00
    Memory slot #1 clockSpeed (GHz): 3.60
    Memory slot #1 type: DDR4
    Virtual memory max (MB): 37557.55
    Virtual memory used (MB): 18334.25
    Swap memory total (MB): 4864.00
    Swap memory used (MB): 3.49
    JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
    Launched Version: MOD_DEV
    Backend library: LWJGL version 3.2.2 SNAPSHOT
    Backend API: NVIDIA GeForce GTX 1060 3GB/PCIe/SSE2 GL version 3.2.0 NVIDIA 497.09, NVIDIA Corporation
    Window size: 854x480
    GL Caps: Using framebuffer using OpenGL 3.2
    GL debug messages:
    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'forge'; Server brand changed to 'forge'
    Type: Integrated Server (map_client.txt)
    Graphics mode: fancy
    Resource Packs: vanilla, mod_resources
    Current Language: English (US)
    CPU: 24x AMD Ryzen 9 5900X 12-Core Processor
    Server Running: true
    Player Count: 1 / 8; [ServerPlayer['Dev'/97, l='ServerLevel[Test]', x=14.92, y=81.12, z=257.37]]
    Data Packs: vanilla, mod:forge, mod:examplemod
    ModLauncher: 9.0.7+91+master.8569cdf
    ModLauncher launch target: forgeclientuserdev
    ModLauncher naming: mcp
    ModLauncher services:
         mixin PLUGINSERVICE
         eventbus PLUGINSERVICE
         object_holder_definalize PLUGINSERVICE
         runtime_enum_extender PLUGINSERVICE
         capability_token_subclass PLUGINSERVICE
         accesstransformer PLUGINSERVICE
         runtimedistcleaner PLUGINSERVICE
         mixin TRANSFORMATIONSERVICE
         fml TRANSFORMATIONSERVICE
    FML Language Providers:
        [email protected]
        javafml@null
    Mod List:
        forge-1.18-38.0.16_mapped_official_1.18-recomp.jar|Minecraft                     |minecraft                     |1.18                |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
                                                          |Forge                         |forge                         |38.0.16             |DONE      |Manifest: NOSIGNATURE
        main                                              |Example Mod                   |examplemod                    |0.0NONE             |DONE      |Manifest: NOSIGNATURE
    Crash Report UUID: df2125d7-9324-44b0-a159-460830c86d04
    FML: 38.0
    Forge: net.minecraftforge:38.0.16

Edited by CrackedScreen
Marked as solved
  • CrackedScreen changed the title to [1.18] Crash when attempting to use getDistance() to get distance between player and entity
Posted (edited)

...and Objects.requireNonNull does not return a non-null value when passed null.
It is an assertion; if it fails, throws a null pointer exception.

This is its implementation:

public static <T> T requireNonNull(T obj) {
    if (obj == null)
        throw new NullPointerException();
    return obj;
}

 

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • CrackedScreen changed the title to [Solved][1.18] Crash when attempting to use getDistance() to get distance between player and entity

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • that happens every time I enter a new dimension.
    • This is the last line before the crash: [ebwizardry]: Synchronising spell emitters for PixelTraveler But I have no idea what this means
    • What in particular? I barely used that mod this time around, and it's never been a problem in the past.
    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } my entire project:https://github.com/kevin051606/DERP-Mod/tree/Derp-1.0-1.20
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.