robertx555
Members-
Posts
25 -
Joined
-
Last visited
Everything posted by robertx555
-
[Solved][1.15.2] Adding elemental properties to LivingEntities
robertx555 replied to Tavi007's topic in Modder Support
What is the purpose of this capability? Unless I understood you wrong, you just need other mods to tell you what elements their mobs are. This can be done with datapacks. You load all the datapacks into a Hashmap<String,ElementData> where string is the mod id. And when you want to know mob's resistances, you just check that map. Entity Capabilities are for saving mob specific data, a hashmap works fine if that data is set at startup and same for each mob type. -
[1.15.2] Disable vanilla experience bar without affecting other mods
robertx555 replied to squidlex's topic in Modder Support
Got it thanks. OP you can notify other mod's devs if there's other mods with this problem. -
[1.15.2] Disable vanilla experience bar without affecting other mods
robertx555 replied to squidlex's topic in Modder Support
I think I followed a tutorial or was suggested to render hud on ElementType.EXPERIENCE. What is the correct way to do it? -
Is this mod released somewhere? If so that's against my permission as i reserved all rights. I only allowed private use of modified code. Also the 1.12.2 version has a crapton of my spaghetti code which is mostly ironed out in 1.14.4 as i spent months reworking most things. Yes, months to rework things, so i don't suggest you try fix. Also sorry sieben for the problems.
-
I know that at least. Btw managed to gitignore build and eclipse folders so here's the new one https://github.com/RobertSkalko/MMORPG-Mod Now i'm gonna see if i can use capabilities to save NBTTagCompound, i have like 20 stats so having 20 getter and setter functions seem like a disaster. Anyway it's nearly midnight so i'll do it tomorrow Thanks for the help! I won't need help anymore soon, got a lot of things to work on now!
-
i know but things are easier to balance if i only care about 1 player.. for example say i want to spawn random mobs around a player. It becomes more difficult to balance when multiple players are around. 1 player is lvl 100 the other is lvl 1, i would have to make it so both players can play somehow.. which would mean many changes didn't learn that yet, i'll try gitignore, kept hearing about it but now i see why it's useful
-
My tastes are niche so i wouldn't expect many to like the mod.. If i can easily make it multiplayer then sure Eclipse folder is 100 mb and build folder is 70 mb
-
i'm making it for singleplayer only for now I'll try rework the getstats so it saves on capabilities, now that i have a working capability i can actually start the work sorry i just put the main files because the file is 200mb and my net is pretty slow
-
my bad i'll first check for server side, um getstats is for calculating player stats that i made. I put the whole thing on github if you want to get eye damage Gonna take me a while to fix stuff after removing MAIN.player
-
Whoa i think i solved it! Thanks! @SubscribeEvent public void onTickCalcStats(TickEvent.PlayerTickEvent event) { if (event.phase == Phase.END ) { tick++; if (tick > 100 && event.player != null && event.side.isServer()) { MAIN.player = event.player; EntityPlayer player = event.player; getStats(); if (player.hasCapability(Entity_Data.Data, null)) { DataInterface data = player.getCapability(Entity_Data.Data, null); data.setLevel(data.getLevel() +1); player.sendMessage( new TextComponentString(data.getLevel()+ " ")); } IAttributeInstance health = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); health.setBaseValue(20); tick = 0; } } } You said i'm supposed to get player from event.. well servertickevent has no player but TickEvent.PlayerTickEvent does! I changed it and it suddenly magically worked! It saves on death and on quitting game! That answered another question, seems i don't have to call any other saving methods I'm gonna go and remove MAIN.player and update all the stuff..
-
okay that seems easy, gimme a sec
-
How would i set the player data on the server? btw i uploaded to github in case it helps https://github.com/RobertSkalko/Minecraft-Forge-Singleplayer-MMORPG-like-mod
-
MAIN.player = Minecraft.getMinecraft().player; I can post my whole mod on github in a sec but it contains a lot of shitty code that i'll have to revamp when i figure out how everything works
-
I made a small test for it in servertickevent if (MAIN.player.hasCapability(Entity_Data.Data, null)) { DataInterface data = MAIN.player.getCapability(Entity_Data.Data, null); data.setLevel(data.getLevel() +1); MAIN.player.sendMessage( new TextComponentString(data.getLevel()+ " ")); Basically an increment every few ticks. I keep seeing increasing numbers.. until i leave game or die. It goes like 1,2,3,4 "i die" 1, 2 ,3 you get the idea. So either i have to save the data somehow or i messed something up with the compatibility
-
Took me a while to get a working capability but now i don't see how i'm supposed to save them to disk. Here is my capability file, it's all registered and it works, just doesn't save public class Entity_Data { @CapabilityInject(DataInterface.class) public static final Capability<DataInterface> Data = null; public interface DataInterface { void setLevel(int value); int getLevel(); } public static class EventHandler { @SubscribeEvent public void onEntityConstruct(AttachCapabilitiesEvent evt) { evt.addCapability(new ResourceLocation(Ref.MODID, "Data"), new ICapabilitySerializable<NBTTagCompound>() { DataInterface inst = Data.getDefaultInstance(); @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { return capability == Data; } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { return capability == Data ? Data.<T>cast(inst) : null; } @Override public NBTTagCompound serializeNBT() { return (NBTTagCompound)Data.getStorage().writeNBT(Data, inst, null); } @Override public void deserializeNBT(NBTTagCompound nbt) { Data.getStorage().readNBT(Data, inst, null, nbt); } }); } } public static class Storage implements IStorage<DataInterface> { @Override public NBTBase writeNBT(Capability<DataInterface> capability, DataInterface instance, EnumFacing side) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("level", instance.getLevel()); return nbt; } @Override public void readNBT(Capability<DataInterface> capability, DataInterface instance, EnumFacing side, NBTBase nbt) { NBTTagCompound tag = (NBTTagCompound) nbt; instance.setLevel(tag.getInteger("level")); } } public static class DefaultImpl implements DataInterface { private int level = 1; @Override public int getLevel() { return level; } @Override public void setLevel(int value) { this.level = value; } } Also i followed a tutorial on how to make player data persist through death but it doesn't work even though the chat message is sent as a confirmation the code ran @SubscribeEvent public void onPlayerClone(PlayerEvent.Clone event){ if (!event.getEntityPlayer().world.isRemote) { event.getEntityPlayer().sendMessage(new TextComponentString("clone")); EntityPlayer player = event.getEntityPlayer(); DataInterface data = player.getCapability(Entity_Data.Data, null); DataInterface oldData = event.getOriginal().getCapability(Entity_Data.Data, null); data.setLevel(oldData.getLevel()); } } Thanks for any help!
-
Can close the thread, i read some other thread here the suggestion to open type hierarchy made me realize LivingDamageEvent event exists and that i can change the amount there with setamount! There is a class called ForgeHooks that contains all the events
-
I found 2 ways of doing this but they both seem the wrong way. I made my own stat system with nbt on items and if player has a total of say 50 dmg, i want the weapon to do 50 dmg. Here are the 2 ways i did this that i think are wrong firstly i tried just setting mob health but that has issues, the mobs don't drop any items then. secondly, i tried using the attackentityfrom method and making it unique so i can identify it and not make an infinite loop, but this looks like a disaster in the making if (event.getSource().isDamageAbsolute())return; event.getEntityLiving().attackEntityFrom(event.getSource().setDamageIsAbsolute(), combinedDMG); event.setCanceled(true); Am i missing the true way of doing this? And no i can't just change the dmg of items, there is crit chance, lifesteal etc to calculate too. EDIT I THINK I FIGURED IT OUT, sec
-
Thanks, i figured out how to do it! I don't think i have the best possible way but it works! First you add the tags NBTTagCompound com = new NBTTagCompound(); com.setString("stats", "example stat"); item.setTagCompound(com); then you display them @SubscribeEvent public void onTooltip(ItemTooltipEvent event) { ItemStack item = event.getItemStack(); if (item.getTagCompound()!= null) { if (item.getTagCompound().hasKey("stats")) { event.getToolTip().add(stats); } } I got stuck because there wasn't setTooltip() method, i had to gettooltip() and then add().. You can also remove some of the tags from showing this way but attack speed and armor seems to stay lol
-
I think i got it! I add item info with nbttags and then make the item show it by using addinformation to show the info! I'll try to figure out how exactly to do it tomorrow, but this tutorial was helpful https://emxtutorials.wordpress.com/adding-nbt-data-to-items/ thanks all, i'll ask again if i still can't do it tomorrow
-
Yeah i'm prepared to write code for many days.. but first i need to figure out how to add lore to items. I think i'm close to the answer, seems to be NBTTagList. I'll just fiddle with it until i figure it out
-
I know, i can make my own stat and dmg system that makes use of that text on items. Hm, itemtooltipevent? Can't i first give the item lore and then make it drop from a mob? The attributes are too limiting. I already made the stat system for a bukkit server so i know it's possible, i just have to figure out the differences with forge modding
-
i want to use vanilla items, a wooden sword for example, and be able to create infinite amounts of different items by changing the sword's lore. like wooden sword: critical chance 5% wooden sword: critical damage 20%
-
Hello, new to forge modding, i did this with bukkit modding so i'll explain With bukkit, i created an item say a diamond sword, i made it roll random stats and then set the lore with setitemmeta() and setlore() how do i set the lores with forge? https://i.imgur.com/HYysu.png here pic in case you're confused what i mean by lore Thanks!
-
Thanks.. that's a shame eh, i guess the only workaround then is automatically dropping items on pickup, but that's probably too buggy
-
Hello, i'm trying to make a mod that makes some things easier on a server i play with, so the mod has to be 100% client side. My problem is i don't know which events are client side. I see 2 events which might be useful EntityItemPickupEven and PlayerEvent.ItemPickupEvent But i tried both and tried setting them to either event.setcanceled(true) or event.setresult(result.deny) and neither seem to stop my character from picking up items.. So, yeah i'd just like to know how to stop myself from picking up items client side and if possible to know how i know which event is client side. Thanks for any help!