Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# Create Deco - Create 6 Fabric port
This is a simple port of the Create Deco mod compatible with Create 6.

# Create Deco Rebuilt
8 changes: 1 addition & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.9-SNAPSHOT" apply false
id "io.github.juuxel.loom-quiltflower" version "1.+" apply false // Quiltflower, a better decompiler
id "io.github.p03w.machete" version "1.+" // automatic jar compressing on build
}

architectury {
Expand Down Expand Up @@ -69,9 +68,4 @@ allprojects {
java {
withSourcesJar()
}

machete {
// disable machete locally for faster builds
enabled = buildNumber != null
}
}
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
// dependencies must also be pulled in to minimize problems, from remapping issues to compile errors.
// All dependencies except Flywheel and Registrate are NOT safe to use!
// Flywheel and Registrate must also be used carefully due to differences.
modCompileOnly("com.simibubi.create:create-fabric:${create_fabric_version}-mc${minecraft_version}")
modCompileOnly("com.simibubi.create:create-fabric:${create_fabric_version}")
}

processResources {
Expand Down

Large diffs are not rendered by default.

102 changes: 51 additions & 51 deletions common/src/main/java/com/github/talrey/createdeco/api/Windows.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
public class Windows {
private static BlockBehaviour.Properties glassProperties(BlockBehaviour.Properties p) {
return p.isValidSpawn(Windows::never)
.isRedstoneConductor(Windows::never)
.isSuffocating(Windows::never)
.isViewBlocking(Windows::never);
.isRedstoneConductor(Windows::never)
.isSuffocating(Windows::never)
.isViewBlocking(Windows::never);
}

private static boolean never(BlockState state, BlockGetter getter, BlockPos pos) {
Expand All @@ -61,12 +61,12 @@ public static BlockEntry<WindowBlock> metalWindowBlock(String metal) {
}

public static BlockEntry<WindowBlock> metalWindowBlock(String metal,
Supplier<Supplier<RenderType>> renderType, boolean translucent) {
Supplier<Supplier<RenderType>> renderType, boolean translucent) {
String name = metal + "_window";
NonNullFunction<String, ResourceLocation> end_texture = $ -> CreateDecoMod.id(palettesDir() + $);
NonNullFunction<String, ResourceLocation> side_texture = n -> CreateDecoMod.id(palettesDir() + n);
return windowBlock(name, () -> SpriteShifts.METAL_WINDOWS.get(metal), renderType,
translucent, end_texture, side_texture, Blocks.GLASS::defaultMapColor);
translucent, end_texture, side_texture, Blocks.GLASS::defaultMapColor);
}


Expand All @@ -75,54 +75,54 @@ public static BlockEntry<WindowBlock> windowBlock(String name,
NonNullFunction<String, ResourceLocation> endTexture, NonNullFunction<String, ResourceLocation> sideTexture,
Supplier<MapColor> color) {
return CreateDecoMod.REGISTRATE.block(name.toLowerCase(Locale.ROOT).replace(" ", "_"), p -> new WindowBlock(p, translucent))
//.onRegister(connectedTextures(() -> new HorizontalCTBehaviour(ct.get())))
.onRegister(CreateRegistrate.connectedTextures(() ->
new HorizontalCTBehaviour(SpriteShifts.METAL_WINDOWS.get(name.replace("_window", ""))
)))
.addLayer(renderType)
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, c.get(), 2)
.pattern(" # ")
.pattern("#X#")
.define('#', Ingredient.of(CreateDecoTags.ingot(name.replace("_window", ""))))
.define('X', CreateDecoTags.GLASS)
.unlockedBy("has_item", InventoryChangeTrigger.TriggerInstance.hasItems(
ItemPredicate.Builder.item().of(CreateDecoTags.ingot(name.replace("_window", ""))).build()
))
.save(p::accept))
.initialProperties(() -> Blocks.GLASS)
.properties(Windows::glassProperties)
.properties(p -> p.mapColor(color.get()))
.loot((t, g) -> t.dropWhenSilkTouch(g))
.blockstate((ctx,prov)-> BlockStateGenerator.window(ctx, prov, sideTexture, endTexture))
.tag(BlockTags.IMPERMEABLE)
.simpleItem()
.register();
//.onRegister(connectedTextures(() -> new HorizontalCTBehaviour(ct.get())))
.onRegister(connectedTextures(() ->
new HorizontalCTBehaviour(SpriteShifts.METAL_WINDOWS.get(name.replace("_window", ""))
)))
.addLayer(renderType)
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, c.get(), 2)
.pattern(" # ")
.pattern("#X#")
.define('#', Ingredient.of(CreateDecoTags.ingot(name.replace("_window", ""))))
.define('X', CreateDecoTags.GLASS)
.unlockedBy("has_item", InventoryChangeTrigger.TriggerInstance.hasItems(
ItemPredicate.Builder.item().of(CreateDecoTags.ingot(name.replace("_window", ""))).build()
))
.save(p))
.initialProperties(() -> Blocks.GLASS)
.properties(Windows::glassProperties)
.properties(p -> p.mapColor(color.get()))
.loot((t, g) -> t.dropWhenSilkTouch(g))
.blockstate((ctx, prov) -> BlockStateGenerator.window(ctx, prov, sideTexture, endTexture))
.tag(BlockTags.IMPERMEABLE)
.simpleItem()
.register();
}

