Class OrganicSpread
java.lang.Object
org.cyclops.evilcraft.core.algorithm.OrganicSpread
An algorithm that is able to organically spread an object in an area.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for organically spreadable things. -
Constructor Summary
ConstructorsConstructorDescriptionOrganicSpread(net.minecraft.world.level.Level world, int dimensions, int radius, OrganicSpread.IOrganicSpreadable spreadable) Make a new instance. -
Method Summary
Modifier and TypeMethodDescriptionintintprotected net.minecraft.world.phys.Vec3Get a random direction to spread in.protected booleanisBigEnough(net.minecraft.world.phys.Vec3 direction) protected booleanisInArea(net.minecraft.core.BlockPos center, net.minecraft.core.BlockPos location) voidsetDimensions(int dimensions) voidsetRadius(int radius) voidsetSpreadable(OrganicSpread.IOrganicSpreadable spreadable) voidspreadTick(net.minecraft.core.BlockPos startLocation) Perform one spreading tick so that one new blockState will be spread to.
-
Constructor Details
-
OrganicSpread
public OrganicSpread(net.minecraft.world.level.Level world, int dimensions, int radius, OrganicSpread.IOrganicSpreadable spreadable) Make a new instance.- Parameters:
world- The world.dimensions- The amount of dimensions in which this spreading should happen.radius- The radius in which the spreading should happen.spreadable- The spreadable object.
-
-
Method Details
-
getRadius
public int getRadius()- Returns:
- the radius
-
setRadius
public void setRadius(int radius) - Parameters:
radius- the radius to set
-
getDimensions
public int getDimensions()- Returns:
- the dimensions
-
setDimensions
public void setDimensions(int dimensions) - Parameters:
dimensions- the dimensions to set.
-
getSpreadable
- Returns:
- the spreadable
-
setSpreadable
- Parameters:
spreadable- the spreadable to set
-
spreadTick
public void spreadTick(net.minecraft.core.BlockPos startLocation) Perform one spreading tick so that one new blockState will be spread to.- Parameters:
startLocation- The location to start spreading from.
-
isInArea
protected boolean isInArea(net.minecraft.core.BlockPos center, net.minecraft.core.BlockPos location) -
isBigEnough
protected boolean isBigEnough(net.minecraft.world.phys.Vec3 direction) -
getRandomDirection
protected net.minecraft.world.phys.Vec3 getRandomDirection()Get a random direction to spread in.- Returns:
- An array of a choice of -1;0;1 per coordinate index.
-