Skip to content
Permalink
Browse files

Missed something: actually commiting things. Blame Intellij

  • Loading branch information
alcatrazEscapee committed Aug 13, 2018
1 parent c9679a2 commit 247ff484d167ef9233baecae521ec87496e0dd02
@@ -9,6 +9,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import javax.annotation.ParametersAreNonnullByDefault;

import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
@@ -25,12 +26,15 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import mcp.MethodsReturnNonnullByDefault;
import net.dries007.tfc.api.types.Rock;
import net.dries007.tfc.api.types.Tree;
import net.dries007.tfc.objects.blocks.stone.BlockRockVariant;
import net.dries007.tfc.objects.blocks.wood.BlockPlanksTFC;
import net.dries007.tfc.util.OreDictionaryHelper;

@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public abstract class BlockSlabTFC extends BlockSlab
{
public static final PropertyEnum<Variant> VARIANT = PropertyEnum.create("variant", Variant.class);
@@ -227,7 +231,7 @@ public Half(Rock rock, Rock.Type type)
doubleSlab.halfSlab = this;
halfSlab = this;
OreDictionaryHelper.register(this, "slab");
//OreDictionaryHelper.registerRockType(this, type, rock, "slab"); // todo: fix
OreDictionaryHelper.registerRockType(this, type, rock, "slab");
}

public Half(Tree wood)
@@ -9,6 +9,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import javax.annotation.ParametersAreNonnullByDefault;

import net.minecraft.block.*;
import net.minecraft.block.state.IBlockState;
@@ -25,13 +26,17 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import mcp.MethodsReturnNonnullByDefault;
import net.dries007.tfc.api.types.Rock;
import net.dries007.tfc.objects.blocks.BlocksTFC;
import net.dries007.tfc.objects.entity.EntityFallingBlockTFC;
import net.dries007.tfc.objects.items.rock.ItemRock;
import net.dries007.tfc.util.Helpers;
import net.dries007.tfc.util.IFallingBlock;
import net.dries007.tfc.util.OreDictionaryHelper;

@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public class BlockRockVariant extends Block implements IFallingBlock
{
private static final Map<Rock, EnumMap<Rock.Type, BlockRockVariant>> TABLE = new HashMap<>();
@@ -112,7 +117,7 @@ public BlockRockVariant(Rock.Type type, Rock rock)
setHarvestLevel("shovel", 0);
break;
}
//OreDictionaryHelper.registerRockType(this, type, rock); // todo: fix
OreDictionaryHelper.registerRockType(this, type, rock);
}

public BlockRockVariant getVariant(Rock.Type t)
@@ -40,7 +40,7 @@ public BlockWallTFC(BlockRockVariant modelBlock)

parent = modelBlock;
OreDictionaryHelper.register(this, "wall");
//OreDictionaryHelper.registerRockType(this, modelBlock.type, modelBlock.rock, "wall"); // todo: fix
OreDictionaryHelper.registerRockType(this, modelBlock.type, modelBlock.rock, "wall");
}

@Override
@@ -91,7 +91,7 @@ public static void registerItems(RegistryEvent.Register<Item> event)
simpleItems.add(register(r, "wand", new ItemDebug(), CT_MISC));

{
for (net.dries007.tfc.api.types.Rock rock : net.dries007.tfc.api.types.Rock.values())
for (Rock rock : Rock.values())
simpleItems.add(register(r, "rock/" + rock.name().toLowerCase(), new ItemRock(rock), CT_ROCK_ITEMS));
for (Rock rock : Rock.values())
simpleItems.add(register(r, "brick/" + rock.name().toLowerCase(), new ItemBrickTFC(rock), CT_ROCK_ITEMS));
@@ -64,16 +64,15 @@ public ItemOreTFC(Ore ore)
else // Mineral
{
OreDictionaryHelper.register(this, "gem", ore);
// todo: fix this
/*switch (ore)
switch (ore.name())
{
case LAPIS_LAZULI:
case "lapis_lazuli":
OreDictionaryHelper.register(this, "gem", "lapis");
break;
case BITUMINOUS_COAL:
case "bituminous_coal":
OreDictionaryHelper.register(this, "gem", "coal");
break;
}*/
}
}
}

