Jump to content

[1.16.5] Custum Fluid null error (solved)


reasure

Recommended Posts

public class ModFluids {
    public static final ResourceLocation RUBBER_STILL_RL = new ResourceRocation(ReasureCraft.MOD_ID, "block/rubber_still"));
    public static final ResourceLocation RUBBER_FLOWING_RL = new ResourceRocation(ReasureCraft.MOD_ID, "block/rubber_flowing");
    public static final ResourceLocation RUBBER_OVERLAY_RL = new ResourceRocation(ReasureCraft.MOD_ID, "block/rubber_overlay");

    public static final ForgeFlowingFluid.Properties RUBBER_PROPERTIES = new ForgeFlowingFluid.Properties(ModFluids.RUBBER, ModFluids.RUBBER_FLOWING,
            FluidAttributes.builder(RUBBER_STILL_RL, RUBBER_FLOWING_RL).density(5).luminosity(10).rarity(Rarity.RARE).sound(SoundEvents.HONEY_DRINK)
                    .overlay(RUBBER_OVERLAY_RL)).block(ModBlocks.RUBBER).bucket(ModItems.RUBBER_BUCKET).explosionResistance(100.0f);

    public static final RegistryObject<FlowingFluid> RUBBER = register("rubber_fluid", () -> new ForgeFlowingFluid.Source(ModFluids.RUBBER_PROPERTIES));
    public static final RegistryObject<FlowingFluid> RUBBER_FLOWING = register("rubber_flowing", () -> new ForgeFlowingFluid.Flowing(ModFluids.RUBBER_PROPERTIES));

    private ModFluids() {
    }

    private static <T extends Fluid> RegistryObject<T> register(String name, Supplier<T> item) {
        return Registration.FLUIDS.register(name, item);
    }

    static void register() {
    }
}

and Registraion.FLUIDS: 

public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, ReasureCraft.MOD_ID);

and Rubber Block:

public static final RegistryObject<FlowingFluidBlock> RUBBER = register("rubber",
            () -> new FlowingFluidBlock(ModFluids.RUBBER, AbstractBlock.Properties.of(Material.WATER).noCollission().randomTicks().strength(100.0F).noDrops()));

and Rubber Bucket:

public static final RegistryObject<BucketItem> RUBBER_BUCKET = register("rubber_bucket", () ->
            new BucketItem(ModFluids.RUBBER, defaultProperties().stacksTo(1).craftRemainder(Items.BUCKET)));

 

and When I use Rubber Bucket, it throw error

Spoiler



