Merge branch 'mc1.17/dev' of https://github.com/Creators-of-Create/Create into mc1.17/dev

This commit is contained in:
Kryppers 2021-12-09 01:14:01 +00:00
commit 8cf03e3845
9 changed files with 253 additions and 32 deletions

View file

@ -2125,7 +2125,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
5049f72c327a88f175f6f9425909e098fc711100 assets/create/sounds.json 5049f72c327a88f175f6f9425909e098fc711100 assets/create/sounds.json
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json 5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json
613e64b44bed959da899fdd54c1cacb227fb33f2 data/create/advancements/andesite_alloy.json 613e64b44bed959da899fdd54c1cacb227fb33f2 data/create/advancements/andesite_alloy.json
81885c6bfb85792c88aaa7c9b70f58832945d31f data/create/advancements/andesite_casing.json 81885c6bfb85792c88aaa7c9b70f58832945d31f data/create/advancements/andesite_casing.json
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json 83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json
@ -3930,7 +3930,7 @@ ad1c3ce1e98b8483512bdd754f2e5930c7b3ae85 data/create/recipes/crafting/kinetics/d
73cd487885be8d5190f24319b4a927b8e34c21cd data/create/recipes/crafting/kinetics/encased_chain_drive.json 73cd487885be8d5190f24319b4a927b8e34c21cd data/create/recipes/crafting/kinetics/encased_chain_drive.json
b07496e4ba5bc56a2c5a395b612c68ba21328867 data/create/recipes/crafting/kinetics/encased_fan.json b07496e4ba5bc56a2c5a395b612c68ba21328867 data/create/recipes/crafting/kinetics/encased_fan.json
0dd0cc11eaa6789fc612af3231ed247893852178 data/create/recipes/crafting/kinetics/filter.json 0dd0cc11eaa6789fc612af3231ed247893852178 data/create/recipes/crafting/kinetics/filter.json
371a80e2a93d9fb68b892db5685aaeea55f34a11 data/create/recipes/crafting/kinetics/fluid_pipe.json 9df7da02bcae5ae7c3b441ff0299f75394133145 data/create/recipes/crafting/kinetics/fluid_pipe.json
284e8554d7285989a1684a5e14c72063d152cc9e data/create/recipes/crafting/kinetics/fluid_tank.json 284e8554d7285989a1684a5e14c72063d152cc9e data/create/recipes/crafting/kinetics/fluid_tank.json
3dad2a849796df268cd3a06ed37376f2cc529957 data/create/recipes/crafting/kinetics/fluid_valve.json 3dad2a849796df268cd3a06ed37376f2cc529957 data/create/recipes/crafting/kinetics/fluid_valve.json
84153bd478c0e63a04c77579d6595043f604b7ab data/create/recipes/crafting/kinetics/furnace_minecart_from_contraption_cart.json 84153bd478c0e63a04c77579d6595043f604b7ab data/create/recipes/crafting/kinetics/furnace_minecart_from_contraption_cart.json

View file

@ -13,6 +13,6 @@
}, },
"result": { "result": {
"item": "create:fluid_pipe", "item": "create:fluid_pipe",
"count": 8 "count": 4
} }
} }

View file

