HyCodeYourTale
classpublicPriority 3

NoiseOperation

com.hypixel.hytale.builtin.buildertools.tooloperations.NoiseOperation

extends ToolOperation

0

Methods

0

Public Methods

0

Fields

1

Constructors

Constructors

public
NoiseOperation(Ref<EntityStore> ref, Player player, BuilderToolOnUseInteraction packet, ComponentAccessor<EntityStore> componentAccessor)

Inheritance

Parent
Current
Interface
Child

Use mouse wheel to zoom, drag to pan. Click nodes to navigate.

Related Classes

Source Code

package com.hypixel.hytale.builtin.buildertools.tooloperations;

import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.protocol.packets.buildertools.BuilderToolOnUseInteraction;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;

public class NoiseOperation extends ToolOperation {
   private final int brushDensity = this.getBrushDensity();

   public NoiseOperation(
      @Nonnull Ref<EntityStore> ref,
      @Nonnull Player player,
      @Nonnull BuilderToolOnUseInteraction packet,
      @Nonnull ComponentAccessor<EntityStore> componentAccessor
   ) {
      super(ref, packet, componentAccessor);
   }

   @Override
   boolean execute0(int x, int y, int z) {
      int currentBlock = this.edit.getBlock(x, y, z);
      if (currentBlock <= 0 && this.builderState.isAsideBlock(this.edit.getAccessor(), x, y, z) && this.random.nextInt(100) <= this.brushDensity) {
         this.edit.setBlock(x, y, z, this.pattern.nextBlock(this.random));
      }

      return true;
   }
}