Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.14.4] Modifying Vanilla Content


MineModder2000
 Share

Recommended Posts

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.

  • Thanks 1

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

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

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

 Share




  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Amplifier is like the strength of the effect, for example movement speed boost with amplifier 0 will be Speed I, and 1 will be Speed II, 2 will be Speed III. Effect is just an...effect type, EffectInstance contains all information for the actual effect being applied to the entity (duration, amplifier...etc). For example there's only an effect type "Speed", but for an EffectInstance it could be: "Level 2 Speed for 10 seconds" "Level 4 Speed for 2 seconds"...   The first method applyEffectTick is called when a effect is impacting the entity, the first arg is the entity that has the effect/is affected by the effect, and amplifier is the strength of the effect. The second method isDurationEFfectTick is to check whether the effect should impact/affect the entity this tick (the effects usually don't trigger every tick!), if true, then the first method is called.  
    • Hi, I have enchantment named "Stun" that can be applied to weapon and that has 3 levels: Level 1 - 10% chance to stun mob for 1 sec Level 2 - 20% chance to stun mob for 2 secs Level 3 - 30% chance to stun mob for 3 secs Plan is to apply MobEffect named StunnedMobEffect on doPostAttack in enchantment. StunnedMobEffect should have variable duration based on the level of enchantment that was applied on weapon. I am trying to find an example on how to do the following: How can I set duration of effect dynamically? How can I track whether duration has expired? I have found these two methods that can be overriden:   public void applyEffectTick(LivingEntity pLivingEntity, int pAmplifier) { public boolean isDurationEffectTick(int pDuration, int pAmplifier) { But looking at the source code of MobEffect class, I can't figure out what pAmplifier is? Any hints / samples on this would be appreciated.          
    • 2022-01-22 07:41:00,800 main WARN Advanced terminal features are not available in this environment [07:41:00] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.2.23, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, nogui] [07:41:00] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 17.0.2 by Oracle Corporation Exception in thread "main" java.lang.IllegalAccessError: class cpw.mods.modlauncher.SecureJarHandler (in unnamed module @0x7ff95560) cannot access class sun.security.util.ManifestEntryVerifier (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x7ff95560         at cpw.mods.modlauncher.SecureJarHandler.lambda$static$1(SecureJarHandler.java:41)         at cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck(LamdbaExceptionUtils.java:95)         at cpw.mods.modlauncher.SecureJarHandler.<clinit>(SecureJarHandler.java:41)         at cpw.mods.modlauncher.Launcher.lambda$new$6(Launcher.java:55)         at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:52)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:47)         at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(Environment.java:62)         at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:55)         at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)         at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63)         at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60)         at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) i have the same how do i fix it  
    • Hi, I'm facing an issue that a custom datapack is always loaded before the mod's datapack. Means the users/players are not able to override mod's configurations/data at all. I've tried to alternate the order of datapack by using the /datapack commands, however the actual loading order does not change at all. (I can confirm that both datapacks are working as usual by disabling one of them at a time, the correspond data is loaded correctly), is it the mod's problem or...? Thanks.
    • I'm trying to play a custom modpack with a few dozen mods, but when I try to create a world it hits 100% and then crashes and I can't figure out why. Here's the crash log:  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.