@@ -20,6 +20,8 @@
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

import net.dries007.tfc.api.types.Rock;

import static net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE;

/**
@@ -65,15 +67,15 @@ public static void registerMeta(Item thing, int meta, Object... parts)
register(new Thing(thing, meta), parts);
}

/*public static void registerRockType(Block thing, Rock.Type type, Rock rock, Object... prefixParts)
public static void registerRockType(Block thing, Rock.Type type, Rock rock, Object... prefixParts)
{
registerRockType(new Thing(thing), type, rock, prefixParts);
}

public static void registerRockType(Item thing, Rock.Type type, Rock rock, Object... prefixParts)
{
registerRockType(new Thing(thing), type, rock, prefixParts);
}*/
}

public static void init()
{
@@ -82,7 +84,7 @@ public static void init()
MAP.clear(); // No need to keep this stuff around
}

public static Predicate<ItemStack> createPredicateStack(String... names)
private static Predicate<ItemStack> createPredicateStack(String... names)
{
return input -> {
if (input.isEmpty()) return false;
@@ -105,45 +107,45 @@ private static void register(Thing thing, Object... parts)
MAP.put(thing, toString(parts));
}

/*private static void registerRockType(Thing thing, Rock.Type type, Rock rock, Object... prefixParts)
private static void registerRockType(Thing thing, Rock.Type type, Rock rock, Object... prefixParts)
{
switch (type)
{
case RAW:
MAP.put(thing, toString(prefixParts, "stone"));
MAP.put(thing, toString(prefixParts, "stone", rock));
MAP.put(thing, toString(prefixParts, "stone", rock.category));
MAP.put(thing, toString(prefixParts, "stone", rock.getRockCategory()));
break;
case SMOOTH:
MAP.put(thing, toString(prefixParts, "stone"));
MAP.put(thing, toString(prefixParts, "stone", "polished"));
MAP.put(thing, toString(prefixParts, "stone", rock));
MAP.put(thing, toString(prefixParts, "stone", rock, "polished"));
MAP.put(thing, toString(prefixParts, "stone", rock.category));
MAP.put(thing, toString(prefixParts, "stone", rock.category, "polished"));
MAP.put(thing, toString(prefixParts, "stone", rock.getRockCategory()));
MAP.put(thing, toString(prefixParts, "stone", rock.getRockCategory(), "polished"));
break;
case COBBLE:
MAP.put(thing, toString(prefixParts, "cobblestone"));
MAP.put(thing, toString(prefixParts, "cobblestone", rock));
MAP.put(thing, toString(prefixParts, "cobblestone", rock.category));
MAP.put(thing, toString(prefixParts, "cobblestone", rock.getRockCategory()));
break;
case BRICKS:
MAP.put(thing, toString(prefixParts, "stone", "brick"));
MAP.put(thing, toString(prefixParts, "stone", rock, "brick"));
MAP.put(thing, toString(prefixParts, "stone", rock.category, "brick"));
MAP.put(thing, toString(prefixParts, "stone", rock.getRockCategory(), "brick"));
break;
case CLAY_GRASS:
MAP.put(thing, toString(prefixParts, "clay"));
MAP.put(thing, toString(prefixParts, "clay", rock));
MAP.put(thing, toString(prefixParts, "clay", rock.category));
MAP.put(thing, toString(prefixParts, "clay", rock.getRockCategory()));
MAP.put(thing, toString(prefixParts, "clay", "grass"));
MAP.put(thing, toString(prefixParts, "clay", rock, "grass"));
MAP.put(thing, toString(prefixParts, "clay", rock.category, "grass"));
MAP.put(thing, toString(prefixParts, "clay", rock.getRockCategory(), "grass"));
break;
case DRY_GRASS:
MAP.put(thing, toString(prefixParts, type, "dry"));
MAP.put(thing, toString(prefixParts, type, rock, "dry"));
MAP.put(thing, toString(prefixParts, type, rock.category, "dry"));
MAP.put(thing, toString(prefixParts, type, rock.getRockCategory(), "dry"));
break;
case SAND:
case GRAVEL:
@@ -153,9 +155,9 @@ private static void register(Thing thing, Object... parts)
default:
MAP.put(thing, toString(prefixParts, type));
MAP.put(thing, toString(prefixParts, type, rock));
MAP.put(thing, toString(prefixParts, type, rock.category));
MAP.put(thing, toString(prefixParts, type, rock.getRockCategory()));
}
}*/
}

