Jump to content

Recommended Posts

Posted (edited)

Does anyone know what the 1.12.2 replacement for the 1.7 method world.getWorldVec3Pool().getVecFromPool(double, double, double) is or what it was used for? I assume memory optimisations for vectors

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
42 minutes ago, Cadiboo said:

is or what it was used for? I assume memory optimisations for vectors

Maybe not sure.

42 minutes ago, Cadiboo said:

Does anyone know what the 1.12.2 replacement for the 1.7 method world.getWorldVec3Pool().getVecFromPool(double, double, double)

Well in 1.7.10 it was Vec3.createVectorHelper however this doesn't appear to exist in 1.12.2. Maybe it isn't used anymore. What are you using it for?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
3 hours ago, Animefan8888 said:

Well in 1.7.10 it was Vec3.createVectorHelper however this doesn't appear to exist in 1.12.2. Maybe it isn't used anymore. What are you using it for?

I'm porting someones mod to 1.12.2, I can show you a snippet the original code, but thats it (the mod was never open source, and this is the only snippet that the author shared).

Spoiler

 public boolean renderSoftBlock(Block block, int x, int y, int z, RenderBlocks renderer, IBlockAccess world) {
     // Used for the drawing of the block's sides.
     Tessellator tessellator = Tessellator.instance;

     // The block's metadata.
     int meta = world.getBlockMetadata(x, y, z);

     // The basic block color.
     int color = block.colorMultiplier(world, x, y, z);
     float colorRed = (float) (color >> 16 & 255) / 255.0F;
     float colorGreen = (float) (color >> 8 & 255) / 255.0F;
     float colorBlue = (float) (color & 255) / 255.0F;

     // The shadow values.
     float shadowBottom = 0.6F;
     float shadowTop = 1.0F;
     float shadowLeft = 0.9F;
     float shadowRight = 0.8F;

     // The block's icon
     IIcon icon;
     if (!renderer.hasOverrideBlockTexture())
        icon = renderer.getBlockIconFromSideAndMetadata(block, 1, meta);
     else
        // Used for the crack texture
        icon = renderer.overrideBlockTexture;

     // The icon's UVs
     double minU = (double) icon.getMinU();
     double minV = (double) icon.getMinV();
     double maxU = (double) icon.getMaxU();
     double maxV = (double) icon.getMaxV();

     // The 8 points that make the block.
     Vec3[] points = new Vec3[8];
     points[0] = world.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D);
     points[1] = world.getWorldVec3Pool().getVecFromPool(1.0D, 0.0D, 0.0D);
     points[2] = world.getWorldVec3Pool().getVecFromPool(1.0D, 0.0D, 1.0D);
     points[3] = world.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 1.0D);
     points[4] = world.getWorldVec3Pool().getVecFromPool(0.0D, 1.0D, 0.0D);
     points[5] = world.getWorldVec3Pool().getVecFromPool(1.0D, 1.0D, 0.0D);
     points[6] = world.getWorldVec3Pool().getVecFromPool(1.0D, 1.0D, 1.0D);
     points[7] = world.getWorldVec3Pool().getVecFromPool(0.0D, 1.0D, 1.0D);

     // Loop through all the points:
     // Here everything will be 'smoothed'.
     for (int point = 0; point < 8; point++) {
         // Give the point the block's coordinates.
         points[point].xCoord += (double) x;
         points[point].yCoord += (double) y;
         points[point].zCoord += (double) z;

         // Check if the point is NOT intersecting with a manufactured block.
         if (!doesPointIntersectWithManufactured(world, points[point])) {
             // Check if the block's bottom side intersects with air.
             if (point < 4 && doesPointBottomIntersectWithAir(world, points[point]))
                 points[point].yCoord = (double) y + 1.0D;
             // Check if the block's top side intersects with air.
             else if (point >= 4 && doesPointTopIntersectWithAir(world, points[point]))
                 points[point].yCoord = (double) y;

             // Give the point some random offset.
             points[point] = givePointRoughness(points[point]);
         }
     }

     // Loop through all the sides of the block:
     for (int side = 0; side < 6; side++) {
         // The coordinates the side is facing to.
         int facingX = x;
         int facingY = y;
         int facingZ = z;
         if (side == 0)
            facingY--;
         else if (side == 1)
            facingY++;
         else if (side == 2)
            facingZ--;
         else if (side == 3)
            facingX++;
         else if (side == 4)
            facingZ++;
         else if (side == 5)
            facingX--;

         // Check if the side should be rendered:
         // This prevents a lot of lag!
         if (renderer.renderAllFaces || block.shouldSideBeRendered(world, facingX, facingY, facingZ, side)) {
             // When you lower this value the block will become darker.
             float colorFactor = 1.0F;

             // This are the vertices used for the side.
             Vec3 vertex0 = null;
             Vec3 vertex1 = null;
             Vec3 vertex2 = null;
             Vec3 vertex3 = null;
             if (side == 0) {
                 // Side 0 is the bottom side.
                 colorFactor = shadowBottom;
                 vertex0 = points[0];
                 vertex1 = points[1];
                 vertex2 = points[2];
                 vertex3 = points[3];

             } else if (side == 1) {
                 // Side 1 is the top side.
                 colorFactor = shadowTop;
                 vertex0 = points[7];
                 vertex1 = points[6];
                 vertex2 = points[5];
                 vertex3 = points[4];

             } else if (side == 2) {
                 colorFactor = shadowLeft;
                 vertex0 = points[1];
                 vertex1 = points[0];
                 vertex2 = points[4];
                 vertex3 = points[5];

             } else if (side == 3) {
                 colorFactor = shadowRight;
                 vertex0 = points[2];
                 vertex1 = points[1];
                 vertex2 = points[5];
                 vertex3 = points[6];
             } else if (side == 4) {
                 colorFactor = shadowLeft;
                 vertex0 = points[3];
                 vertex1 = points[2];
                 vertex2 = points[6];
                 vertex3 = points[7];
             } else if (side == 5) {
                 colorFactor = shadowRight;
                 vertex0 = points[0];
                 vertex1 = points[3];
                 vertex2 = points[7];
                 vertex3 = points[4];
             }

             // Here is the brightness of the block being set.
             tessellator.setBrightness(block.getMixedBrightnessForBlock(world, facingX, facingY, facingZ));
             // Here is the color of the block being set.
             tessellator.setColorOpaque_F(shadowTop * colorFactor * colorRed, shadowTop * colorFactor * colorGreen,
             shadowTop * colorFactor * colorBlue);

             // And finally the side is going to be rendered!
             tessellator.addVertexWithUV(vertex0.xCoord, vertex0.yCoord, vertex0.zCoord, minU, maxV);
             tessellator.addVertexWithUV(vertex1.xCoord, vertex1.yCoord, vertex1.zCoord, maxU, maxV);
             tessellator.addVertexWithUV(vertex2.xCoord, vertex2.yCoord, vertex2.zCoord, maxU, minV);
             tessellator.addVertexWithUV(vertex3.xCoord, vertex3.yCoord, vertex3.zCoord, minU, minV);
         }
     }

     return true;
 }

 

