August 17, 20196 yr 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. 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.
August 17, 20196 yr Author 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().
August 17, 20196 yr 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." 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.
August 17, 20196 yr Author 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.
August 17, 20196 yr 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. 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.
August 17, 20196 yr Author 22 minutes ago, Animefan8888 said: Look at the item class because you can set the ToolType of an item. It has getToolTypes() which returns Set<ToolType>, not quite.
August 17, 20196 yr Author 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 August 25, 20196 yr by MineModder2000
August 17, 20196 yr Author Couple more things I need to know how to do : Change odds of a block dropping an item (e.g. : leaves dropping sticks) Make a block that drops itself break and drop items instead (e.g. : wood logs into wood chunks) Edited August 18, 20196 yr by MineModder2000
August 18, 20196 yr 13 hours ago, MineModder2000 said: Couple more things I need to know how to do : Change odds of a block dropping an item (e.g. : leaves dropping sticks) 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. 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.
August 19, 20196 yr Author 13 hours ago, Animefan8888 said: Override their loot table files. data.minecraft.loot_table.blocks I believe. Ah very simple! Thanks once again.
August 19, 20196 yr Author 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 August 19, 20196 yr by MineModder2000
August 20, 20196 yr 11 hours ago, MineModder2000 said: https://mcforge.readthedocs.io/en/latest/items/loot_tables/ 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. 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.
August 20, 20196 yr Author 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.
August 20, 20196 yr 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 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.
August 20, 20196 yr Author 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?
August 20, 20196 yr 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 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.
August 20, 20196 yr Author 2 hours ago, Animefan8888 said: Because your overriding a block that has the registry name minecraft:oak_leaves not mymod:oak_leaves Thanks for the help Edited August 21, 20196 yr by MineModder2000
August 22, 20196 yr Author 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...
August 23, 20196 yr Author 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.
August 23, 20196 yr 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... 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.
August 24, 20196 yr Author 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?
August 24, 20196 yr 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. 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.
August 24, 20196 yr Author 3 minutes ago, Draco18s said: That's the one. Welcome to needing Reflection. Ah hell no, I just learned how to do but it's so ugly. Guess I'll bite the bullet. Edited August 24, 20196 yr by MineModder2000
August 24, 20196 yr Hey, at least it isn't the soul-eating abyss of java bytecode. 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.
August 25, 20196 yr Author 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 August 27, 20196 yr 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.