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

    • Reach Out To Rapid Digital: What sapp Info: +1 41 4 80 7 14 85 Email INFO: rap iddi gita lrecov ery @ exe cs. com Hello, my name is Jayson, and I’m 35 years old from the United Kingdom. My family and I recently endured an incredibly challenging experience that I wouldn’t wish on anyone. We became victims of a cryptocurrency investment fraud scheme that saw us lose a staggering $807,000 in USDT and Bitcoins. The fraudsters had created a convincing facade, and we were lured into investing, only to discover later that the platform was a complete scam. We were left devastated, not just financially, but emotionally, as we had trusted these people and believed in the legitimacy of the investment. After the initial shock wore off, we desperately searched for ways to recover the lost funds. It seemed like an impossible task, and we felt as though there was no hope. That’s when, by sheer luck, we stumbled across a post about Rapid Digital Recovery, a cryptocurrency and funds recovery organization with a proven track record in cybersecurity and fraud recovery. We decided to reach out to them, and from the first interaction, we were impressed with their professionalism and transparency. They explained the recovery process in detail and reassured us that they had the skills and expertise to track down the perpetrators and recover our funds. This gave us a renewed sense of hope, something we hadn’t felt in months. What truly stood out during our experience with Rapid Digital Recovery was their dedication to the recovery process. The team went above and beyond, using sophisticated tracking tools and cyber forensics to gather critical information. Within a matter of weeks, they had successfully located the funds and traced the scam back to the fraudsters responsible. They worked with the authorities to ensure the criminals were held accountable for their actions. To our relief, the team at Rapid Digital Recovery was able to recover every single penny we had lost. The funds were returned in full, and the sense of closure we felt was invaluable. We couldn’t have imagined such a positive outcome in the early stages of our recovery journey, and we are deeply grateful for the work they did. If you ever find yourself in a similar situation, I highly recommend contacting Rapid Digital Recovery. Their expertise, transparency, and dedication to their clients make them the go-to choice for anyone seeking to recover lost cryptocurrency or funds. They truly gave us back our financial future.  
    • This is my first time modding anything, so maybe just skill issue. I'm using Forge 54.0.12 and Temurin 21.0.5+11-LTS I wanted to create a custom keybind and to check whether it works I'd like to send a chat message. I tried using Minecraft.getInstance().player.sendSystemMessage(Component.literal("test")); but IntelliJ couldnt resolve sendSystemMessage(...). Since I saw people using it in earlier versions, I tried the same thing with 1.20.6(- 50.1.0), where it works fine, now I can't figure out if this is intentional and whether there are other options for sending chat messages. On that note, is there more documentation than https://docs.minecraftforge.net/en/1.21.x/? It seems very incomplete compared to something like the Oracle Java docs
    • Hi, i'm having this error and I wanna fix it. we try: -Reload drivers -Eliminate .minecraft -Eliminate Java -Restart launcher -Verify if minecraft is using gpu -Mods  in .minecraft is empty -Install the latest and recomended version of forge idk what i have to do, help me pls. the lastest log is: https://mclo.gs/WAMao8x  
    • Read the FAQ, Rule #2. (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/)  
  • Topics

×
×
  • Create New...

Important Information

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