public static BlockEntry<ConnectedGlassPaneBlock> metalWindowPane(String metal,
Supplier<? extends Block> parent) {
Supplier<? extends Block> parent) {
return metalWindowPane(metal, parent, () -> RenderType::cutoutMipped);
}

public static BlockEntry<ConnectedGlassPaneBlock> metalWindowPane(String metal,
Supplier<? extends Block> parent, Supplier<Supplier<RenderType>> renderType) {
Supplier<? extends Block> parent, Supplier<Supplier<RenderType>> renderType) {
String name = metal.toLowerCase(Locale.ROOT).replace(" ", "_") + "_window";
ResourceLocation topTexture = CreateDecoMod.id(palettesDir() + name + "_end");
ResourceLocation sideTexture = CreateDecoMod.id(palettesDir() + name);
return connectedGlassPane(name, parent, () -> SpriteShifts.METAL_WINDOWS.get(metal), sideTexture,
sideTexture, topTexture, renderType);
sideTexture, topTexture, renderType);
}

private static BlockEntry<ConnectedGlassPaneBlock> connectedGlassPane(String name, Supplier<? extends Block> parent,
Supplier<CTSpriteShiftEntry> ctshift, ResourceLocation sideTexture, ResourceLocation itemSideTexture,
ResourceLocation topTexture, Supplier<Supplier<RenderType>> renderType) {
NonNullConsumer<? super ConnectedGlassPaneBlock> connectedTextures =
connectedTextures(() -> new GlassPaneCTBehaviour(ctshift.get()));
connectedTextures(() -> new GlassPaneCTBehaviour(ctshift.get()));
String CGPparents = "block/connected_glass_pane/";
String prefix = name + "_pane_";

return glassPane(name, parent, itemSideTexture, topTexture, ConnectedGlassPaneBlock::new, renderType,
connectedTextures, BlockStateGenerator.windowPane(CGPparents, prefix, sideTexture, topTexture));
connectedTextures, BlockStateGenerator.windowPane(CGPparents, prefix, sideTexture, topTexture));
}

private static <G extends GlassPaneBlock> BlockEntry<G> glassPane(String name, Supplier<? extends Block> parent,
Expand All @@ -132,25 +132,25 @@ private static <G extends GlassPaneBlock> BlockEntry<G> glassPane(String name, S
name += "_pane";

return CreateDecoMod.REGISTRATE.block(name, factory)
.onRegister(connectedTextures)
.addLayer(renderType)
.initialProperties(() -> Blocks.GLASS_PANE)
.properties(p -> p.mapColor(parent.get()
.defaultMapColor()))
.blockstate(stateProvider)
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, c.get(), 16)
.pattern("###")
.pattern("###")
.define('#', parent.get())
.unlockedBy("has_ingredient", RegistrateRecipeProvider.has(parent.get()))
.save(p::accept))
.loot((t, g) -> t.dropWhenSilkTouch(g))
.item()
.model((c, p) -> p.withExistingParent(c.getName(), CreateDecoMod.id("item/pane"))
.texture("pane", sideTexture)
.texture("edge", topTexture))
.build()
.register();
.onRegister(connectedTextures)
.addLayer(renderType)
.initialProperties(() -> Blocks.GLASS_PANE)
.properties(p -> p.mapColor(parent.get()
.defaultMapColor()))
.blockstate(stateProvider)
.recipe((c, p) -> ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, c.get(), 16)
.pattern("###")
.pattern("###")
.define('#', parent.get())
.unlockedBy("has_ingredient", RegistrateRecipeProvider.has(parent.get()))
.save(p))
.loot((t, g) -> t.dropWhenSilkTouch(g))
.item()
.model((c, p) -> p.withExistingParent(c.getName(), CreateDecoMod.id("item/pane"))
.texture("pane", sideTexture)
.texture("edge", topTexture))
.build()
.register();
}

private static String palettesDir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DirectionalBlock;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
Expand Down Expand Up @@ -99,6 +100,7 @@ public BlockState rotate (BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}