I'm currently making a new class called Vec3 and just instantiating new objects instead of using a pool. The code is currently super performance intensive, and I'm not worried about memory optimisations yet.

Spoiler

public static class Vec3 {

	public double xCoord;
	public double yCoord;
	public double zCoord;

	public Vec3(final double xCoord, final double yCoord, final double zCoord) {
		this.xCoord = xCoord;
		this.yCoord = yCoord;
		this.zCoord = zCoord;
	}

}

 

 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)
53 minutes ago, Cadiboo said:

I'm currently making a new class called Vec3

Why? What's wrong with mojang's Vec3d? Or lwjgl's Vector3? You should not be reinventing the wheel.

53 minutes ago, Cadiboo said:

The code is currently super performance intensive

Unless you mean some other code instantinating an object that consists out of 3 primitives is nearly instant.

Edited by V0idWa1k3r
Posted (edited)

Mojangs Vec3d is immutable, the code needs changeable vectors.

I also just got an out of memory error so I might need to start doing some optimising, though that could be due to something else. It had to do with shaders

That code I linked is being run for every block in a render chunk (it’s not as performance intensive as I thought, intelliJ hotswap seems to absolutely kill FPS tho)

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
3 hours ago, Cadiboo said:

I'm currently making a new class called Vec3 and just instantiating new objects instead of using a pool.

Using a pool might be a good optimization later. But I don't see a reason for your Vec3 class to store doubles. The values dont ever seem to have decimals. 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
8 hours ago, Cadiboo said:

givePointRoughness(points[point]);

This adds a random float value, sorry for not posting it, but I hadn’t reconstructed it yet and it wasn’t part of the original snippet. I’ll change the Vec3s to use floats.

 

Did the order of EnumFacing change since 1.7.10? 

8 hours ago, Cadiboo said:

int facingX = x; int facingY = y; int facingZ = z; if (side == 0) facingY--; else if (side == 1) facingY++; else if (side == 2) facingZ--; else if (side == 3) facingX++; else if (side == 4) facingZ++; else if (side == 5) facingX--;

This isn’t working at all

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)
On 12/3/2018 at 9:04 PM, Cadiboo said:

Did the order of EnumFacing change since 1.7.10? 

This isn’t working at all

EnumFacing order is DUNSWE (which I'm pretty sure is the same as ForgeDirection from 1.7.10).

 

But EnumFacing and/or BlockPos provide all the methods you might need to get rid of that ugly (and wrong) bit of code.  Assuming the side int is in the expected DUNSWE order:

BlockPos newPos = new BlockPos(x, y, z).offset(EnumFacing.byIndex(side));
// then use newPos.getX() etc.

 

Edited by desht
Posted (edited)
21 hours ago, desht said:

EnumFacing order is DUNSWE (which I'm pretty sure is the same as ForgeDirection from 1.7.10).

 

But EnumFacing and/or BlockPos provide all the methods you might need to get rid of that ugly (and wrong) bit of code.  Assuming the side int is in the expected DUNSWE order:


BlockPos newPos = new BlockPos(x, y, z).offset(EnumFacing.byIndex(side));
// then use newPos.getX() etc.

 

All of that code was apparently completely useless and unnecessary in 1.12.2, and now I'm just using the original BlockPos.
The problem with the EnumFacings was actually that the vertices I had taken from the old code (and expected to be perfect) were completely broken for South and West.

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.