@ -0,0 +1,192 @@
package com.simibubi.create.content.palettes;
import java.util.Random;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.TickList;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
public class ConnectedPillarBlock extends LayeredBlock {
public static final BooleanProperty NORTH = BooleanProperty.create("north");
public static final BooleanProperty SOUTH = BooleanProperty.create("south");
public static final BooleanProperty EAST = BooleanProperty.create("east");
public static final BooleanProperty WEST = BooleanProperty.create("west");
public ConnectedPillarBlock(Properties p_55926_) {
super(p_55926_);
registerDefaultState(defaultBlockState().setValue(NORTH, false)
.setValue(WEST, false)
.setValue(EAST, false)
.setValue(SOUTH, false));
}
@Override
protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) {
super.createBlockStateDefinition(pBuilder.add(NORTH, SOUTH, EAST, WEST));
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
BlockState state = super.getStateForPlacement(pContext);
return updateColumn(pContext.getLevel(), pContext.getClickedPos(), state, true);
}
private BlockState updateColumn(Level level, BlockPos pos, BlockState state, boolean present) {
MutableBlockPos currentPos = new MutableBlockPos();
Axis axis = state.getValue(AXIS);
for (Direction connection : Iterate.directions) {
if (connection.getAxis() == axis)
continue;
boolean connect = true;
Move: for (Direction movement : Iterate.directionsInAxis(axis)) {
currentPos.set(pos);
for (int i = 0; i < 1000; i++) {
if (!level.isAreaLoaded(currentPos, 1))
break;
BlockState other1 = currentPos.equals(pos) ? state : level.getBlockState(currentPos);
BlockState other2 = level.getBlockState(currentPos.relative(connection));
boolean col1 = canConnect(state, other1);
boolean col2 = canConnect(state, other2);
currentPos.move(movement);
if (!col1 && !col2)
break;
if (col1 && col2)
continue;
connect = false;
break Move;
}
}
state = setConnection(state, connection, connect);
}
return state;
}
@Override
public void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) {
if (pOldState.getBlock() == this)
return;
TickList<Block> blockTicks = pLevel.getBlockTicks();
if (!blockTicks.hasScheduledTick(pPos, this))
blockTicks.scheduleTick(pPos, this, 1);
}
@Override
public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, Random pRandom) {
if (pState.getBlock() != this)
return;
BlockPos belowPos = pPos.relative(Direction.fromAxisAndDirection(pState.getValue(AXIS), AxisDirection.NEGATIVE));
BlockState belowState = pLevel.getBlockState(belowPos);
if (!canConnect(pState, belowState))
pLevel.setBlock(pPos, updateColumn(pLevel, pPos, pState, true), 3);
}
@Override
public BlockState updateShape(BlockState state, Direction pDirection, BlockState pNeighborState,
LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pNeighborPos) {
if (!canConnect(state, pNeighborState))
return setConnection(state, pDirection, false);
if (pDirection.getAxis() == state.getValue(AXIS))
return withPropertiesOf(pNeighborState);
return setConnection(state, pDirection, getConnection(pNeighborState, pDirection.getOpposite()));
}
protected boolean canConnect(BlockState state, BlockState other) {
return other.getBlock() == this && state.getValue(AXIS) == other.getValue(AXIS);
}
@Override
public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) {
if (pIsMoving || pNewState.getBlock() == this)
return;
for (Direction d : Iterate.directionsInAxis(pState.getValue(AXIS))) {
BlockPos relative = pPos.relative(d);
BlockState adjacent = pLevel.getBlockState(relative);
if (canConnect(pState, adjacent))
pLevel.setBlock(relative, updateColumn(pLevel, relative, adjacent, false), 3);
}
}
public static boolean getConnection(BlockState state, Direction side) {
BooleanProperty property = connection(state.getValue(AXIS), side);
return property != null && state.getValue(property);
}
public static BlockState setConnection(BlockState state, Direction side, boolean connect) {
BooleanProperty property = connection(state.getValue(AXIS), side);
if (property != null)
state = state.setValue(property, connect);
return state;
}
public static BooleanProperty connection(Axis axis, Direction side) {
if (side.getAxis() == axis)
return null;
if (axis == Axis.X) {
switch (side) {
case UP:
return EAST;
case NORTH:
return NORTH;
case SOUTH:
return SOUTH;
case DOWN:
return WEST;
default:
return null;
}
}
if (axis == Axis.Y) {
switch (side) {
case EAST:
return EAST;
case NORTH:
return NORTH;
case SOUTH:
return SOUTH;
case WEST:
return WEST;
default:
return null;
}
}
if (axis == Axis.Z) {
switch (side) {
case UP:
return WEST;
case WEST:
return SOUTH;
case EAST:
return NORTH;
case DOWN:
return EAST;
default:
return null;
}
}
return null;
}
}

View file

