Jump to content

Recommended Posts

Posted

When updating to 1.6.2, an old variable I used to use was changed from public to private, landSpeedFactor. Hopefully I wold be able to use reflection to modify it accordingly, but I can't seem to get it to work.

 


if(player.inventory.hasItem(mod_rareores.ItemEmblemFlight.itemID)){
		landMovementFactor = landMovementFactor > 0.001F ? landMovementFactor : (Float)ObfuscationReflectionHelper.getPrivateValue(EntityLivingBase.class, player, "landMovementFactor", "field_70746_aG");
		landMovementFactor *=1.45;
		ObfuscationReflectionHelper.setPrivateValue(EntityLivingBase.class, player,landMovementFactor ,"landMovementFactor", "field_70746_aG");
		player.jumpMovementFactor *=1.45;
		System.out.println(landMovementFactor);

	}

 

The above code is what I did from what I know, I asked around on the IRC and everyone said they couldn't find a problem. Help is appreciated, thanks in advance! :)

 

~Noah

This is the creator of the Rareores mod! Be sure to check it out at

Posted

That in a coremod? If not that may be your problem.

 

What? I don't get what you are saying, please explain?

This is the creator of the Rareores mod! Be sure to check it out at

Posted

Anyone know how to deal with a reflection problem as such? I haven't been able to figure much out and this is the only thing preventing me from updating to 1.6.2.

 

And NO, no speed potion effect, I MUST use landMovementFactor solely because the code is ran each tick and other variables would be multiplied exponentially high because they are not reset every tick, however landmovementfactor does and it makes for a perfect variable to work with since it increases speed exactly the way you need it.

This is the creator of the Rareores mod! Be sure to check it out at

  • 3 weeks later...
Posted

I was messing around in the code and I don't think that movement uses that variable anymore. With the new attribute system it uses attribute modifiers. I just edited the entityplayer base class as I have changed it a bit already due to the fact it adds in a whole new system.

Posted

If you are wondering the reflction was working, but the attribute system is giving me a few crude issues that I want to iron out.

This is the creator of the Rareores mod! Be sure to check it out at

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello , when I try to launch the forge installer it just crash with a message for 0,5 secondes. I'm using java 17 to launch it. Here's the link of the error :https://cdn.corenexis.com/view/?img=d/ma24/qs7u4U.jpg  
    • You will find the crash-report or log in your minecraft directory (crash-report or logs folder)
    • Use a modpack which is using these 2 mods as working base:   https://www.curseforge.com/minecraft/modpacks/life-in-the-village-3
    • inicie un mundo donde instale Croptopia y Farmer's Delight, entonces instale el addon Croptopia Delight pero no funciona. es la version 1.18.2
    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
  • Topics

×
×
  • Create New...

Important Information

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