[13:35:51] [Server thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Server
java.lang.NullPointerException: null
	at net.minecraftforge.fluids.ForgeFlowingFluid.getSource(ForgeFlowingFluid.java:81) ~[forge:?] {re:classloading}
	at net.minecraft.fluid.FlowingFluid.getSource(FlowingFluid.java:231) ~[forge:?] {re:classloading}
	at net.minecraft.block.FlowingFluidBlock.initFluidStateCache(FlowingFluidBlock.java:181) ~[forge:?] {re:classloading,pl:accesstransformer:B,xf:fml:forge:flowingfluidblock}
	at net.minecraft.block.FlowingFluidBlock.getFluidState(FlowingFluidBlock.java:86) ~[forge:?] {re:classloading,pl:accesstransformer:B,xf:fml:forge:flowingfluidblock}
	at net.minecraft.block.AbstractBlock$AbstractBlockState.getFluidState(AbstractBlock.java:698) ~[forge:?] {re:classloading}
	at net.minecraft.world.chunk.ChunkSection.setBlockState(SourceFile:66) ~[forge:?] {re:classloading}
	at net.minecraft.world.chunk.ChunkSection.setBlockState(SourceFile:55) ~[forge:?] {re:classloading}
	at net.minecraft.world.chunk.Chunk.setBlockState(Chunk.java:251) ~[forge:?] {re:classloading}
	at net.minecraft.world.World.setBlock(World.java:199) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.World.setBlock(World.java:176) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.item.BucketItem.emptyBucket(BucketItem.java:146) ~[forge:?] {re:classloading,xf:fml:forge:bucketitem}
	at net.minecraft.item.BucketItem.use(BucketItem.java:90) ~[forge:?] {re:classloading,xf:fml:forge:bucketitem}
	at net.minecraft.item.ItemStack.use(ItemStack.java:217) ~[forge:?] {re:classloading,xf:fml:forge:filled_map.4,xf:fml:forge:itemstack}
	at net.minecraft.server.management.PlayerInteractionManager.useItem(PlayerInteractionManager.java:287) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.handleUseItem(ServerPlayNetHandler.java:982) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.client.CPlayerTryUseItemPacket.handle(SourceFile:31) ~[forge:?] {re:classloading}
	at net.minecraft.network.play.client.CPlayerTryUseItemPacket.handle(SourceFile:9) ~[forge:?] {re:classloading}
	at net.minecraft.network.PacketThreadUtil.lambda$ensureRunningOnSameThread$0(SourceFile:21) ~[forge:?] {re:classloading}
	at net.minecraft.util.concurrent.TickDelayedTask.run(SourceFile:18) ~[forge:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.doRunTask(SourceFile:144) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.RecursiveEventLoop.doRunTask(SourceFile:23) ~[forge:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:734) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:159) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.pollTask(SourceFile:118) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:717) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:711) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.managedBlock(SourceFile:127) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:697) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:646) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:232) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_281] {}
[13:35:51] [Render thread/FATAL] [ne.mi.co.ForgeMod/]: Preparing crash report with UUID be8cc99f-7810-4a97-aa01-64f15a2034e2
[13:35:51] [Server thread/FATAL] [ne.mi.co.ForgeMod/]: Preparing crash report with UUID 188ee2e7-342c-44d5-b80b-333b0563c9a0
[13:35:51] [Render thread/FATAL] [minecraft/Minecraft]: Unreported exception thrown!
java.lang.NullPointerException: null
	at net.minecraftforge.fluids.ForgeFlowingFluid.getSource(ForgeFlowingFluid.java:81) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading}
	at net.minecraft.fluid.FlowingFluid.getSource(FlowingFluid.java:231) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading}
	at net.minecraft.block.FlowingFluidBlock.initFluidStateCache(FlowingFluidBlock.java:181) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B,xf:fml:forge:flowingfluidblock}
	at net.minecraft.block.FlowingFluidBlock.getFluidState(FlowingFluidBlock.java:86) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B,xf:fml:forge:flowingfluidblock}
	at net.minecraft.block.AbstractBlock$AbstractBlockState.getFluidState(AbstractBlock.java:698) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading}
	at net.minecraft.world.chunk.ChunkSection.setBlockState(SourceFile:66) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading}
	at net.minecraft.world.chunk.ChunkSection.setBlockState(SourceFile:55) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading}
	at net.minecraft.world.chunk.Chunk.setBlockState(Chunk.java:251) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading}
	at net.minecraft.world.World.setBlock(World.java:199) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.World.setBlock(World.java:176) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.item.BucketItem.emptyBucket(BucketItem.java:146) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,xf:fml:forge:bucketitem}
	at net.minecraft.item.BucketItem.use(BucketItem.java:90) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,xf:fml:forge:bucketitem}
	at net.minecraft.item.ItemStack.use(ItemStack.java:217) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,xf:fml:forge:filled_map.4,xf:fml:forge:itemstack}
	at net.minecraft.client.multiplayer.PlayerController.useItem(PlayerController.java:328) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.startUseItem(Minecraft.java:1389) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.handleKeybinds(Minecraft.java:1645) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.tick(Minecraft.java:1460) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:953) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:607) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_281] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_281] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_281] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_281] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.2_mapped_official_1.16.5.jar:?] {}