@ -54,7 +54,7 @@ public class PaletteBlockPattern {
.connectedTextures(v -> new HorizontalCTBehaviour(ct(v, CTs.LAYERED), ct(v, CTs.CAP))), .connectedTextures(v -> new HorizontalCTBehaviour(ct(v, CTs.LAYERED), ct(v, CTs.CAP))),
PILLAR = create("pillar", SUFFIX).blockStateFactory(p -> p::pillar) PILLAR = create("pillar", SUFFIX).blockStateFactory(p -> p::pillar)
.block(LayeredBlock::new) .block(ConnectedPillarBlock::new)
.textures("pillar", "cap") .textures("pillar", "cap")
.connectedTextures(v -> new RotatedPillarCTBehaviour(ct(v, CTs.PILLAR), ct(v, CTs.CAP))) .connectedTextures(v -> new RotatedPillarCTBehaviour(ct(v, CTs.PILLAR), ct(v, CTs.CAP)))
@ -212,7 +212,8 @@ public class PaletteBlockPattern {
.rotationX(90) .rotationX(90)
.rotationY(axis == Axis.X ? 90 : 0) .rotationY(axis == Axis.X ? 90 : 0)
.build(); .build();
}, BlockStateProperties.WATERLOGGED); }, BlockStateProperties.WATERLOGGED, ConnectedPillarBlock.NORTH, ConnectedPillarBlock.SOUTH,
ConnectedPillarBlock.EAST, ConnectedPillarBlock.WEST);
} }
public IBlockStateProvider cubeColumn(String variant) { public IBlockStateProvider cubeColumn(String variant) {

View file

@ -1,5 +1,6 @@
package com.simibubi.create.foundation.block.connected; package com.simibubi.create.foundation.block.connected;
import com.simibubi.create.content.palettes.ConnectedPillarBlock;
import com.simibubi.create.content.palettes.LayeredBlock; import com.simibubi.create.content.palettes.LayeredBlock;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -17,8 +18,31 @@ public class RotatedPillarCTBehaviour extends HorizontalCTBehaviour {
@Override @Override
public boolean connectsTo(BlockState state, BlockState other, BlockAndTintGetter reader, BlockPos pos, public boolean connectsTo(BlockState state, BlockState other, BlockAndTintGetter reader, BlockPos pos,
BlockPos otherPos, Direction face) { BlockPos otherPos, Direction face, Direction primaryOffset, Direction secondaryOffset) {
return state == other && super.connectsTo(state, other, reader, pos, otherPos, face); if (other.getBlock() != state.getBlock())
return false;
Axis stateAxis = state.getValue(LayeredBlock.AXIS);
if (other.getValue(LayeredBlock.AXIS) != stateAxis)
return false;
if (isBeingBlocked(state, reader, pos, otherPos, face))
return false;
if (primaryOffset != null && primaryOffset.getAxis() != stateAxis
&& !ConnectedPillarBlock.getConnection(state, primaryOffset))
return false;
if (secondaryOffset != null && secondaryOffset.getAxis() != stateAxis) {
if (!ConnectedPillarBlock.getConnection(state, secondaryOffset))
return false;
if (!ConnectedPillarBlock.getConnection(other, secondaryOffset.getOpposite()))
return false;
}
return true;
}
@Override
protected boolean isBeingBlocked(BlockState state, BlockAndTintGetter reader, BlockPos pos, BlockPos otherPos,
Direction face) {
return state.getValue(LayeredBlock.AXIS) == face.getAxis()
&& super.isBeingBlocked(state, reader, pos, otherPos, face);
} }
@Override @Override
@ -42,7 +66,7 @@ public class RotatedPillarCTBehaviour extends HorizontalCTBehaviour {
if (axis == Axis.X && face == Direction.NORTH) if (axis == Axis.X && face == Direction.NORTH)
return false; return false;
if (axis == Axis.Z && face == Direction.WEST) if (axis == Axis.Z && face == Direction.WEST)
return true; return false;
return super.reverseUVsVertically(state, face); return super.reverseUVsVertically(state, face);
} }

View file

@ -496,7 +496,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
.pattern("SSS") .pattern("SSS")
.pattern("PCP")), .pattern("PCP")),
FLUID_PIPE = create(AllBlocks.FLUID_PIPE).returns(8) FLUID_PIPE = create(AllBlocks.FLUID_PIPE).returns(4)
.unlockedBy(I::copper) .unlockedBy(I::copper)
.viaShaped(b -> b.define('S', I.copperSheet()) .viaShaped(b -> b.define('S', I.copperSheet())
.define('C', I.copper()) .define('C', I.copper())

View file

@ -15,10 +15,12 @@ public class AllLayerPatterns {
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.block(AllPaletteStoneTypes.CRIMSITE.getBaseBlock()) .block(AllPaletteStoneTypes.CRIMSITE.getBaseBlock())
.size(1, 3)) .size(1, 3))
.layer(l -> l.weight(2) .layer(l -> l.weight(1)
.block(Blocks.TUFF) .block(Blocks.TUFF)
.block(Blocks.GRANITE) .block(Blocks.DEEPSLATE)
.size(1, 2)) .size(2, 2))
.layer(l -> l.weight(1)
.blocks(Blocks.DEEPSLATE, Blocks.TUFF))
.layer(l -> l.weight(1) .layer(l -> l.weight(1)
.block(AllPaletteStoneTypes.LIMESTONE.getBaseBlock())) .block(AllPaletteStoneTypes.LIMESTONE.getBaseBlock()))
.build(); .build();
@ -29,46 +31,47 @@ public class AllLayerPatterns {
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.block(AllPaletteStoneTypes.ASURINE.getBaseBlock()) .block(AllPaletteStoneTypes.ASURINE.getBaseBlock())
.size(1, 3)) .size(1, 3))
.layer(l -> l.weight(2) .layer(l -> l.weight(1)
.block(Blocks.TUFF) .block(Blocks.TUFF)
.block(Blocks.SMOOTH_BASALT) .block(Blocks.DEEPSLATE)
.size(1, 2)) .size(1, 2))
.layer(l -> l.weight(1) .layer(l -> l.weight(1)
.block(Blocks.DIORITE) .blocks(Blocks.DEEPSLATE, Blocks.TUFF))
.layer(l -> l.weight(1)
.block(Blocks.CALCITE)) .block(Blocks.CALCITE))
.build(); .build();
public static NonNullSupplier<LayerPattern> OCHRESTONE = () -> LayerPattern.builder() public static NonNullSupplier<LayerPattern> OCHRESTONE = () -> LayerPattern.builder()
.layer(l -> l.weight(1) .layer(l -> l.weight(1)
.block(Blocks.ANDESITE)
.passiveBlock()) .passiveBlock())
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.block(AllPaletteStoneTypes.OCHRUM.getBaseBlock()) .block(AllPaletteStoneTypes.OCHRUM.getBaseBlock())
.size(1, 3)) .size(1, 3))
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.block(Blocks.TUFF) .block(Blocks.TUFF)
.block(Blocks.SMOOTH_BASALT) .block(Blocks.DEEPSLATE)
.size(1, 2)) .size(1, 2))
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.block(Blocks.DRIPSTONE_BLOCK) .block(Blocks.DRIPSTONE_BLOCK)
.block(Blocks.GRANITE)
.size(1, 2)) .size(1, 2))
.build(); .build();
public static NonNullSupplier<LayerPattern> MALACHITE = () -> LayerPattern.builder() public static NonNullSupplier<LayerPattern> MALACHITE = () -> LayerPattern.builder()
.layer(l -> l.weight(1)
.passiveBlock())
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.passiveBlock())
.layer(l -> l.weight(4)
.block(AllPaletteStoneTypes.VERIDIUM.getBaseBlock()) .block(AllPaletteStoneTypes.VERIDIUM.getBaseBlock())
.size(1, 3)) .size(1, 3))
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.block(Blocks.TUFF) .block(Blocks.TUFF)
.block(Blocks.ANDESITE) .block(Blocks.ANDESITE)
.size(1, 2)) .size(1, 2))
.layer(l -> l.weight(1) .layer(l -> l.weight(2)
.blocks(Blocks.TUFF, Blocks.ANDESITE))
.layer(l -> l.weight(3)
.block(Blocks.SMOOTH_BASALT)) .block(Blocks.SMOOTH_BASALT))
.build(); .build();
public static NonNullSupplier<LayerPattern> SCORIA = () -> LayerPattern.builder() public static NonNullSupplier<LayerPattern> SCORIA = () -> LayerPattern.builder()
.layer(l -> l.weight(1) .layer(l -> l.weight(1)
.passiveBlock()) .passiveBlock())
@ -79,6 +82,8 @@ public class AllLayerPatterns {
.block(Blocks.TUFF) .block(Blocks.TUFF)
.block(Blocks.ANDESITE) .block(Blocks.ANDESITE)
.size(1, 2)) .size(1, 2))
.layer(l -> l.weight(1)
.blocks(Blocks.TUFF, Blocks.ANDESITE))
.layer(l -> l.weight(1) .layer(l -> l.weight(1)
.block(Blocks.DIORITE)) .block(Blocks.DIORITE))
.build(); .build();
@ -88,9 +93,11 @@ public class AllLayerPatterns {
.passiveBlock()) .passiveBlock())
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.block(Blocks.CALCITE)) .block(Blocks.CALCITE))
.layer(l -> l.weight(1)
.block(Blocks.DIORITE))
.layer(l -> l.weight(2) .layer(l -> l.weight(2)
.block(AllPaletteStoneTypes.LIMESTONE.getBaseBlock()) .block(AllPaletteStoneTypes.LIMESTONE.getBaseBlock())
.size(1, 5)) .size(1, 4))
.build(); .build();
public static NonNullSupplier<LayerPattern> SCORIA_NETHER = () -> LayerPattern.builder() public static NonNullSupplier<LayerPattern> SCORIA_NETHER = () -> LayerPattern.builder()
@ -107,7 +114,7 @@ public class AllLayerPatterns {
.block(Blocks.BASALT) .block(Blocks.BASALT)
.block(Blocks.SMOOTH_BASALT)) .block(Blocks.SMOOTH_BASALT))
.build(); .build();
public static NonNullSupplier<LayerPattern> SCORCHIA_NETHER = () -> LayerPattern.builder() public static NonNullSupplier<LayerPattern> SCORCHIA_NETHER = () -> LayerPattern.builder()
.inNether() .inNether()
.layer(l -> l.weight(2) .layer(l -> l.weight(2)

View file

@ -105,7 +105,7 @@ public class LayerPattern {
} }
public LayerBuilder passiveBlock() { public LayerBuilder passiveBlock() {
return block(Blocks.AIR); return blocks(Blocks.STONE.defaultBlockState(), Blocks.DEEPSLATE.defaultBlockState());
} }
public LayerBuilder block(Block block) { public LayerBuilder block(Block block) {
@ -116,6 +116,10 @@ public class LayerPattern {
} }
return blocks(block.defaultBlockState(), block.defaultBlockState()); return blocks(block.defaultBlockState(), block.defaultBlockState());
} }
public LayerBuilder blocks(Block block, Block deepblock) {
return blocks(block.defaultBlockState(), deepblock.defaultBlockState());
}
public LayerBuilder blocks(Couple<NonNullSupplier<? extends Block>> blocksByDepth) { public LayerBuilder blocks(Couple<NonNullSupplier<? extends Block>> blocksByDepth) {
return blocks(blocksByDepth.getFirst() return blocks(blocksByDepth.getFirst()

View file

@ -1,7 +1,6 @@
package com.simibubi.create.foundation.worldgen; package com.simibubi.create.foundation.worldgen;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -64,7 +63,6 @@ public class LayeredOreFeature extends OreFeatureBase {
List<LayerPattern.Layer> resolvedLayers = new ArrayList<>(); List<LayerPattern.Layer> resolvedLayers = new ArrayList<>();
List<Float> layerDiameterOffsets = new ArrayList<>(); List<Float> layerDiameterOffsets = new ArrayList<>();
BitSet bitset = new BitSet(size * size * size);
MutableBlockPos mutablePos = new MutableBlockPos(); MutableBlockPos mutablePos = new MutableBlockPos();
BulkSectionAccess bulksectionaccess = new BulkSectionAccess(worldgenlevel); BulkSectionAccess bulksectionaccess = new BulkSectionAccess(worldgenlevel);
int layerCoordinate = random.nextInt(4); int layerCoordinate = random.nextInt(4);
@ -106,11 +104,6 @@ public class LayeredOreFeature extends OreFeatureBase {
if (dx * dx + dy * dy + dz * dz > 1 * layerDiameterOffsets.get(layerIndex)) if (dx * dx + dy * dy + dz * dz > 1 * layerDiameterOffsets.get(layerIndex))
continue; continue;
int index = x * length * height + y * length + z;
if (bitset.get(index))
continue;
bitset.set(index);
LayerPattern.Layer layer = resolvedLayers.get(layerIndex); LayerPattern.Layer layer = resolvedLayers.get(layerIndex);
List<TargetBlockState> state = layer.rollBlock(random); List<TargetBlockState> state = layer.rollBlock(random);