Jump to content

OfCourseAGoodName

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by OfCourseAGoodName

  1. My goal is to connect DL4J library to a Minecraft mod, but there is a problem. I can't figure out to import the library correctly. I tried to modify the build.gradle file like this:

    dependencies {
    	minecraft 'net.minecraftforge:forge:1.17.1-37.0.21'
    
    	implementation fg.deobf("org.deeplearning4j:deeplearning4j-core:1.0.0-M1.1")
    	implementation fg.deobf("org.nd4j:nd4j-native-platform:1.0.0-M1.1")
    	implementation fg.deobf("org.slf4j:slf4j-api:2.0.0-alpha2")
    	implementation fg.deobf("org.slf4j:slf4j-simple:2.0.0-alpha2")
    }

    (where the dependency-block is positioned right before the jar-block at the end of the gradle file)

    to import DL4J from the Maven repo but even though the script builds successfully, the libraries cannot be used in the Java code. I figured out that compileOnly and runtimeOnly solve the syntax errors in the Code but don't get imported by ForgeGradle (?) so that an NoClassDefFoundError is thrown when a method from the library is called (When JVM loads a class from the library).

    What am I missing?

  2. Hello!

    I am trying to render a custom model instead of the normal player model, but I don't know how to do it.

    For testing I set 

    event.getRenderer().getEntityModel().setVisible(false)

    in RenderPlayerEvent.Pre event which worked fine, but I can't figure out how to set a custom model, especially because there is no setModel() method or equal.

     

    I hope somebody can help me

  3. Ok I solved this. The problem was that the player moved to fast. The following code is from ServerPlayNetHandler that blocked my teleport:

    if (!this.player.isInvulnerableDimensionChange() && d11 > 0.0625D && !this.player.isSleeping() && !this.player.interactionManager.isCreative() && this.player.interactionManager.getGameType() != GameType.SPECTATOR) {
    	flag = true;
        LOGGER.warn("{} moved wrongly!", (Object)this.player.getName().getString());
    }

    d11 is proportional to the distance walked since the last tick so I modified d11 indirectly by setting players posX, posY and posZ variables and sending a CPlayerPacket with the new position to ServerPlayNetHandler#processPlayer function to validate the new position from server's side.

    I know it's not the best solution, but it works fine.

    Thank you nevertheless for your help @DavidM!

  4. Hello,

    my idea was to create just a simple teleporter mod that is able to teleport a player to another position in Minecraft 1.15.2. I created the teleporter successfully but it just can't teleport

    because when the teleporting code was executed there is a warning in the log that sais: "[minecraft/ServerPlayNetHandler]: Player moved wrongly!" and does'nt teleport. First I used the following code:

    entity.setPosition(connectedTeleporterPos.getX(), connectedTeleporterPos.getY(), connectedTeleporterPos.getZ());

    where "entity" is the instance of Entity that I'd like to teleport and "connectedTeleporterPos" is the target teleport position.

    Because the problem only occures in multiplayer I thought I could fix the issue by using the following code:

    ((ServerPlayerEntity)entity).connection.setPlayerLocation(connectedTeleporterPos.getX(), connectedTeleporterPos.getY(), connectedTeleporterPos.getZ(), 0, 0);

    but it fixed nothing.

     

    Does anybody have an idea how to solve this problem?

    Thank you in advance.

×
×
  • Create New...

Important Information

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