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


  • Posts

  • Joined

  • Last visited


  • URL
  • Location
    United Kingdom
  • Personal Text

Recent Profile Visitors

2317 profile views

BlockyPenguin's Achievements

Creeper Killer

Creeper Killer (4/8)



  1. Modifying vanilla with Mixins, no Forge, no Fabric, just plain old vanilla. I know, it's not recommended, but it's a personal project of mine, just to see where it could lead. I have no intentions of making anything fancy, i.e. "real" modified servers like paper or sponge, it's more of a testing ground. Any ideas as to how to fix this?
  2. I'm attempting to use FG to download the vanilla Minecraft server. Gradle throws this massive error: hastebin build.gradle:
  3. 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?
  4. 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.sendStatusMessage(new StringTextComponent(seed + ""), false); } return ActionResult.resultSuccess(player.getHeldItem(hand)); } But how would I turn that into value between 0 and 1? or at least 0 and 100, or some other easily measurable number. Then I've also got to worry about the boolean dictating whether or not a chunk is a rift or not.
  5. 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?
  6. 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?
  7. 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...
  8. Okay... so how would i get the chunk then? Would it help if i uploaded my code to github?
  9. 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.
  10. 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.
  11. Yes, but how do I get the instance of Chunk? That's what's confusing me...
  12. Oh, ok... but my question still remains as to how to get the inhabited time.
  13. 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 public void setRiftActivityPercent(float riftActivityPercent) { if(riftActivityPercent < 0 || riftActivityPercent > 1) throw new IndexOutOfBoundsException("Rift Activity Percent cannot be less than 0 or greater than 1!"); else this.riftActivityPercent = riftActivityPercent; } @Override public void openRift() { this.isRift = true; } @Override public void closeRift() { this.isRift = false; } @Override public void riftEvent() { //TODO: Fire a rift event. } } This is my provider: public class RiftCapabilityProvider implements ICapabilitySerializable<INBT> { @CapabilityInject(IRift.class) public static final Capability<IRift> RIFT_CAPABILITY = null; private LazyOptional<IRift> instance = LazyOptional.of(RIFT_CAPABILITY::getDefaultInstance); @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return cap == RIFT_CAPABILITY ? instance.cast() : LazyOptional.empty(); } @Override public INBT serializeNBT() { return RIFT_CAPABILITY.getStorage().writeNBT( RIFT_CAPABILITY, instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")), null ); } @Override public void deserializeNBT(INBT nbt) { RIFT_CAPABILITY.getStorage().readNBT( RIFT_CAPABILITY, instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")), null, nbt ); } } And I attach it like so: public static void attachRiftCapability(AttachCapabilitiesEvent<Chunk> event) { World world = event.getObject().getWorld(); if(!world.isRemote) event.addCapability(new ResourceLocation(Rifts.MODID, "rift_capability"), new RiftCapabilityProvider()); } Does this help?
  • Create New...

Important Information

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