@Override
public BlockState updateShape (BlockState state, Direction from, BlockState neighbor, LevelAccessor level, BlockPos pos, BlockPos neighborPos) {
updateWater(level, state, pos);
Expand Down Expand Up @@ -172,4 +174,21 @@ public static boolean canSurvive(LevelReader level, BlockPos pos, Direction faci
BlockPos opposite = pos.relative(facing.getOpposite());
return Block.canSupportCenter(level, opposite, facing.getOpposite());
}

@Override
public BlockState mirror(BlockState state, Mirror mirror) {
Direction facing = state.getValue(FACING);
switch (mirror) {
case LEFT_RIGHT -> { // Mirror along Z-axis
if (facing == Direction.NORTH) facing = Direction.SOUTH;
else if (facing == Direction.SOUTH) facing = Direction.NORTH;
}
case FRONT_BACK -> { // Mirror along X-axis
if (facing == Direction.EAST) facing = Direction.WEST;
else if (facing == Direction.WEST) facing = Direction.EAST;
}
case NONE -> {} // do nothing
}
return state.setValue(FACING, facing);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
Expand Down Expand Up @@ -255,4 +256,33 @@ public BlockState rotate(BlockState state, Rotation rotation) {
BlockState newState = defaultBlockState().setValue(NORTH_FENCE, north).setValue(SOUTH_FENCE, south).setValue(EAST_FENCE, east).setValue(WEST_FENCE, west);
return newState;
}

@Override
public BlockState mirror(BlockState state, Mirror mirror) {
boolean north = state.getValue(NORTH_FENCE);
boolean south = state.getValue(SOUTH_FENCE);
boolean east = state.getValue(EAST_FENCE);
boolean west = state.getValue(WEST_FENCE);

switch (mirror) {
case LEFT_RIGHT -> { // mirror along Z-axis (north <-> south)
boolean tmp = north;
north = south;
south = tmp;
// east/west remain the same
}
case FRONT_BACK -> { // mirror along X-axis (east <-> west)
boolean tmp = east;
east = west;
west = tmp;
// north/south remain the same
}
case NONE -> {}
}

return state.setValue(NORTH_FENCE, north)
.setValue(SOUTH_FENCE, south)
.setValue(EAST_FENCE, east)
.setValue(WEST_FENCE, west);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
Expand Down Expand Up @@ -158,4 +159,41 @@ public InteractionResult onSneakWrenched (BlockState state, UseOnContext context
public BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(BlockStateProperties.HORIZONTAL_FACING, rotation.rotate(state.getValue(BlockStateProperties.HORIZONTAL_FACING)));
}

@Override
public BlockState mirror(BlockState state, Mirror mirror) {
Direction facing = state.getValue(BlockStateProperties.HORIZONTAL_FACING);
boolean left = state.getValue(RAILING_LEFT);
boolean right = state.getValue(RAILING_RIGHT);

switch (mirror) {
case LEFT_RIGHT -> { // mirror along Z-axis
// North <-> South flip
if (facing == Direction.NORTH) facing = Direction.SOUTH;
else if (facing == Direction.SOUTH) facing = Direction.NORTH;
// Swap left/right when facing north/south
if (facing == Direction.NORTH || facing == Direction.SOUTH) {
boolean tmp = left;
left = right;
right = tmp;
}
}
case FRONT_BACK -> { // mirror along X-axis
// East <-> West flip
if (facing == Direction.EAST) facing = Direction.WEST;
else if (facing == Direction.WEST) facing = Direction.EAST;
// Swap left/right when facing east/west
if (facing == Direction.EAST || facing == Direction.WEST) {
boolean tmp = left;
left = right;
right = tmp;
}
}
case NONE -> {} // do nothing
}

return state.setValue(BlockStateProperties.HORIZONTAL_FACING, facing)
.setValue(RAILING_LEFT, left)
.setValue(RAILING_RIGHT, right);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"b": {
"item": "create:andesite_alloy"
}
},
"pattern": [
"bbb",
"bbb"
],
"result": {
"count": 16,
"item": "createdeco:andesite_bars"
},
"show_notification": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minecraft:stonecutting",
"count": 4,
"ingredient": {
"item": "create:andesite_alloy"
},
"result": "createdeco:andesite_bars"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"p": {
"tag": "c:plates/andesite"
}
},
"pattern": [
"ppp",
"ppp"
],
"result": {
"count": 16,
"item": "createdeco:andesite_bars_overlay"
},
"show_notification": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minecraft:stonecutting",
"count": 4,
"ingredient": {
"item": "create:andesite_alloy"
},
"result": "createdeco:andesite_bars_overlay"
}
Loading