Jump to content

[Solved] [1.11] Creating Quarry


abused_master

Recommended Posts

Hello Everyone, im trying to create a quarry in my mod but need a little help with it.

So my idea is when this quarry is placed depending on the side its place it will display a textured line around the outside of where it will mine(64x64 area and down as far as bedrock), and start working on that area, mining, then outputting into an adjacent inventory, and if that isnt available then dont do anything.

so #1 how would i check what direction the block is placed at then draw the like? would i use EnumFacing.NORTH/SOUTH, etc? and if so how would i draw the line with a custom texture

ill get to #2 after this as id like to take it a little bit at a time so i could also learn from this and understand what im doing and how it works.

Link to comment
Share on other sites

Hello Everyone, im trying to create a quarry in my mod but need a little help with it.

So my idea is when this quarry is placed depending on the area it will display a textured line around the outside of where it will mine, and start working on that area, mining, then outputting into an adjacent inventory, and if that isnt available then dont do anything.

so #1 how would i check what direction the block is placed at then draw the like? would i use EnumFacing.NORTH/SOUTH, etc? and if so how would i draw the line with a custom texture

ill get to #2 after this as id like to take it a little bit at a time so i could also learn from this and understand what im doing and how it works.

I would use the blockstates orientation from inside my TileEntity set a variable and either use entities/entity or a TESR if there is a better way to draw the lines someone else say something as that is all that "blockstates orientation" would be getting the blockstate from the world where the TE is and then extracting the variant for the direction. Of course this means you will have to have the Horizontal facing variants. An example of those would be in the FurnaceBlock class.

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.

Link to comment
Share on other sites

Hello Everyone, im trying to create a quarry in my mod but need a little help with it.

So my idea is when this quarry is placed depending on the area it will display a textured line around the outside of where it will mine, and start working on that area, mining, then outputting into an adjacent inventory, and if that isnt available then dont do anything.

so #1 how would i check what direction the block is placed at then draw the like? would i use EnumFacing.NORTH/SOUTH, etc? and if so how would i draw the line with a custom texture

ill get to #2 after this as id like to take it a little bit at a time so i could also learn from this and understand what im doing and how it works.

I would use the blockstates orientation from inside my TileEntity set a variable and either use entities/entity or a TESR if there is a better way to draw the lines someone else say something as that is all that "blockstates orientation" would be getting the blockstate from the world where the TE is and then extracting the variant for the direction. Of course this means you will have to have the Horizontal facing variants. An example of those would be in the FurnaceBlock class.

 

What method would i use to check what direction its facing from the blockstate?

Link to comment
Share on other sites

IBlockState#getValue(BlockDirectional.FACING)

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.

Link to comment
Share on other sites

Sounds like your excavator is going to be an extension of BlockHorizontal. That'll give you a property that can be north, east, south or west (see the subset of horizontals within the facing enum). For the initial placement, see how a furnace does so.

 

Take care to separate the block's logic from its rendering. Logic is mostly server-side (world not remote), and rendering is client side-only. Don't scramble their concepts in your mind either.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Iv gone a few steps ahead and created the quarry and made it mine, i also made it mine the chunk its in, so instead of drawing a line in a 64x64 area i just want it to draw a line with a custom texture around the current chunk that the block is in, would that still be in the TESR? and how do i do that specifically to the chunk the block is in?

Link to comment
Share on other sites

Iv gone a few steps ahead and created the quarry and made it mine, i also made it mine the chunk its in, so instead of drawing a line in a 64x64 area i just want it to draw a line with a custom texture around the current chunk that the block is in, would that still be in the TESR? and how do i do that specifically to the chunk the block is in?

First you would have to get the chunks boundaries I would do this by grabbing the x and z position of your TE and convert it to chunk coords. Then from there you can easily get the boundries by converting it back and adding/subtracting 15. Then you need to design what it looks like with a Tessellator and VertexBuffer.

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.

Link to comment
Share on other sites

Sorry if i keep changing my idea on how to do this, and it will be the last time

