MFMods
Members-
Posts
370 -
Joined
-
Days Won
13
Everything posted by MFMods
-
[1.15.2] Have an item make player not drop items on death?
MFMods replied to FuzzyAcornIndustries's topic in Modder Support
Three events are of interest to you - player death event (LivingDeath), PlayerDrops event and player Clone event. First two trigger when player's avatar dies - player looks at the death message and the respawn button button. Items are scattered all over the death site. Then - maybe 5 seconds later - player clicks the respawn button. Then the Clone event fires - data is transfered from old (dead) player instance to a freshly created one. Be sure to note the (possibly) long delay between items being scattered and the new instance of the player being created (yes, the game will create a new player object. do not fight that). First event - Living death can be used to remember in which slot each item was. Second event - drops - has a "drops" collection - a list of ItemStacks that the dead player is about to drop dropped. You need to put them back into his inventory (the dead player object waits for the clone event; it will be destroyed at some point after the clone event) and delete from drops list. Third event - Clone - is where you go through player inventories of the old/dead player (main inventory (36 slots), armor inventory (4 slots), offhand inventory (1 slot) ), copy each item and add it to the new player's inventory. (when everything works, consider baubles support.) ------------------------- that's at least how i did it a while ago (disclaimer: i may not have remembered everything correctly)... it may not be the best way. Start with printing a line or two into console for every event. Once you get events and conditions to output proper messages, copying item stacks will be a small step. -
ok. you found the clone event. inside you write new-player-instance.value1 <- old-player-instance.value1 new-player-instance.value2 <- old-player-instance.value2 now persistence... if you just ask how do i store 1 integer on a player/cow/pickaxe, people here will say "learn capabilities. use capabilities. love capabilities." (https://mcforge.readthedocs.io/en/latest/datastorage/capabilities/) i do not quite agree... yes, the capability system allows you to store several values as a nice structured record. yes the system allows modA to nicely and properly access the data some modB has stored. but sometimes you just need one integer or one string and you can not imagine other mods wanting to interact. so you may elect not to make two interfaces and three more classes to keep that one value. and it's fine. entities and item stacks still have a nbt compound where you can keep your value across game shutdown/load. but in your case you can just read modifiers from the old player instance and apply onto a new player instance. no need to duplicate data.
-
the game will clone the player. in "player clone" event you are to copy your data from old (dead) player to new instance. before that, you need to solve persistance problem - ie. store the value. you dot that covered already?
-
in FMLInitializationEvent, you can iterate through ForgeRegistries.RECIPES, check recipe output and remove all recipes that output items you want to remove. or if you want to target specific registries ForgeRegistries.RECIPES has a remove method that takes a ResourceLocation. you need to cast it first. disclaimer: answer may be inaccurate due to forge versions.
-
i can't confirm on 1.15 but back around 1.11 or so, i had a similar problem - i made the projectile right but it was invisible. solution was to call RegisterModEntity or whatever it was called on entity registry. that made it visible. but given that it was several versions ago, that issue may be entirely obsolete.
-
what do you mean by "render"? do you want it just to work like a simple projectile or do you want something special? if it's a simple projectile, you don't do any rendering. you just assign a texture to an entity (new one, you will create it) which will be identical to a snowball/egg/enderpearl in every way except this texture and maybe particles. just investigate EntitySnowball class that comes with minecraft. one method for in-flight particles, one method for handling impact and that's all.
-
Where do I find information about modding in 1.15.2
MFMods replied to garitrigura's topic in Modder Support
https://github.com/TheGreyGhost/MinecraftByExample do not search youtube. it's ok if you follow a link to videos from a real modder (example: https://wiki.mcjty.eu/modding/index.php?title=YouTube-1.14 ), but most videos on youtube are from kids that do half the things wrongly. searching this forum is sometimes ok but often impossible (because you'll find your search words in unrelated stack traces)... official docs: https://mcforge.readthedocs.io/en/latest/ -
[SOLVED] [1.12.2] Music Disc inserted in Jukebox doesn't play music
MFMods replied to LorenzoPapi's topic in Modder Support
probably sounds.json. try mine: { "record.song1": { "category": "record", "sounds": [ { "name": "yourmodid:records/song1", "stream": true } ], "subtitle": "subtitle1" } } -
[SOLVED] [1.12.2] Music Disc inserted in Jukebox doesn't play music
MFMods replied to LorenzoPapi's topic in Modder Support
do you have a resources/assets/modid/sounds.json file? if not, stop and see a working example. do you have a resources/assets/modid/sounds/records/songname.ogg file? if not, see a working example. -
that is not what i asked. i asked for instructions on making a proper api-providing mod (and after making it, also instructions on distributing/publishing).
-
hi guys! i want to make a parent mod / addon mod connection but i'm not sure how to do it. and yes, i went to curseforge, and on pages of few popular mods that have addons (and pages of those addons), i clicked on source link and looked into them. while i could copy one of those systems, i could not find enough in common to make any conclusions about best practices. here's my scenario: i have a mod A (mine, finished) which adds a few items with special behaviors. now i want to make mod A1 which would be an addon to mod A and would serve as a primer for others. mod A1 would add an item and a class providing a behavior method, but mod A would make everything happen (invoke the behavior method). item in mod A1 would either extend class BaseItemA from mod A, or i would have a separate behavior class that would implement an interface from mod A. i can do with interface if i have to. i know that multiple-question threads are never a good idea, but i can't help it... questions: - is there a guide for "parent mod and addons"? preferably a guide by elder members of the forum? - if not, how about someone giving us a short guide here? i think my scenario is rather basic. (and by short, i mean short but full - what goes where in main mod? what goes where in addon mod? do i need this for a low-profile mod? best maven place? etc.)
-
there are couple of mods that add overworld-like dimensions (and portals or commands to get to them). pick one from curseforge, there are a few. then, enter, exit dimension, exit game, copy the dimension directory from your one world directory into this latest directory and you'll have your old worlds as dimensions in the new world. bonus mission: make use of hard links (or directory junctions depending on your OS) to link instead of copy. then, changes you make when one world is loaded will be visible when you load the other world. most important thing: BACKUP YOUR STUFF BEFORE STARTING! you have been warned.
-
try starting without optifine (usual culprit) and foamfix (possibly incompatible with this new version). many of us need extra fps but optifine is often more trouble than help.
-
you are not doing what i told you to do. you are writing random things and hoping everything works. first, get a hang of making a falling entity that will be a moving log-block and moving leaf-block when you are ready. and i said, do it on clear ground - react to a stick interacting with stone or react to a chat message. do not experiment inside of existing blocks (tree trunk). when the time comes, you'll need to remove all those logs and leaves prior to creating moving blocks, but do that LATER.
-
ok first of all, you need to try out small things before you make complicated things. otherwise, you'll just get angry with yourself and quit. start small. as for the tree thing (seriously, if you don't improve that english, don't ask for help in english), start with a demo - make a mod that detects you right-clicking the ground with a stick. when you detect that, spawn 2x EntityFallingBlock (i think it's called that). spawn them at x-1, y+4, z and x+1, y+4, z. let one have a blocks.log as it's block and the other should have blocks.leaves as its block. now give them a bit of vertical movement (i don't remember if you even have to, maybe not) using motionY and you're done with a demo. then, build on top of that.
-
interesting. i read lists above... and of 50 mods i have installed, i share NOTHING with above posters (ok, i share FoamFix and BetterFPS with one guy but those shouldn't really count). guys, try antique atlas instead of those minimaps - it's realistic and comfortable to use (also only wusses use mob radars). try lumen - it really adds life to the game, even though i disabled several things from it. for some quality of life, carry on is a must. i also use bottled milk, freelook (for elytra), bibliocraft (toolracks, bookshelves...). for more crops, try sushimod, simple corn. i'm evaluating rustic, might keep it. for more mobs, familiar fauna and mystical wildlife. for biomes, novam terram. for automation, i only have expanded industry. it's all you need, trust me. for exploration mcdisc (to add more discs with songs of my choosing) for building, earthworks (because everyone needs thatch roofs; i recommend disabling slate in config) for fixing villages a little, Configuable_Villagers_to_Door_Ratio. for fixing food, nutrition, it's awesome (i prefer it to both spice of life and spice of life carrot; but you need one of the three). various others like swingthroughgrass, entity spring, totem expansion, quark (for small stuff, nothing fancy)... most importantly couple of mine own, but let's skip that.
-
short version - act as if the coordinates (where you are deciding whether to generate things and where you will generate things) are offset by +8, +8. i.e. do offset them by +8,+8 both when checking the terrain and when generating your stuff. the thing is - if you overflow to the east or south, you're okay. no problem. but if you overflow towards north or west, more chunks need to be created (which will among others call your terrain generators again, likely causing more chunks to be generated...).
-
that you cannot, is one thing. first, let me explain what you tried to do. (later we'll see what you may have wanted to do.) getBlock() returns a Block - but not an individual instance (as seen by player). object that you have there represents all blocks in the world of the same type (including variations, for example wooden log orientation and before 1.13 wood types). now if you change its hardness, resistance, light level (if you manage to), inside the game that would affect ALL blocks of the same type, anywhere in the world. in other words, not what you want. i hope. but what is it that you want to do? different blockstates of the same block can have different light intensities. if that is what you want, just do SetBlockState() to change your block to the correct/new state. for the last parameter put 3 (or was it 11? can't remember. let's go with 3), one of those two flags (inside "3") tells the game to update what the players see).
-
https://gaming.stackexchange.com/questions/295925/how-do-you-summon-chests-with-loot-tables-with-command-blocks-in-minecraft-v1-10 just put the location to the chest loot type you want (jungle temple for example or modded loot table)
-
How to deal with items that can take more than 65536 damage
MFMods replied to [NoOneButNo]'s topic in Modder Support
my first instinct was to close the tab (gah, another guy wants to make overpowered gear), but on the second thought, the answer is applicable to many questions, so i'll get to typing... yes, it can be done. no, you can't go above 64k, don't try to fight that limit directly. but sure, solutions exist - are we programmers or silverfish? first of all, sometimes you don't need to reach the original goal, the "that-s-it" solution. in many cases the "that-s-mostly-it" solution is good enough. and it tends to take 4x-20x less time. let's define the task - let's say your task is " item with 240k durability". would it be ok for it to mostly act as if it had 240k durability? meaning, if you give it 60k durability and have it take damage 1/4 of the time, that's functionally similar to having 240k durability. and it takes minutes to implement. another way (which would be suitable for more complicated variation of what you need), is to give your item 100 durability, keep the actual value elsewhere (in nbt for example or cache+worldsave), and keep the durability set to percentage of the current value compared to the maximum value. with this solution, the value does not necessarily need to be the durability. all that is left to do is make a handler for tooltip event and add one line that explains things. -
@OP if you know of any mod that uses it, search github for it's code and look into the build.gradle. copy appropriate bits into your build.gradle and setup the workspace again. @everyone can't we have some sort of a database or a cheat sheet for dependencies?
-
first thing i recommend to people is MBE series: https://github.com/TheGreyGhost/MinecraftByExample but that started with 1.8, i think. then there are https://shadowfacts.net/tutorials/ and http://jabelarminecraft.blogspot.rs/ (i think the later is where you can find some 1.7 good info). there are some advanced ones in tutorials section of this forum (especially regarding networking), but i doubt that's what you need. now (slow hand wave): you will not search for tutorials on youtube. seriously, don't go there. thousands of kids decided they're hot stuff and recorded modding tutorials. finding something good among the crap that will show you wrong would take more time than figuring everything out on your own. if it's about something that has changed between 1.7 and 1.8, see if wuppy has what you need: http://www.minecraftforge.net/forum/topic/19144-13-17-wuppys-modding-tutorials-jul-5-in-english-chinese-german-etc/ . click on text tutorials or video tutorials there. maybe browse through tutorials on mcf: https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/mapping-and-modding-tutorials or try the support subforum: https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/modification-development (though this is the place to be, not there). again, you will not search for tutorials on youtube.
-
why? he said he wants to respond to a single press. why wouldn't you use key input event? (i never used it myself, so i don't know if it does what i'd expect it to do.)
-
https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/