[13:35:52] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.crash.ReportedException: Getting fluid state
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:137) ~[forge:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:865) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:787) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.tickServer(IntegratedServer.java:78) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:642) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:232) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_281] {}
Caused by: java.lang.NullPointerException
	at net.minecraftforge.fluids.ForgeFlowingFluid.getSource(ForgeFlowingFluid.java:81) ~[forge:?] {re:classloading}
	at net.minecraft.fluid.FlowingFluid.getSource(FlowingFluid.java:231) ~[forge:?] {re:classloading}
	at net.minecraft.block.FlowingFluidBlock.initFluidStateCache(FlowingFluidBlock.java:181) ~[forge:?] {re:classloading,pl:accesstransformer:B,xf:fml:forge:flowingfluidblock}
	at net.minecraft.block.FlowingFluidBlock.getFluidState(FlowingFluidBlock.java:86) ~[forge:?] {re:classloading,pl:accesstransformer:B,xf:fml:forge:flowingfluidblock}
	at net.minecraft.block.AbstractBlock$AbstractBlockState.getFluidState(AbstractBlock.java:698) ~[forge:?] {re:classloading}
	at net.minecraft.world.chunk.ChunkSection.getFluidState(SourceFile:43) ~[forge:?] {re:classloading}
	at net.minecraft.world.chunk.Chunk.getFluidState(Chunk.java:220) ~[forge:?] {re:classloading}
	at net.minecraft.world.chunk.Chunk.getFluidState(Chunk.java:212) ~[forge:?] {re:classloading}
	at net.minecraft.world.World.getFluidState(World.java:389) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.Entity.updateFluidHeightAndDoFluidPushing(Entity.java:2698) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.Entity.updateInWaterStateAndDoWaterCurrentPushing(Entity.java:986) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.Entity.updateInWaterStateAndDoFluidPushing(Entity.java:977) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.Entity.baseTick(Entity.java:407) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.baseTick(LivingEntity.java:295) ~[forge:?] {re:classloading}
	at net.minecraft.entity.Entity.tick(Entity.java:386) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2113) ~[forge:?] {re:classloading}
	at net.minecraft.entity.player.PlayerEntity.tick(PlayerEntity.java:223) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.entity.player.ServerPlayerEntity.doTick(ServerPlayerEntity.java:404) ~[forge:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.network.play.ServerPlayNetHandler.tick(ServerPlayNetHandler.java:207) ~[forge:?] {re:classloading}
	at net.minecraft.network.NetworkManager.tick(NetworkManager.java:226) ~[forge:?] {re:classloading}
	at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:134) ~[forge:?] {re:classloading}
	... 6 more

Process finished with exit code -805306369 (0xCFFFFFFF)

 

What is problem?