Iv been tinkering a bit and instead have thought to just place blocks outside of the chunk, getting the chunk wont be hard thanks to AnimeFan8888, but how would i place the blocks on the outside of the chunk

int chunkX = getChunkXPos();
int chunkZ = getChunkZPos()
for (int x = chunkX; i < chunkX +/- 16; x++) {
     for (int z = chunkZ; i < chunkZ +/- 16; z++) {
          world.setBlockState(state, new BlockPos(x, pos.getY(), z));
     }
}

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.

Link to comment
Share on other sites

Sorry if i keep changing my idea on how to do this, and it will be the last time

Iv been tinkering a bit and instead have thought to just place blocks outside of the chunk, getting the chunk wont be hard thanks to AnimeFan8888, but how would i place the blocks on the outside of the chunk

int chunkX = getChunkXPos();
int chunkZ = getChunkZPos()
for (int x = chunkX; i < chunkX +/- 16; x++) {
     for (int z = chunkZ; i < chunkZ +/- 16; z++) {
          world.setBlockState(state, new BlockPos(x, pos.getY(), z));
     }
}

so state would be say Blocks.DIAMOND_ORE.getDefaultState() ?

Link to comment
Share on other sites

If you want the block to be diamond, yes.

 

Keep in mind that if you wanted spruce planks instead you'd have to do:

Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.EnumType.SPRUCE)

(Assuming I got the proper names of everything correct)

Because spurce is a variant.  The default state would get you oak.

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.

Link to comment
Share on other sites

If you want the block to be diamond, yes.

 

Keep in mind that if you wanted spruce planks instead you'd have to do:

Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.EnumType.SPRUCE)

(Assuming I got the proper names of everything correct)

Because spurce is a variant.  The default state would get you oak.

I see

so i tried to do it with cobblestone like so

world.setBlockState(Blocks.COBBLESTONE.getDefaultState(),new BlockPos(x, pos.getY(), z));

but am getting this error

 

setBlockState

(net.minecraft.util.math.BlockPos, net.minecraft.block.state.IBlockState) in World cannot be applied

to

(net.minecraft.block.state.IBlockState, net.minecraft.util.math.BlockPos)

 

Link to comment
Share on other sites

(A, B) != (B, A)

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.

Link to comment
Share on other sites

When i added and launched my game, and placed down the quarry, it would just freeze the game, no errors in console, no nothing, game just stays frozen

        for (int x = chunkX; i < chunkX + 16; x++) {
            for (int z = chunkZ; i < chunkZ + 16; z++) {
                worldObj.setBlockState(new BlockPos(x, pos.getY(), z), Blocks.COBBLESTONE.getDefaultState());
            }
        }

Link to comment
Share on other sites

When i added and launched my game, and placed down the quarry, it would just freeze the game, no errors in console, no nothing, game just stays frozen

        for (int x = chunkX; i < chunkX + 16; x++) {
            for (int z = chunkZ; i < chunkZ + 16; z++) {
                worldObj.setBlockState(new BlockPos(x, pos.getY(), z), Blocks.COBBLESTONE.getDefaultState());
            }
        }

 

What method is this inside?

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.

Link to comment
Share on other sites

I don't see anything obviously wrong.  Use the debugger and step-through.

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.

Link to comment
Share on other sites

When i added and launched my game, and placed down the quarry, it would just freeze the game, no errors in console, no nothing, game just stays frozen

        for (int x = chunkX; i < chunkX + 16; x++) {
            for (int z = chunkZ; i < chunkZ + 16; z++) {
                worldObj.setBlockState(new BlockPos(x, pos.getY(), z), Blocks.COBBLESTONE.getDefaultState());
            }
        }

What are the values of chunkX and chunkZ?

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.

Link to comment
Share on other sites

Iv fixed the problem, someone at the MMD Discord helped me,

So now my quarry mines when given energy, uses energy, places the cobblestone around the area it will mine, the only thing left is outputting the items, how can i make it detect an inventory placed on one of its sides and output the blocks it breaks to it?

