Jump to content

[1.14.4] Modifying Vanilla Content


MineModder2000

Recommended Posts

Also look at the Block#getPlayerRelativeBlockHardness method (and the ForgeHooks.canHarvestBlock method it calls). You'll probably want to perform similar checks to see if the break speed you got from the event is greater than what you'd expect from an empty hand, and allow that, otherwise cancel it. There's probably a better way than comparing the speeds, but this is where I'd start.

  • Thanks 1

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

13 hours ago, DavidM said:

For future reference, an instance of Event will have all the relevant information stored in it. You can use your IDE to look at all the information stored in it.

Yes I see this, thank you.

 

1 hour ago, Draco18s said:

Also look at the Block#getPlayerRelativeBlockHardness method (and the ForgeHooks.canHarvestBlock method it calls). You'll probably want to perform similar checks to see if the break speed you got from the event is greater than what you'd expect from an empty hand, and allow that, otherwise cancel it. There's probably a better way than comparing the speeds, but this is where I'd start.

Thanks, I have seen the canHarvestBlock method but it's not quite what I want. I want to actually make it so that the blocks only break with the appropriate tool, unless its something like a flower / bush which should be breakable with anything. 

 

I know how to check the tool type of a block with this :

 

event.getState().isToolEffective(ToolType.AXE)

 

But I am struggling with how to compare that to what's being held :

 

event.getEntityPlayer().getHeldItem(Hand.MAIN_HAND).getItem().

 

Link to comment
Share on other sites

2 minutes ago, MineModder2000 said:

Thanks, I have seen the canHarvestBlock method but it's not quite what I want. I want to actually make it so that the blocks only break with the appropriate tool

Yes, I understand. Look at what that method does. I didn't say "invoke the method" I said "look at what it does."

  • Thanks 1

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

5 minutes ago, Draco18s said:

Yes, I understand. Look at what that method does. I didn't say "invoke the method" I said "look at what it does."

It checks whether the given Block can be harvested using the specified ItemStack. Using it as a check, only pick axes work with stone and such as intended. But nothing else is harvest-able, no matter what tool is used. 

Link to comment
Share on other sites

19 minutes ago, MineModder2000 said:

But I am struggling with how to compare that to what's being held :

Look at the item class because you can set the ToolType of an item.

  • Thanks 1

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

On 8/17/2019 at 12:42 PM, MineModder2000 said:

It has getToolTypes() which returns Set<ToolType>, not quite. 

 

Never mind sorry, very noob reply from me. It's been awhile since I've messed with Java so I am rusty. I have it working as I wanted, only shovels dig dirt, only axes chop wood, etc. 

 

Thanks to all in thread that helped.

 

Now if you can help me here too that would be great ?

 

Edited by MineModder2000
Link to comment
Share on other sites

13 hours ago, MineModder2000 said:

Couple more things I need to know how to do :

 

  1. Change odds of a block dropping an item (e.g. : leaves dropping sticks)
  2. Make a block that drops itself break and drop items instead (e.g. wood logs into wood chunks)

Override their loot table files. data.minecraft.loot_table.blocks I believe.

  • Thanks 1

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

Actually not so simple, the docs : https://mcforge.readthedocs.io/en/latest/items/loot_tables/ seem outdated. I can't call the "Loot Pool" constructor for one, because it says the constructor is not visible. It seems there are multiple ways to do this with either json or calling certain classes / methods, and I am confused. 

Edited by MineModder2000
Link to comment
Share on other sites

11 hours ago, MineModder2000 said:

This is for 1.12 you didn't click to go to 1.13.

Mind you this is not what you should do to edit block loot tables anyways. Just create a json with the same name as the ones in the minecraft jar file under the folders data/minecraft/loot_tables/blocks.

Then in your mod create the package under your resources folder data.minecraft.loot_tables.blocks. And put your json loot table there.

  • Thanks 1

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