Edited by reasure
Link to comment
Share on other sites

  • reasure changed the title to [1.16.5] Custum Fluid null error (solved)

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

    • This is now replaced in the latest version, under Advanced Settings. Not available under the registry anymore.
    • You have to set the java path in your start script
    • i tried that and i got rid of java to install the new one but it still says i have the old one and i cant get the new one because of the old one  
    • I created a boss for Minecraft and when is it called «An unexpected error occurred while trying to run this command» "net.minecraft.world.entity.ai.attributes.attribute instance.m_22100_ (double)" because the return value "net.minecraft.world.entity.monster.zombie.m_21051_(net.minecraft.world.entity.ai.attributes.attribute)" is null. I don't fully understand what the error is. But it seems to be related to attributes. Please help me figure it out   Here is the boss class itself: package org.mymod.afraid; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.phys.Vec3; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.entity.projectile.SmallFireball; import org.jetbrains.annotations.NotNull; public class AfraidBoss extends Zombie { private static final int MAX_HEALTH = 1000; private static final double ATTACK_DAMAGE = 10.0D; private static final double FOLLOW_RANGE = 50.0D; private static final double ATTACK_KNOCKBACK = 1.0D; private static final double MOVEMENT_SPEED = 0.25D; private static final int TELEPORT_RADIUS = 20; private static final int FIREBALL_COOLDOWN = 100; // 5 seconds (20 ticks per second) private static final int FIREBALL_COUNT = 3; private int fireballCooldown = 0; private int fireDashCooldown = 0; public AfraidBoss(EntityType<? extends Zombie> type, Level level) { super(type, level); this.setHealth(MAX_HEALTH); this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.DIAMOND_SWORD)); this.setItemSlot(EquipmentSlot.OFFHAND, new ItemStack(Items.DIAMOND_SWORD)); } @Override protected void registerGoals() { this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0, true)); this.goalSelector.addGoal(2, new MoveTowardsTargetGoal(this, 1.0, (float) TELEPORT_RADIUS)); this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 8.0F)); this.goalSelector.addGoal(4, new WaterAvoidingRandomStrollGoal(this, 1.0)); this.goalSelector.addGoal(5, new HurtByTargetGoal(this)); this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Player.class, true)); } @Override public void aiStep() { super.aiStep(); if (this.getTarget() instanceof Player) { Player player = (Player) this.getTarget(); double distanceToPlayer = this.distanceToSqr(player); // Fire Dash ability if (distanceToPlayer <= TELEPORT_RADIUS * TELEPORT_RADIUS && fireDashCooldown == 0) { this.fireDash(player); fireDashCooldown = 200; // Cooldown for fire dash (10 seconds) } // Fireball attack if (fireballCooldown == 0) { this.shootFireballs(player); fireballCooldown = FIREBALL_COOLDOWN; // Cooldown for fireball attack (5 seconds) } // Decrement cooldowns if (fireDashCooldown > 0) { fireDashCooldown--; } if (fireballCooldown > 0) { fireballCooldown--; } } } private void fireDash(Player player) { Vec3 direction = player.position().subtract(this.position()).normalize(); Vec3 newPos = this.position().add(direction.scale(10)); this.teleportTo(newPos.x, newPos.y, newPos.z); this.createFireTrail(newPos); player.hurt(DamageSource.mobAttack(this), 20.0F); // Damage the player } private void createFireTrail(Vec3 position) { for (int x = -2; x <= 2; x++) { for (int z = -2; z <= 2; z++) { BlockPos firePos = new BlockPos(position.x + x, position.y, position.z + z); this.level.setBlock(firePos, Blocks.FIRE.defaultBlockState(), 11); } } } private void shootFireballs(Player player) { Vec3 direction = player.position().subtract(this.position()).normalize(); for (int i = 0; i < FIREBALL_COUNT; i++) { SmallFireball fireball = new SmallFireball(this.level, this, direction.x, direction.y, direction.z); fireball.setPos(this.getX() + direction.x, this.getY() + direction.y, this.getZ() + direction.z); this.level.addFreshEntity(fireball); } } public static AttributeSupplier.Builder createAttributes() { return Zombie.createMobAttributes() .add(Attributes.MAX_HEALTH, MAX_HEALTH) .add(Attributes.ATTACK_DAMAGE, ATTACK_DAMAGE) .add(Attributes.FOLLOW_RANGE, FOLLOW_RANGE) .add(Attributes.ATTACK_KNOCKBACK, ATTACK_KNOCKBACK) .add(Attributes.MOVEMENT_SPEED, MOVEMENT_SPEED); } @Override public boolean hurt(@NotNull DamageSource source, float amount) { boolean flag = super.hurt(source, amount); if (flag && source.getEntity() instanceof Player) { Player player = (Player) source.getEntity(); if (this.random.nextInt(10) == 0) { this.teleportAndAttack(player); } } return flag; } private void teleportAndAttack(Player player) { Vec3 randomPos = player.position().add((this.random.nextDouble() - 0.5) * 4, 0, (this.random.nextDouble() - 0.5) * 4); if (this.randomTeleport(randomPos.x, randomPos.y, randomPos.z, true)) { player.hurt(DamageSource.mobAttack(this), 10.0F); // Damage the player } } }  
  • Topics

×
×
  • Create New...

Important Information

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