copper ore :partyparrot:

-changed oxidization behavior to have 8 steps instead of 2
-added copper ore, zinc ore and volcanic rock to ore gen
-added 2 test advancements
This commit is contained in:
Zelophed 2020-01-28 20:36:51 +01:00
parent ad829cfea3
commit c7bd834e7b
23 changed files with 180 additions and 27 deletions

View file

@ -7,22 +7,29 @@ import java.util.List;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.gen.GenerationStage; import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig; import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.placement.ChanceRangeConfig;
import net.minecraft.world.gen.placement.CountRangeConfig; import net.minecraft.world.gen.placement.CountRangeConfig;
import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
public enum OreGeneration { public enum OreGeneration {
TEST_BLOB_1(new BasicOreGenConfig(Blocks.EMERALD_BLOCK, 25, 2, 128)), COPPER_ORE_GENERAL(new BasicOreGenConfig(AllBlocks.COPPER_ORE.get(), 21, 3, 40, 96)),
TEST_BLOB_2(new BasicOreGenConfig(Blocks.QUARTZ_BLOCK, 41, 3, 25)), COPPER_ORE_OCEAN(new OnlyInBiomes(new BasicOreGenConfig(AllBlocks.COPPER_ORE.get(), 15, 3, 20, 55), Biome.Category.OCEAN)),
TEST_BLOB_3(new OnlyInBiomes(new BasicOreGenConfig(Blocks.BLUE_GLAZED_TERRACOTTA, 5, 10, 30), Biome.Category.OCEAN)),
TEST_BLOB_4(new OnlyInBiomes(new BasicOreGenConfig(AllBlocks.GABBRO.get(), 31, 2, 128), Biomes.TAIGA, Biomes.TAIGA_HILLS, Biomes.TAIGA_MOUNTAINS)), ZINC_ORE_GENERAL(new BasicOreGenConfig(AllBlocks.ZINC_ORE.get(), 17, 1, 55, 80)),
ZINC_ORE_DESERT(new OnlyInBiomes(new BasicOreGenConfig(AllBlocks.ZINC_ORE.get(), 17, 5, 50, 85),Biome.Category.DESERT)),
BASALT_ROCK(new BasicOreGenConfig(AllBlocks.VOLCANIC_ROCK.get(), 39, 0.2f, 0, 10)),
//TEST_BLOB_1(new BasicOreGenConfig(Blocks.EMERALD_BLOCK, 25, 2, 0, 128)),
//TEST_BLOB_2(new BasicOreGenConfig(Blocks.QUARTZ_BLOCK, 41, 3, 0, 25)),
//TEST_BLOB_3(new OnlyInBiomes(new BasicOreGenConfig(Blocks.BLUE_GLAZED_TERRACOTTA, 5, 10, 0, 30), Biome.Category.OCEAN)),
//TEST_BLOB_4(new OnlyInBiomes(new BasicOreGenConfig(AllBlocks.GABBRO.get(), 31, 2, 0, 128), Biomes.TAIGA, Biomes.TAIGA_HILLS, Biomes.TAIGA_MOUNTAINS)),
; ;
@ -45,22 +52,42 @@ public enum OreGeneration {
Block block; Block block;
//im not 100% certain that these names are accurate but at least they seem that way //im not 100% certain that these names are accurate but at least they seem that way
int clusterSize, clusterCount/*per chunk*/, maxHeight; private int clusterSize, clusterCount, minHeight, maxHeight;
private float clusterChance;
private BasicOreGenConfig(Block block, int clusterSize, int clusterCount, int maxHeight) { private BasicOreGenConfig(Block block, int clusterSize, int clusterCount, int minHeight, int maxHeight) {
this.block = block; this.block = block;
this.clusterSize = clusterSize; this.clusterSize = clusterSize;
this.clusterCount = clusterCount; this.clusterCount = clusterCount;
this.clusterChance = 1.0f;
this.minHeight = minHeight;
this.maxHeight = maxHeight;
}
private BasicOreGenConfig(Block block, int clusterSize, float clusterChance, int minHeight, int maxHeight) {
this.block = block;
this.clusterSize = clusterSize;
this.clusterCount = 0;
this.clusterChance = clusterChance;
this.minHeight = minHeight;
this.maxHeight = maxHeight; this.maxHeight = maxHeight;
} }
@Override @Override
public void addFeature(Biome biome) { public void addFeature(Biome biome) {
if (clusterCount > 0) {
biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES,
Biome.createDecoratedFeature(Feature.ORE, Biome.createDecoratedFeature(Feature.ORE,
new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE,
block.getDefaultState(), clusterSize), block.getDefaultState(), clusterSize),
Placement.COUNT_RANGE, new CountRangeConfig(clusterCount, 0, 0, maxHeight))); Placement.COUNT_RANGE, new CountRangeConfig(clusterCount, minHeight, 0, maxHeight)));
} else {
biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES,
Biome.createDecoratedFeature(Feature.ORE,
new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE,
block.getDefaultState(), clusterSize),
Placement.CHANCE_RANGE, new ChanceRangeConfig(clusterChance, minHeight, 0, maxHeight)));
}
} }
} }

View file