private static class Thing
{
@@ -184,7 +186,8 @@ private Thing(Item thing, int meta)

private ItemStack toItemStack()
{
return block == null ? new ItemStack(item, 1, meta) : new ItemStack(block, 1, meta);
//noinspection ConstantConditions
return (block == null) ? new ItemStack(item, 1, meta) : new ItemStack(block, 1, meta);
}
}
}
@@ -59,12 +59,6 @@
@ParametersAreNonnullByDefault
public class ChunkGenTFC implements IChunkGenerator
{
//private static final Rock[] ROCK_LAYER_1 = Rock.values().removeIf(x -> x.)

//public static final DataLayer[] ROCK_LAYER_1 = new DataLayer[] {SHALE, CLAYSTONE, ROCKSALT, LIMESTONE, CONGLOMERATE, DOLOMITE, CHERT, CHALK, RHYOLITE, BASALT, ANDESITE, DACITE, QUARTZITE, SLATE, PHYLLITE, SCHIST, GNEISS, MARBLE, GRANITE, DIORITE, GABBRO};
//public static final DataLayer[] ROCK_LAYER_2 = new DataLayer[] {RHYOLITE, BASALT, ANDESITE, DACITE, QUARTZITE, SLATE, PHYLLITE, SCHIST, GNEISS, MARBLE, GRANITE, DIORITE, GABBRO};
//public static final DataLayer[] ROCK_LAYER_3 = new DataLayer[] {RHYOLITE, BASALT, ANDESITE, DACITE, GRANITE, DIORITE, GABBRO};

public static final IBlockState STONE = Blocks.STONE.getDefaultState();
public static final IBlockState AIR = Blocks.AIR.getDefaultState();
public static final IBlockState SALT_WATER = BlocksTFC.FLUID_SALT_WATER.getDefaultState();
@@ -116,9 +110,6 @@
private final double[] noise6 = new double[425];
private final double[] heightMap = new double[425];
private final Biome[] biomes = new Biome[324];
//private final DataLayer[] rockLayer1 = new DataLayer[256];
//private final DataLayer[] rockLayer2 = new DataLayer[256];
//private final DataLayer[] rockLayer3 = new DataLayer[256];
private final DataLayer[] stabilityLayer = new DataLayer[256];
private final DataLayer[] drainageLayer = new DataLayer[256];
private final int[] seaLevelOffsetMap = new int[256];
@@ -191,9 +182,6 @@ public Chunk generateChunk(int chunkX, int chunkZ)

world.getBiomeProvider().getBiomes(biomes, chunkX * 16 - 1, chunkZ * 16 - 1, 18, 18);

//loadLayerGeneratorData(rocksGenLayer1, rockLayer1, chunkX * 16, chunkZ * 16, 16, 16);
//loadLayerGeneratorData(rocksGenLayer2, rockLayer2, chunkX * 16, chunkZ * 16, 16, 16);
//loadLayerGeneratorData(rocksGenLayer3, rockLayer3, chunkX * 16, chunkZ * 16, 16, 16);
loadLayerGeneratorData(stabilityGenLayer, stabilityLayer, chunkX * 16, chunkZ * 16, 16, 16);
loadLayerGeneratorData(drainageGenLayer, drainageLayer, chunkX * 16, chunkZ * 16, 16, 16);

@@ -232,10 +220,9 @@ public Chunk generateChunk(int chunkX, int chunkZ)
{
chunkPrimerOut.setBlockState(x, 240, z, Blocks.STAINED_GLASS.getStateFromMeta(Biome.getIdForBiome(getBiomeOffset(x, z)) & 15));

// todo: fix
//chunkPrimerOut.setBlockState(x, 242, z, Blocks.STAINED_GLASS.getStateFromMeta(rockLayer1[z << 4 | x].layerID & 15));
//chunkPrimerOut.setBlockState(x, 244, z, Blocks.STAINED_GLASS.getStateFromMeta(rockLayer2[z << 4 | x].layerID & 15));
//chunkPrimerOut.setBlockState(x, 246, z, Blocks.STAINED_GLASS.getStateFromMeta(rockLayer3[z << 4 | x].layerID & 15));
chunkPrimerOut.setBlockState(x, 242, z, Blocks.STAINED_GLASS.getStateFromMeta(rockLayer1[z << 4 | x] & 15));
chunkPrimerOut.setBlockState(x, 244, z, Blocks.STAINED_GLASS.getStateFromMeta(rockLayer2[z << 4 | x] & 15));
chunkPrimerOut.setBlockState(x, 246, z, Blocks.STAINED_GLASS.getStateFromMeta(rockLayer3[z << 4 | x] & 15));

chunkPrimerOut.setBlockState(x, 252, z, Blocks.STAINED_GLASS.getStateFromMeta(stabilityLayer[x << 4 | z].layerID & 15));
chunkPrimerOut.setBlockState(x, 254, z, Blocks.STAINED_GLASS.getStateFromMeta(drainageLayer[x << 4 | z].layerID & 15));
@@ -8,57 +8,14 @@
import net.dries007.tfc.objects.blocks.stone.BlockRockVariant;

/**
* Todo: Rewrite to make typesafe ?
* Todo: Get rid. PH is already obselete / Siesmic and drainage can be done much easier similar to rainfall / temperature
*/
@SuppressWarnings("WeakerAccess")
public final class DataLayer
{
public static final DataLayer ERROR = new DataLayer(-1, null, "ERROR", Integer.MIN_VALUE, Float.NaN);
private static final DataLayer[] LAYERS = new DataLayer[256];

/*
public static final DataLayer GRANITE = newBlockDataLayer(0, BlockRockVariant.get(Rock.GRANITE, Rock.Type.RAW), "Granite");
public static final DataLayer DIORITE = newBlockDataLayer(1, BlockRockVariant.get(Rock.DIORITE, Rock.Type.RAW), "Diorite");
public static final DataLayer GABBRO = newBlockDataLayer(2, BlockRockVariant.get(Rock.GABBRO, Rock.Type.RAW), "Gabbro");
public static final DataLayer SHALE = newBlockDataLayer(5, BlockRockVariant.get(Rock.SHALE, Rock.Type.RAW), "Shale");
public static final DataLayer CLAYSTONE = newBlockDataLayer(6, BlockRockVariant.get(Rock.CLAYSTONE, Rock.Type.RAW), "Claystone");
public static final DataLayer ROCKSALT = newBlockDataLayer(7, BlockRockVariant.get(Rock.ROCKSALT, Rock.Type.RAW), "Rock Salt");
public static final DataLayer LIMESTONE = newBlockDataLayer(8, BlockRockVariant.get(Rock.LIMESTONE, Rock.Type.RAW), "Limestone");
public static final DataLayer CONGLOMERATE = newBlockDataLayer(9, BlockRockVariant.get(Rock.CONGLOMERATE, Rock.Type.RAW), "Conglomerate");
public static final DataLayer DOLOMITE = newBlockDataLayer(10, BlockRockVariant.get(Rock.DOLOMITE, Rock.Type.RAW), "Dolomite");
public static final DataLayer CHERT = newBlockDataLayer(11, BlockRockVariant.get(Rock.CHERT, Rock.Type.RAW), "Chert");
public static final DataLayer CHALK = newBlockDataLayer(12, BlockRockVariant.get(Rock.CHALK, Rock.Type.RAW), "Chalk");
public static final DataLayer RHYOLITE = newBlockDataLayer(13, BlockRockVariant.get(Rock.RHYOLITE, Rock.Type.RAW), "Rhyolite");
public static final DataLayer BASALT = newBlockDataLayer(14, BlockRockVariant.get(Rock.BASALT, Rock.Type.RAW), "Basalt");
public static final DataLayer ANDESITE = newBlockDataLayer(15, BlockRockVariant.get(Rock.ANDESITE, Rock.Type.RAW), "Andesite");
public static final DataLayer DACITE = newBlockDataLayer(16, BlockRockVariant.get(Rock.DACITE, Rock.Type.RAW), "Dacite");
public static final DataLayer QUARTZITE = newBlockDataLayer(17, BlockRockVariant.get(Rock.QUARTZITE, Rock.Type.RAW), "Quartzite");
public static final DataLayer SLATE = newBlockDataLayer(18, BlockRockVariant.get(Rock.SLATE, Rock.Type.RAW), "Slate");
public static final DataLayer PHYLLITE = newBlockDataLayer(19, BlockRockVariant.get(Rock.PHYLLITE, Rock.Type.RAW), "Phyllite");
public static final DataLayer SCHIST = newBlockDataLayer(20, BlockRockVariant.get(Rock.SCHIST, Rock.Type.RAW), "Schist");
public static final DataLayer GNEISS = newBlockDataLayer(21, BlockRockVariant.get(Rock.GNEISS, Rock.Type.RAW), "Gneiss");
public static final DataLayer MARBLE = newBlockDataLayer(22, BlockRockVariant.get(Rock.MARBLE, Rock.Type.RAW), "Marble");
*/

// Evapotranspiration
/*
public static final DataLayer EVT_0_125 = newFloatDataLayer(80, "0.125", 0.125f);
public static final DataLayer EVT_0_25 = newFloatDataLayer(81, "0.25", 0.25f);
public static final DataLayer EVT_0_5 = newFloatDataLayer(82, "0.5", 0.5f);
public static final DataLayer EVT_1 = newFloatDataLayer(83, "1", 1f);
public static final DataLayer EVT_2 = newFloatDataLayer(84, "2", 2f);
public static final DataLayer EVT_4 = newFloatDataLayer(85, "4", 4f);
public static final DataLayer EVT_8 = newFloatDataLayer(86, "8", 8f);
public static final DataLayer EVT_16 = newFloatDataLayer(87, "16", 16f);
public static final DataLayer RAIN_62_5 = newFloatDataLayer(90, "62.5", 62.5f);
public static final DataLayer RAIN_125 = newFloatDataLayer(91, "125", 125f);
public static final DataLayer RAIN_250 = newFloatDataLayer(92, "250", 250f);
public static final DataLayer RAIN_500 = newFloatDataLayer(93, "500", 500f);
public static final DataLayer RAIN_1000 = newFloatDataLayer(94, "1000", 1000f);
public static final DataLayer RAIN_2000 = newFloatDataLayer(95, "2000", 2000f);
public static final DataLayer RAIN_4000 = newFloatDataLayer(96, "4000", 4000f);
public static final DataLayer RAIN_8000 = newFloatDataLayer(97, "8000", 8000f);
*/
public static final DataLayer SEISMIC_STABLE = newIntDataLayer(110, "Stable", 0);
public static final DataLayer SEISMIC_UNSTABLE = newIntDataLayer(111, "Unstable", 1);

@@ -81,24 +38,12 @@ public static DataLayer get(int i)
return LAYERS[i];
}

private static DataLayer newBlockDataLayer(int i, BlockRockVariant block, String name)
{
if (LAYERS[i] != null) throw new IllegalArgumentException("Layer " + i + " already in use.");
return LAYERS[i] = new DataLayer(i, block, name, Integer.MIN_VALUE, Float.NaN);
}

private static DataLayer newIntDataLayer(int i, String name, int value)
{
if (LAYERS[i] != null) throw new IllegalArgumentException("Layer " + i + " already in use.");
return LAYERS[i] = new DataLayer(i, null, name, value, Float.NaN);
}

private static DataLayer newFloatDataLayer(int i, String name, float value)
{
if (LAYERS[i] != null) throw new IllegalArgumentException("Layer " + i + " already in use.");
return LAYERS[i] = new DataLayer(i, null, name, Integer.MIN_VALUE, value);
}

public final int layerID;
public final BlockRockVariant block;
public final String name;

0 comments on commit 247ff48

Please sign in to comment.
You can’t perform that action at this time.