Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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?

Posted

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.

Posted

IBlockState#getValue(BlockDirectional.FACING)

All right, and if im not mistaken i do all these render methods in the TileEntity correct?

The GL which you will need to render anything is done in a TESR(TileEntitySpecialRenderer), not the TE itself.

Posted

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.

Posted

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?

Posted

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.

Posted

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

Posted

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.

Posted

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() ?

Posted

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.

Posted

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)

 

Posted

(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.

Posted

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());
            }
        }

Posted

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.

Posted

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.

Posted

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.

Posted

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?

Posted

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.

Posted

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

Posted

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.

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



×
×
  • Create New...

Important Information

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