| 1 | package net.minecraft.world.gen;
|
| 2 |
|
| 3 | import net.minecraft.block.Block;
|
| 4 | import net.minecraft.block.state.IBlockState;
|
| 5 | import net.minecraft.util.ResourceLocation;
|
| 6 |
|
| 7 | public class FlatLayerInfo
|
| 8 | {
|
| 9 | private final int field_175902_a;
|
| 10 | private IBlockState layerMaterial;
|
| 11 |
|
| 12 | /** Amount of layers for this set of layers. */
|
| 13 | private int layerCount;
|
| 14 | private int layerMinimumY;
|
| 15 |
|
| 16 | public FlatLayerInfo(int p_i45467_1_, Block p_i45467_2_)
|
| 17 | {
|
| 18 | this(3, p_i45467_1_, p_i45467_2_);
|
| 19 | }
|
| 20 |
|
| 21 | public FlatLayerInfo(int p_i45627_1_, int height, Block layerMaterialIn)
|
| 22 | {
|
| 23 | this.layerCount = 1;
|
| 24 | this.field_175902_a = p_i45627_1_;
|
| 25 | this.layerCount = height;
|
| 26 | this.layerMaterial = layerMaterialIn.getDefaultState();
|
| 27 | }
|
| 28 |
|
| 29 | public FlatLayerInfo(int p_i45628_1_, int p_i45628_2_, Block p_i45628_3_, int p_i45628_4_)
|
| 30 | {
|
| 31 | this(p_i45628_1_, p_i45628_2_, p_i45628_3_);
|
| 32 | this.layerMaterial = p_i45628_3_.getStateFromMeta(p_i45628_4_);
|
| 33 | }
|
| 34 |
|
| 35 | /**
|
| 36 | * Return the amount of layers for this set of layers.
|
| 37 | */
|
| 38 | public int getLayerCount()
|
| 39 | {
|
| 40 | return this.layerCount;
|
| 41 | }
|
| 42 |
|
| 43 | public IBlockState getLayerMaterial()
|
| 44 | {
|
| 45 | return this.layerMaterial;
|
| 46 | }
|
| 47 |
|
| 48 | private Block getLayerMaterialBlock()
|
| 49 | {
|
| 50 | return this.layerMaterial.getBlock();
|
| 51 | }
|
| 52 |
|
| 53 | /**
|
| 54 | * Return the block metadata used on this set of layers.
|
| 55 | */
|
| 56 | private int getFillBlockMeta()
|
| 57 | {
|
| 58 | return this.layerMaterial.getBlock().getMetaFromState(this.layerMaterial);
|
| 59 | }
|
| 60 |
|
| 61 | /**
|
| 62 | * Return the minimum Y coordinate for this layer, set during generation.
|
| 63 | */
|
| 64 | public int getMinY()
|
| 65 | {
|
| 66 | return this.layerMinimumY;
|
| 67 | }
|
| 68 |
|
| 69 | /**
|
| 70 | * Set the minimum Y coordinate for this layer.
|
| 71 | */
|
| 72 | public void setMinY(int minY)
|
| 73 | {
|
| 74 | this.layerMinimumY = minY;
|
| 75 | }
|
| 76 |
|
| 77 | public String toString()
|
| 78 | {
|
| 79 | String s;
|
| 80 |
|
| 81 | if (this.field_175902_a >= 3)
|
| 82 | {
|
| 83 | ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.getLayerMaterialBlock());
|
| 84 | s = resourcelocation == null ? "null" : resourcelocation.toString();
|
| 85 |
|
| 86 | if (this.layerCount > 1)
|
| 87 | {
|
| 88 | s = this.layerCount + "*" + s;
|
| 89 | }
|
| 90 | }
|
| 91 | else
|
| 92 | {
|
| 93 | s = Integer.toString(Block.getIdFromBlock(this.getLayerMaterialBlock()));
|
| 94 |
|
| 95 | if (this.layerCount > 1)
|
| 96 | {
|
| 97 | s = this.layerCount + "x" + s;
|
| 98 | }
|
| 99 | }
|
| 100 |
|
| 101 | int i = this.getFillBlockMeta();
|
| 102 |
|
| 103 | if (i > 0)
|
| 104 | {
|
| 105 | s = s + ":" + i;
|
| 106 | }
|
| 107 |
|
| 108 | return s;
|
| 109 | }
|
| 110 | }
|
| 111 |
|