Package Hexel.blocks

Source Code of Hexel.blocks.BlockRules

package Hexel.blocks;

import java.util.ArrayList;

import Hexel.Engine;
import Hexel.Hexel;
import Hexel.blocks.rules.GrassGrowRule;
import Hexel.blocks.rules.GrassKillRule;
import Hexel.blocks.rules.HealRule;
import Hexel.blocks.rules.NaturalLightRule;
import Hexel.blocks.rules.SeedRule;
import Hexel.blocks.rules.SpawnRules;
import Hexel.blocks.rules.TreeRules;
import Hexel.blocks.rules.WatermoveRule;
import Hexel.blocks.types.Block;
import Hexel.blocks.types.BlockDirt;
import Hexel.blocks.types.BlockEmpty;
import Hexel.blocks.types.BlockLeaf;
import Hexel.blocks.types.BlockSeed;
import Hexel.blocks.types.BlockTransparent;
import Hexel.blocks.types.BlockWater;
import Hexel.blocks.types.BlockWood;
import Hexel.chunk.Chunk;
import Hexel.chunk.Chunks;
import Hexel.chunk.HighestBlockChunk;
import Hexel.math.HexGeometry;
import Hexel.math.Vector2d;
import Hexel.math.Vector2i;
import Hexel.math.Vector3d;
import Hexel.math.Vector3i;
import Hexel.things.types.Deer;
import Hexel.things.types.Wanderer;
import Hexel.things.types.Zombie;
import Hexel.util.Container;
import Hexel.util.Pair;

public class BlockRules {

  private Chunks chunks;
  private Engine engine;


  public static int freqRuleNextRun(int steps, int freq){
    return (freq - steps % freq) % freq;
  }

  ArrayList<BlockRule> everywhereRules = new ArrayList<BlockRule>();
  ArrayList<BlockRule> seedRules = new ArrayList<BlockRule>();
  ArrayList<BlockRule> woodRules = new ArrayList<BlockRule>();
  ArrayList<BlockRule> waterRules = new ArrayList<BlockRule>();
  ArrayList<BlockRule> dirtRules = new ArrayList<BlockRule>();
  ArrayList<BlockRule> leafRules = new ArrayList<BlockRule>();
  ArrayList<BlockRule> transparentRules = new ArrayList<BlockRule>();
  ArrayList<BlockRule> emptyRules = new ArrayList<BlockRule>();

  public BlockRules(final Engine engine, BlockSimulator.PointInSimRange inSimRange) {
    this.chunks = chunks;
    this.engine = engine;

    this.everywhereRules.add(new HealRule());
    this.transparentRules.add(new NaturalLightRule(inSimRange));

    this.seedRules.add(new SeedRule());
    TreeRules.addRules(this.woodRules, this.leafRules);
    this.waterRules.add(new WatermoveRule());
    this.dirtRules.add(new GrassGrowRule());
    this.dirtRules.add(new GrassKillRule());
   
    SpawnRules.addRules(engine, this.woodRules, this.dirtRules);

    this.waterRules.addAll(this.transparentRules);
    this.leafRules.addAll(this.transparentRules);
    this.emptyRules.addAll(this.transparentRules);

    this.dirtRules.addAll(this.everywhereRules);
    this.seedRules.addAll(this.everywhereRules);
    this.woodRules.addAll(this.everywhereRules);
    this.waterRules.addAll(this.everywhereRules);
    this.leafRules.addAll(this.everywhereRules);
    this.emptyRules.addAll(this.everywhereRules);
  }
}
TOP

Related Classes of Hexel.blocks.BlockRules

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.