Jump to content

Daring Do

Members
  • Posts

    109
  • Joined

  • Last visited

Everything posted by Daring Do

  1. The bit about reflection is what I tried. And, as far as I could tell, I couldn't set it up so that I could use it to send a new packet. I'm working with networking currently, and was hoping I could find a better method of sending the packets than what I'm doing now. I can try the capability approach, but I know jackshit about them.
  2. Anyone know of any methods or events to test for when a player gets a potion effect, and when that effect wears off? I've tried onNewPotionEffect, but it being protected makes it impossible for me to use.
  3. Okay, so, this is what I have now: public static final Field saturationLevel = ReflectionHelper.findField(FoodStats.class, "field_75125_b", "foodSaturationLevel"); @Override public void onWornTick(ItemStack itemstack, EntityLivingBase player) { if(player instanceof EntityPlayer) { EntityPlayer player1 = (EntityPlayer) player; FoodStats food = player1.getFoodStats(); if(player1.ticksExisted % 100 == 0) { food.setFoodLevel(20); if(food.getSaturationLevel() == 0) { try { saturationLevel.set(food, 10); } catch(IllegalAccessException e) { Log.error("Reflection on Player Saturation Level Failed"); e.printStackTrace(); } } } } } And it works. Idk if I'm catching the right thing now, that's one of the things the saturationLevel.set() throws, apparently. I'll need to test it outside of the dev workspace still, but I think it's functional now? Do I still have something wrong? Anything that needs to be changed?
  4. Okay, so this is what I did: public static final Field saturationLevel = ReflectionHelper.findField(FoodStats.class, "field_75125_b", "foodSaturationLevel"); @Override public void onWornTick(ItemStack itemstack, EntityLivingBase player) { if(player instanceof EntityPlayer) { EntityPlayer player1 = (EntityPlayer) player; FoodStats food = player1.getFoodStats(); if(player1.ticksExisted % 100 == 0) { food.setFoodLevel(20); try { saturationLevel.setAccessible(true); saturationLevel.set(player1, 10); } catch(Throwable e) { Log.warn("Reflection on Player Saturation Level Failed"); e.printStackTrace(); } } } } And to no one's surprise, it doesn't work, and instead just throws out the warning instead
  5. I can only find getSaturationLevel()'s SRG name, not setSaturationLevel()'s. That being field_71147_cj
  6. Ah. I... still have no idea how to do it x3
  7. According to those other sites, it's because Minecraft's code is obfuscated, so in the dev environment, it works fine, but when built, it apparently doesn't. Heck if I know, though.
  8. ReflectionHelper, not handler, sorry. And it was from other posts on this site for outdated versions, as well as on other sites for also outdated versions. And also on MDC, from UpcraftLP. And, in general, I have no idea how to do reflections in any form. Up until an hour ago, I didn't even know such a thing existed.
  9. According to literally everything I could find about doing reflections in modding, regular Java reflections don't work. Instead, you have to use the ReflectionHandler, which I've got no idea how to use...
  10. Okay, well, how would I go about the reflection for the saturation?
  11. Yes I can: https://pastebin.com/Z905PT6n And on MDC, since apparently getFoodStats() is client side only.
  12. So, I did this: @Override public void onWornTick(ItemStack itemstack, EntityLivingBase player) { if(player instanceof EntityPlayer) { EntityPlayer player1 = (EntityPlayer) player; FoodStats food = player1.getFoodStats(); if(player1.ticksExisted % 100 == 0) { food.setFoodLevel(20); if(food.getSaturationLevel() == 0) { food.setFoodSaturationLevel(10); } } } } But on servers, it causes some problems, such as making the player unable to log back in, unless their playerdata is deleted. Apparently, I need to do reflection to make it work on a server? How would I go about that?
  13. Well... I got a new result. Pressing F5 causes a new crash (I'm following Mekanism's example). Edit: Never mind, I loaded a new world, and it works. Mekanism, you are my lord and savior! (and thank you, Cadiboo)
  14. Gonna say this right here, right now, I have no idea what the fuck I'm doing. No matter what method I use, whether it be Brandon's (Draconic Evo guy), the Twilight Forest group's, CJMinecraft's, Subaraki's, Champion Ash5357's, or the Construct Armory guy's, it either ends in the game crashing before it begins, or in the model just not showing up, most of the time, the latter. This is the code I'm currently working with, but hey, if you know a better method, please, do tell: https://github.com/CammiePone/Voidaic-Arcania/tree/master/src/main/java/com/camellias/voidaicarcania/items/armour
  15. Okay.... so yes, I was wrong, but now clicking on the block causes you to hard crash. I got upset, and I apologize. I really shouldn't have. I just _really_ hate having to make changes like this to blocks with tile entities, as normally they just break entirely, which this moment kind of reinforced just then. Other than the IItemHandler bit and the changing of the BURNING variable (which I wasn't done with, I was just trying to solve this problem first), I've done all that was in there. Reason for not doing the IItemHandler bit is because I don't understand jackshit when it comes to that. I work better with seeing examples, tearing them down, and analyzing them. It's entirely possible that's the reason it's crashing, but I have no idea how to fix it (and yes, I did read the information provided on it, it only left me more confused). I've gone ahead and updated the code, but I have to go for the night. Again, I'm really sorry for lashing out like I had..
  16. You know what? Fuck it. I've been here before, I've only ever gotten shit, and only once ever gotten assistance with the problem I've been having. I'm this close to just saying fuck it to the rotation, and changing the model all together so that rotation isn't an issue. Unlike this shitshow, MDC and MMD both at least try and help with the problems you're currently trying to solve, not point out other ones that you might have, that aren't causing any problems in the current.
  17. See, the thing is... I don't know why either, hence why I'm here. I tried everything I know how to do, and it just does. And again, I said "few hours to make all of those changes to one of them, and test it to make sure it didn't break anything at all". There's more than just changing things, I want to make sure everything works under every condition in which it should work. I don't want to end up releasing a bug-riddled mod, after patching so many since the last release. Unless there's irrefutable proof that those steps would fix this whole problem, I don't want to spend the time messing with it at the moment. That, or have proof that it's related to this problem.
  18. It would take me a few hours to make all of those changes to one of them, and test it to make sure it didn't break anything at all, especially in the case of one of them, which has been problematic from the beginning up until recently, but I'm fairly certain that they wouldn't affect the desynchronization between the server and the client when the block has the ability to rotate.
  19. Maybe so, but I came here looking for a solution to this problem specifically. If I find other problems later on, I'll come back here and debate on whether or not to rewrite 3 tile entities and blocks. I didn't finish the BURNING bit, as I haven't gotten the rotation issue functioning properly, which is my number one concern right now. And while, yes, I do appreciate them trying to assist in a potential issue later down the line, I'd rather fix the one right in front of my face.
  20. Except, in reference to 4 and 5, as well as 10, the tile entity isn't the issue. Nor is it the BURNING property. There exist 2 other tile entities, both of which work flawlessly, and act similarly, code-wise, to this one. It's the rotation that's screwing it up.
  21. Okay, so, for whatever reason, the rotation on my block causes it to desync with the server when broken. I know it's the rotation, as I commented all of it out, ran it, and it was perfectly okay. Any ideas as to how to fix this? I've tried copying from the furnace class, extending the furnace class, following a tutorial on block rotations. All of it led to the same desyncing problem. Code is right here:
  22. I figured it out the day I posted it. And I had done that, for multiple different mods. Eventually, I remembered that there was one mod with only Baubles as a dependency, and used it.
×
×
  • Create New...

Important Information

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