@ -1,49 +1,69 @@
package com.simibubi.create.foundation.world; package com.simibubi.create.foundation.world;
import java.util.LinkedList;
import java.util.OptionalDouble;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class OxidizingBlock extends Block { public class OxidizingBlock extends Block {
public static final BooleanProperty OXIDIZED = BooleanProperty.create("oxidized"); public static final IntegerProperty OXIDIZATION = IntegerProperty.create("oxidization", 0, 7);
private float chance; private float chance;
public OxidizingBlock(Properties properties, float chance) { public OxidizingBlock(Properties properties, float chance) {
super(properties); super(properties);
this.chance = chance; this.chance = chance;
setDefaultState(getDefaultState().with(OXIDIZED, false)); setDefaultState(getDefaultState().with(OXIDIZATION, 0));
} }
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void fillStateContainer(Builder<Block, BlockState> builder) {
super.fillStateContainer(builder.add(OXIDIZED)); super.fillStateContainer(builder.add(OXIDIZATION));
} }
@Override @Override
public boolean ticksRandomly(BlockState state) { public boolean ticksRandomly(BlockState state) {
return super.ticksRandomly(state) || !state.get(OXIDIZED); return super.ticksRandomly(state) || state.get(OXIDIZATION) < 7;
} }
@Override @Override
public void randomTick(BlockState state, World worldIn, BlockPos pos, Random random) { public void randomTick(BlockState state, World worldIn, BlockPos pos, Random random) {
if (worldIn.getRandom().nextFloat() <= chance) if (worldIn.getRandom().nextFloat() <= chance) {
int currentState = state.get(OXIDIZATION);
boolean canIncrease = false;
LinkedList<Integer> neighbors = new LinkedList<>();
for (Direction facing : Direction.values()) { for (Direction facing : Direction.values()) {
BlockPos neighbourPos = pos.offset(facing); BlockPos neighbourPos = pos.offset(facing);
if (!worldIn.isBlockPresent(neighbourPos)) if (!worldIn.isBlockPresent(neighbourPos))
continue; continue;
if (!Block.hasSolidSide(worldIn.getBlockState(neighbourPos), worldIn, neighbourPos, BlockState neighborState = worldIn.getBlockState(neighbourPos);
facing.getOpposite())) if (neighborState.has(OXIDIZATION)) {
neighbors.add(neighborState.get(OXIDIZATION));
}
if (Block.hasSolidSide(neighborState, worldIn, neighbourPos,
facing.getOpposite())) {
continue; continue;
worldIn.setBlockState(pos, state.with(OXIDIZED, true)); }
break; canIncrease = true;
}
if (canIncrease) {
OptionalDouble average = neighbors.stream().mapToInt(v -> v).average();
if (average.orElse(7d) >= currentState)
worldIn.setBlockState(pos, state.with(OXIDIZATION, Math.min(currentState + 1, 7)));
}
} }
} }
@Override
public float getBlockHardness(BlockState blockState, IBlockReader worldIn, BlockPos pos) {
return this.blockHardness - 0.2f * blockState.get(OXIDIZATION);
}
} }

View file

@ -1,6 +1,12 @@
{ {
"variants": { "variants": {
"oxidized=true": { "model": "create:block/copper_ore_oxidized" }, "oxidization=0": { "model": "create:block/copper_ore_oxidization0" },
"oxidized=false": { "model": "create:block/copper_ore" } "oxidization=1": { "model": "create:block/copper_ore_oxidization1" },
"oxidization=2": { "model": "create:block/copper_ore_oxidization2" },
"oxidization=3": { "model": "create:block/copper_ore_oxidization3" },
"oxidization=4": { "model": "create:block/copper_ore_oxidization4" },
"oxidization=5": { "model": "create:block/copper_ore_oxidization5" },
"oxidization=6": { "model": "create:block/copper_ore_oxidization6" },
"oxidization=7": { "model": "create:block/copper_ore_oxidization7" }
} }
} }

View file

@ -506,6 +506,11 @@
"create.command.killTPSCommand.status.usage.1": "[Create]: use /killtps start <tickTime> to artificially slow down the server tick", "create.command.killTPSCommand.status.usage.1": "[Create]: use /killtps start <tickTime> to artificially slow down the server tick",
"create.command.killTPSCommand.argument.tickTime": "tickTime", "create.command.killTPSCommand.argument.tickTime": "tickTime",
"advancement.create:root": "Create Advancements",
"advancement.create:root.desc": "~ todo",
"advancement.create:test": "test advancement",
"advancement.create:test.desc": "test advancement description",
"_comment": "-------------------------] ITEM DESCRIPTIONS [------------------------------------------------", "_comment": "-------------------------] ITEM DESCRIPTIONS [------------------------------------------------",
"item.create.example_item.tooltip": "EXAMPLE ITEM (just a marker that this tooltip exists)", "item.create.example_item.tooltip": "EXAMPLE ITEM (just a marker that this tooltip exists)",

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "create:block/copper_ore_oxidization0"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "create:block/copper_ore_oxidization1"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "create:block/copper_ore_oxidization2"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "create:block/copper_ore_oxidization3"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "create:block/copper_ore_oxidization4"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "create:block/copper_ore_oxidization5"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "create:block/copper_ore_oxidization6"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "create:block/copper_ore_oxidization7"
}
}

View file

@ -1,3 +1,3 @@
{ {
"parent": "create:block/copper_ore" "parent": "create:block/copper_ore_oxidization0"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -0,0 +1,21 @@
{
"display": {
"icon": {
"item": "create:cogwheel"
},
"title": {
"translate": "advancement.create:root"
},
"description": {
"translate": "advancement.create:root.desc"
},
"background": "create:textures/block/brass_casing_side.png",
"show_toast": false,
"announce_to_chat": false
},
"criteria": {
"flower": {
"trigger": "minecraft:inventory_changed"
}
}
}

View file

@ -0,0 +1,26 @@
{
"display": {
"icon": {
"item": "create:wrench"
},
"title": {
"translate": "advancement.create:test"
},
"description": {
"translate": "advancement.create:test.desc"
}
},
"parent": "create:root",
"criteria": {
"flower": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "create:wrench"
}
]
}
}
}
}