12 hours ago, Animefan8888 said:

This is for 1.12 you didn't click to go to 1.13.

Mind you this is not what you should do to edit block loot tables anyways. Just create a json with the same name as the ones in the minecraft jar file under the folders data/minecraft/loot_tables/blocks.

Then in your mod create the package under your resources folder data.minecraft.loot_tables.blocks. And put your json loot table there.

Actually I did check 1.13, it's the same for loot tables, when you link it it defaults to 1.12. I already did the json thing, it isn't working the way it is for my overridden recipes. 

 

Here's my oak_leaves.json for example (data.mymod.loot_tables.blocks.oak_leaves.json) : 

 

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:alternative",
                  "terms": [
                    {
                      "condition": "minecraft:match_tool",
                      "predicate": {
                        "item": "minecraft:shears"
                      }
                    },
                    {
                      "condition": "minecraft:match_tool",
                      "predicate": {
                        "enchantments": [
                          {
                            "enchantment": "minecraft:silk_touch",
                            "levels": {
                              "min": 1
                            }
                          }
                        ]
                      }
                    }
                  ]
                }
              ],
              "name": "minecraft:oak_leaves"
            },
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:survives_explosion"
                },
                {
                  "condition": "minecraft:table_bonus",
                  "enchantment": "minecraft:fortune",
                  "chances": [
                    0.05,
                    0.0625,
                    0.083333336,
                    0.1
                  ]
                }
              ],
              "name": "minecraft:oak_sapling"
            }
          ]
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "conditions": [
            {
              "condition": "minecraft:table_bonus",
              "enchantment": "minecraft:fortune",
              "chances": [
                0.5,
                0.6,
                0.7,
                0.8,
                0.9
              ]
            }
          ],
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 2.0,
                "type": "minecraft:uniform"
              }
            },
            {
              "function": "minecraft:explosion_decay"
            }
          ],
          "name": "minecraft:stick"
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:inverted",
          "term": {
            "condition": "minecraft:alternative",
            "terms": [
              {
                "condition": "minecraft:match_tool",
                "predicate": {
                  "item": "minecraft:shears"
                }
              },
              {
                "condition": "minecraft:match_tool",
                "predicate": {
                  "enchantments": [
                    {
                      "enchantment": "minecraft:silk_touch",
                      "levels": {
                        "min": 1
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "conditions": [
            {
              "condition": "minecraft:survives_explosion"
            },
            {
              "condition": "minecraft:table_bonus",
              "enchantment": "minecraft:fortune",
              "chances": [
                0.005,
                0.0055555557,
                0.00625,
                0.008333334,
                0.025
              ]
            }
          ],
          "name": "minecraft:apple"
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:inverted",
          "term": {
            "condition": "minecraft:alternative",
            "terms": [
              {
                "condition": "minecraft:match_tool",
                "predicate": {
                  "item": "minecraft:shears"
                }
              },
              {
                "condition": "minecraft:match_tool",
                "predicate": {
                  "enchantments": [
                    {
                      "enchantment": "minecraft:silk_touch",
                      "levels": {
                        "min": 1
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

 

It's identical save for the changes to the drop odds for sticks, which I made dramatically higher. Though when I play the game it's not taking affect, sticks are still a rare drop. 

 

Link to comment
Share on other sites

22 minutes ago, MineModder2000 said:

data.mymod.loot_tables.blocks.oak_leaves.json

I'm confident I said data.minecraft.loot_tables.blocks not data.mymod.loot_tables.blocks

  • Thanks 1

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

4 minutes ago, MineModder2000 said:

Hallelujah! It's working ?. Why is it that for recipes I have to use my mod's ID but for this I have to use minecraft?

Because your overriding a block that has the registry name minecraft:oak_leaves not mymod:oak_leaves

  • Thanks 1

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

Help needed again. Now this time i want to replace a vanilla texture, I did the following :

 

I did this code in my "assets.minecraft.models.item" package.

Spoiler

{
    "parent": "item/handheld",
    "textures": {
        "layer0": "mymod:item/stone_axe"
    }
}

 

Then in my "assets.mymod.textures.item" package, I placed my new texture. But it's still showing vanilla texture...

Link to comment
Share on other sites

50 minutes ago, MineModder2000 said:

Also need to figure out how to change the "harvestable" distance, that is the distance from the player at which a block can be mined / chopped / dug etc. 

Its called "reach" as it applies to all forms of the player interacting with the world. Placing blocks, digging blocks, hitting mobs...

  • Thanks 1

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

21 hours ago, Draco18s said:

Its called "reach" as it applies to all forms of the player interacting with the world. Placing blocks, digging blocks, hitting mobs...

I see a REACH_DISTANCE variable but its in a vanilla class (PlayerEntity) and it's final. Where is the reach variable you are referring to?

Link to comment
Share on other sites

2 hours ago, MineModder2000 said:

I see a REACH_DISTANCE variable but its in a vanilla class (PlayerEntity) and it's final. Where is the reach variable you are referring to?

That's the one.

Welcome to needing Reflection.

  • Sad 1

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

Hey, at least it isn't the soul-eating abyss of java bytecode.

  • Haha 1

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

On 8/24/2019 at 7:51 AM, Draco18s said:

Hey, at least it isn't the soul-eating abyss of java bytecode.

Oh yikes, that is another kind of evil. I have messed around with the reflection but I can't really get it to work. I think I would rather just use forge hooks to make the target-able block range artificially different than what it is. So basically if the targeted block is greater than X distance from player, then BreakSpeed is canceled / set to zero, then I would need to do something similar with placing blocks. I am having trouble however, with getting positions of the targeted block (BreakSpeed.getState()) and comparing them to where the player is. 

Edited by MineModder2000
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 was just trying to play my modded world when i randomly got this crash for no reason. I sorted through like every mod and eventually I realized it was LLibrary but I can't seem to find a solution to fix the crashing. I can't lose the world that I have that uses this mod please help me. Here's the report: https://pastebin.com/0D00B79i If anyone has a solution please let me know.  
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ligawin88 adalah bocoran slot rekomendasi gacor dari Ligawin88 yang bisa anda temukan di SLOT Ligawin88. Situs SLOT Ligawin88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ligawin88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ligawin88 merupakan SLOT Ligawin88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ligawin88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ligawin88 hari ini yang telah disediakan SLOT Ligawin88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ligawin88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ligawin88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ligawin88 di link SLOT Ligawin88.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Asusslot adalah bocoran slot rekomendasi gacor dari Asusslot yang bisa anda temukan di SLOT Asusslot. Situs SLOT Asusslot hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Asusslot terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Asusslot merupakan SLOT Asusslot hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Asusslot. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Asusslot hari ini yang telah disediakan SLOT Asusslot. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Asusslot terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Asusslot terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Asusslot di link SLOT Asusslot.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Galeri555 adalah bocoran slot rekomendasi gacor dari Galeri555 yang bisa anda temukan di SLOT Galeri555. Situs SLOT Galeri555 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Galeri555 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Galeri555 merupakan SLOT Galeri555 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Galeri555. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Galeri555 hari ini yang telah disediakan SLOT Galeri555. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Galeri555 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Galeri555 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Galeri555 di link SLOT Galeri555.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Kocok303 adalah bocoran slot rekomendasi gacor dari Kocok303 yang bisa anda temukan di SLOT Kocok303. Situs SLOT Kocok303 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Kocok303 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Kocok303 merupakan SLOT Kocok303 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Kocok303. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Kocok303 hari ini yang telah disediakan SLOT Kocok303. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Kocok303 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Kocok303 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Kocok303 di link SLOT Kocok303.
  • Topics

×
×
  • Create New...

Important Information

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