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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am not using hardcoded recipes, I'm using Vanilla's already existing code for leather armor dying. (via extending and implementing DyeableArmorItem / DyeableLeatherItem respectively) I have actually figured out that it's something to do with registering item colors to the ItemColors instance, but I'm trying to figure out where exactly in my mod's code I would be placing a call to the required event handler. Unfortunately the tutorial is criminally undescriptive. The most I've found is that it has to be done during client initialization. I'm currently trying to do the necessary setup via hijacking the item registry since trying to modify the item classes directly (via using SubscribeEvent in the item's constructor didn't work. Class so far: // mrrp mrow - mcmod item painter v1.0 - catzrule ch package catzadvitems.init; import net.minecraft.client.color.item.ItemColors; import net.minecraft.world.item.Item; import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.client.event.ColorHandlerEvent; import catzadvitems.item.DyeableWoolArmorItem; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class Painter { @ObjectHolder("cai:dyeable_wool_chestplate") public static final Item W_CHEST = null; @ObjectHolder("cai:dyeable_wool_leggings") public static final Item W_LEGS = null; @ObjectHolder("cai:dyeable_wool_boots") public static final Item W_SOCKS = null; public Painter() { // left blank, idk if forge throws a fit if constructors are missing, not taking the chance of it happening. } @SubscribeEvent public static void init(FMLClientSetupEvent event) { new Painter(); } @Mod.EventBusSubscriber private static class ForgeBusEvents { @SubscribeEvent public static void registerItemColors(ColorHandlerEvent.Item event) { ItemColors col = event.getItemColors(); col.register(DyeableUnderArmorItem::getItemDyedColor, W_CHEST, W_LEGS, W_SOCKS); //placeholder for other dye-able items here later.. } } } (for those wondering, i couldn't think of a creative wool helmet name)
    • nvm found out it was because i had create h and not f
    • Maybe there's something happening in the 'leather armor + dye' recipe itself that would be updating the held item texture?
    • @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre e) { e.setCanceled(true); model.renderToBuffer(e.getPoseStack(), pBuffer, e.getPackedLight(), 0f, 0f, 0f, 0f, 0f); //ToaPlayerRenderer.render(); } Since getting the render method from a separate class is proving to be bit of a brick wall for me (but seems to be the solution in older versions of minecraft/forge) I've decided to try and pursue using the renderToBuffer method directly from the model itself. I've tried this route before but can't figure out what variables to feed it for the vertexConsumer and still can't seem to figure it out; if this is even a path to pursue.  The vanilla model files do not include any form of render methods, and seem to be fully constructed from their layer definitions? Their renderer files seem to take their layers which are used by the render method in the vanilla MobRenderer class. But for modded entities we @Override this function and don't have to feed the method variables because of that? I assume that the render method in the extended renderer takes the layer definitions from the renderer classes which take those from the model files. Or maybe instead of trying to use a render method I should be calling the super from the renderer like   new ToaPlayerRenderer(context, false); Except I'm not sure what I would provide for context? There's a context method in the vanilla EntityRendererProvider class which doesn't look especially helpful. I've been trying something like <e.getEntity(), model<e.getEntity()>> since that generally seems to be what is provided to the renderers for context, but I don't know if it's THE context I'm looking for? Especially since the method being called doesn't want to take this or variations of this.   In short; I feel like I'm super super close but I have to be missing something obvious? Maybe this insane inane ramble post will provide some insight into this puzzle?
  • Topics

×
×
  • Create New...

Important Information

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