Jump to content

Recommended Posts

Posted

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.

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

 

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

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

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

Posted (edited)
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
Posted (edited)

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)
Edited by MineModder2000
Posted
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.

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

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

 

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

Posted
4 minutes ago, Animefan8888 said:

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

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?

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

Posted

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

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

Posted
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?

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

Posted

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.

Posted (edited)
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

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

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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