Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

BlockyPenguin

Members
  • Content Count

    133
  • Joined

  • Last visited

Community Reputation

4 Neutral

About BlockyPenguin

  • Rank
    Creeper Killer

Converted

  • URL
    https://pixelorangedev.github.io
  • Location
    United Kingdom
  • Personal Text
    https://www.discord.gg/XmSZGjn

Recent Profile Visitors

2102 profile views
  1. Okay, so what would I set the seed to? I already have a public static final Random instance in my main class, would that do the job?
  2. That's strange, because I'm definitely calling it on a World object, unless World implements IWorldReader. So this is what I've got: @Override public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) { IChunk ichunk = world.getChunk(player.getPosition()); if(ichunk instanceof Chunk) { Chunk chunk = (Chunk)ichunk; long seed = MathHelper.getCoordinateRandom(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ()); seed += chunk.getInhabitedTime() * Config.RIFT_MULTIPLICATION_FACTOR.get(); player.
  3. Okay, thanks Here is the source code of World#getChunk: default IChunk getChunk(BlockPos pos) { return this.getChunk(pos.getX() >> 4, pos.getZ() >> 4); } So what do you suggest I do then?
  4. Because World#getChunk() returns an IChunk. Ah, thanks. TBH, I'm a little concerned about changing over to Mojang mappings, I know there are a few legality issues still. What would be the right place to ask about this?
  5. Okay, so, let's say that I want to get this data when an item is right clicked, it would be something like this, right? @Override public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); Chunk c = (Chunk)world.getChunk(player.getPosition()); c.getInhabitedTime(); return ActionResult.resultSuccess(stack); } But MathHelper.getSeed doesn't seem to exist...
  6. Okay... so how would i get the chunk then? Would it help if i uploaded my code to github?
  7. But wouldn't it be incremented at a different rate? I think I forgot to mention as well, that I have the float set to a random value between 0.0 and 0.2 in the capability's default implementation's constructor.
  8. Okay, I'm thinking we're not quite on the same page here, so I'll start again: I've made a capability for chunks, which contains a float value. I would like the float to increase by 0.1 every x amount of time. My thought is that if I get all the loaded chunks, I can iterate over them and increase this value. As to how I would implement a timer without a tick() method, I am at a loss, but one problem at a time.
  9. Yes, but how do I get the instance of Chunk? That's what's confusing me...
  10. Oh, ok... but my question still remains as to how to get the inhabited time.
  11. So this is my capability: public class RiftCapability implements IRift { private boolean isRift; private float riftActivityPercent; public RiftCapability() { this.isRift = Rifts.RAND.nextInt(100) < 5; this.riftActivityPercent = isRift ? Utils.randomFloatBounds(0.15f) : 0.0f; } public RiftCapability(boolean isRift, float riftActivityPercent) { this.isRift = isRift; this.riftActivityPercent = riftActivityPercent; } @Override public boolean isRift() { return isRift; } @Override public float getRiftActivityPercent() { return riftActivityPercent; } @Override
  12. So, my capability has a getter for the float, yes, but how would I get the instance of Chunk?
  13. Thanks, I think I'll use Chunk#getInhabitedTime. Where should I put my code though? Is there an event or something?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.