Link to comment
Share on other sites

Iv fixed the problem, someone at the MMD Discord helped me,

So now my quarry mines when given energy, uses energy, places the cobblestone around the area it will mine, the only thing left is outputting the items, how can i make it detect an inventory placed on one of its sides and output the blocks it breaks to it?

Easiest way is to loop through the EnumFacings and use the offset function for an enumfacing that BlockPos has then do you if checks on capabilities.

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.

Link to comment
Share on other sites

Iv fixed the problem, someone at the MMD Discord helped me,

So now my quarry mines when given energy, uses energy, places the cobblestone around the area it will mine, the only thing left is outputting the items, how can i make it detect an inventory placed on one of its sides and output the blocks it breaks to it?

Easiest way is to loop through the EnumFacings and use the offset function for an enumfacing that BlockPos has then do you if checks on capabilities.

 

could you give me an example of this being done

Link to comment
Share on other sites

Do you want your device to be like a furnace that fills a small inventory until a hopper or player pulls it away? Or, does it need to be like a hopper that can push items into a chest?

 

Being passive and requiring a hopper beneath it to perform the movement task would probably be simpler to code, and that paradigm (parallel to furnace and brewing stand) would make good game sense.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • You can try other builds of Quark/Zeta
    • Hello all, I recently tried to upgrade my Minecraft mod to version 1.21.3, and I seem to have a problem with the `RenderSystem#setShaderColor` method. Here is how the screen is usually supposed to look like: Here is how it looks at present: To further explain, the note labels atop of the note buttons are colored cyan (here) using `RenderSystem#setShaderColor`. The note buttons and labels get their colors from their native texture - white. This means that even though I set the coloring to apply to the label (top), it is applied to the button (bottom). What I conclude is happening then, in essence, is that this method (at least for my case) does not color the blit after - but rather the blit before..?  This also blocks me from later resetting the shader, as I need to set it back to white before the blitting is done, and not when it's done. So like... what? I've tested this further with other components that require this method, and this preceding-like behavior seems to be pretty consistent for them too.   I should mention that all the snippets I am about to show have all worked in past versions. In my class `ClientUtil`, the following methods are defined: public static void setShaderColor(final Color color, final float alpha) { RenderSystem.setShaderColor( color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, alpha ); } public static void setShaderColor(final Color color) { setShaderColor(color, 1); } public static void resetShaderColor() { setShaderColor(Color.WHITE); } //... public static RenderType guiRT(final ResourceLocation loc) { return RenderType.guiTextured(loc); } And here is the snippet from `NoteButtonRenderer#renderNote` using it: // "Note" here refers to those symbols in the middle of a note button protected void renderNote(final GuiGraphics gui, final InstrumentThemeLoader themeLoader) { final int noteWidth = noteButton.getWidth()/2, noteHeight = noteButton.getHeight()/2; ClientUtil.setShaderColor((noteButton.isPlaying() && !foreignPlaying) ? themeLoader.notePressed() : themeLoader.noteReleased() ); gui.blit(ClientUtil::guiRT, noteTextureProvider.get(), noteButton.getX() + noteWidth/2, noteButton.getY() + noteHeight/2, 0, 0, noteWidth, noteHeight, noteWidth, noteButton.getHeight()/2 ); ClientUtil.resetShaderColor(); } You may find the full source here. The odd thing is that Minecraft does seem to use this method the regular way I showed, for instance `SkyRenderer#renderSkyDisc` (not sure if I'l allowed to paste it). Could it be that I'm doing something wrong that leads to this issue..? I'm really stumped on this one.  I couldn't really find any change logs or documentation for this rendering API (even in this Fabric blog post), so I'm sorry if this seems obvious or anything.  Either way, any help would be appreciated.
    • This did work. rip Quark Thank you
    • It says Quark Requires zeta. do i just remove Quark? https://mclo.gs/cq799kI
    • It refers to the mod elenaidodge Backup the world and make a test without it
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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