Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
bf69c0b
update to 1.20.1 and also stop Statement API from logging non-errors
Andrew6rant Jul 10, 2023
ff194cd
create resource pack for nicer slab textures
Andrew6rant Jul 10, 2023
560ffda
implement KleeSlabs functionality
Andrew6rant Jul 10, 2023
f2c48d1
vastly improve slab Placement
Andrew6rant Jul 11, 2023
37b3924
fix bug with incorrect placement logic
Andrew6rant Jul 11, 2023
6ea0709
properly render each slab's outline in double slab
Andrew6rant Jul 11, 2023
5a38f6f
render block break overlay on only half of a double slab
Andrew6rant Jul 11, 2023
d9b2ff9
fix block breaking overlay mixin
Andrew6rant Jul 11, 2023
960a233
clean up code a bit
Andrew6rant Jul 11, 2023
f000c27
add double slab breaking feature
Andrew6rant Jul 11, 2023
eb48280
clean up code
Andrew6rant Jul 12, 2023
c1e3903
Add showcase to README.md
Andrew6rant Jul 17, 2023
6ec3178
Added Built-In Resource Pack.
AkashiiKun Jul 21, 2023
882668f
import packages to properly compile changes
Andrew6rant Jul 21, 2023
cf738cf
fix identifiers so the pack can be loaded
Andrew6rant Jul 21, 2023
6b7ed23
Merge pull request #1 from AkashiiKun/1.20.x
Andrew6rant Jul 21, 2023
d87f5cc
tweak built-in resource pack
Andrew6rant Jul 21, 2023
c06ad6f
clean up code
Andrew6rant Aug 3, 2023
c44d5b8
add config option to disable Statement API log suppression
Andrew6rant Aug 4, 2023
719f4ca
Update README.md
Andrew6rant Aug 5, 2023
110737d
prefix mixins
Andrew6rant Aug 6, 2023
e39bcc6
offset HitPart rendering based off of targeted blockState's VoxelShape
Andrew6rant Aug 6, 2023
4606202
dont use cull face on faces that are still visible
Altirix Aug 6, 2023
d2d8678
Merge pull request #2 from Altirix/sodium-model-cullface
Andrew6rant Aug 6, 2023
fa601a8
fix config not applying
Andrew6rant Aug 7, 2023
ffc409f
support Statement API 4.2.6+
Andrew6rant Aug 8, 2023
60df683
fix sodium compat with embedded resource pack models
Andrew6rant Aug 8, 2023
b9f7e02
add icons
Andrew6rant Aug 9, 2023
2e4a644
switch to custom ARRP fork
Andrew6rant Aug 13, 2023
d521de5
small clean-up
Andrew6rant Aug 13, 2023
19b3b40
fix lang and fabric mod json
Andrew6rant Aug 13, 2023
9f2bd04
switch back to ARRP now that my PR is merged
Andrew6rant Aug 13, 2023
0295174
fix #4
Andrew6rant Aug 14, 2023
017f009
add dumpResources config option
Andrew6rant Aug 16, 2023
1f4d10a
switch back to ARRP again now that my second PR has been merged
Andrew6rant Aug 16, 2023
df73c6b
bump version
Andrew6rant Aug 16, 2023
39e9d6c
Fix slab duplication
Superkat32 Aug 16, 2023
b954589
Merge pull request #9 from Superkat32/1.20.x
Andrew6rant Aug 16, 2023
14be16e
allow glass panes to connect to vertical slabs
Andrew6rant Aug 16, 2023
b33cd4b
Added textures and models to support Mo Glass' slabs
Andrew6rant Aug 17, 2023
f8cd4ae
bump version
Andrew6rant Aug 17, 2023
edd1b27
fix client code getting called by both sides
Andrew6rant Aug 18, 2023
e067531
small clean up
Andrew6rant Aug 18, 2023
fb84322
attempt to mitigate block placement desync
Andrew6rant Aug 21, 2023
1b0beae
bump version
Andrew6rant Aug 21, 2023
d7f9e17
ensure that setting a double slab sets the waterlogged property to false
Andrew6rant Aug 24, 2023
bc69316
fix #16
Andrew6rant Aug 29, 2023
c21db4a
mo glass slabs compat resource pack (#17)
DadoIrie Aug 30, 2023
834759a
fix client desync when changing a slab to a double slab
Andrew6rant Aug 30, 2023
83f96f7
Create jitpack.yml
Andrew6rant Aug 30, 2023
64bbc37
bump version
Andrew6rant Sep 8, 2023
a23be78
properly declare transitive dependencies
Andrew6rant Sep 8, 2023
a034660
initial keybind registration
Andrew6rant Sep 8, 2023
0ff3de1
reduce boilerplate and set up keybind network sending
Andrew6rant Sep 8, 2023
fff2ec9
implement full keybind functionality
Andrew6rant Sep 8, 2023
fa2a1e7
implement keybind to switch back to vanilla placement
Andrew6rant Sep 8, 2023
ad9efe9
initial hud render
Andrew6rant Sep 9, 2023
08e397f
properly implement slab placement HUD rendering
Andrew6rant Sep 9, 2023
4c46cd3
change wireframe render based on slab placement keybind
Andrew6rant Sep 9, 2023
d02803c
modify rendering to allow for other mods to change the line colors
Andrew6rant Sep 9, 2023
e46ca02
Dependency update
TriibuNupsik Jul 5, 2025
ab92c87
Integrated Statement API for efficiency
TriibuNupsik Jul 6, 2025
3e2294a
Merged rotate() and mirror() fix from MUKSC
TriibuNupsik Jul 6, 2025
d27c29b
Small clean-up
TriibuNupsik Jul 6, 2025
2f4c74a
1.21.1 port + switch to TriibuNupsik/ARRP
TriibuNupsik Jul 6, 2025
3541a35
Moved utilities to util package
TriibuNupsik Jul 6, 2025
5657d40
Added translations for the placement modes
TriibuNupsik Jul 6, 2025
ca03fc9
Added back placement mode icons
TriibuNupsik Jul 7, 2025
42726b7
Updated build.yml
TriibuNupsik Jul 7, 2025
349bd2d
Grant execute permission to gradlew
TriibuNupsik Jul 7, 2025
5273081
Fixed https://github.com/Andrew6rant/Auto-Slabs/issues/41 and https:/…
TriibuNupsik Jul 7, 2025
64fcdfd
Added a main toggle
TriibuNupsik Jul 7, 2025
02f6a58
Fixed not including ARRP
TriibuNupsik Jul 7, 2025
7e2a2d0
Update README.md
TriibuNupsik Jul 7, 2025
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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
* text=auto eol=lf
68 changes: 36 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]
name: Build
on:
- pull_request
- push

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v3
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Use Gradle cache for faster builds
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v4
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Grant execute permission to gradlew
run: chmod +x gradlew
- name: Build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v3
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts
name: AutoSlabs
path: build/libs/
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# Auto Slabs
Automatically Generate vertical slabs for every instance of SlabBlock
Automatically generate vertical slabs for every instance of SlabBlock. Supports Vanilla, as well as any mod that adds Slabs.

#### A key bind to change the placement mode `K` (Can be changed in the key binds menu)

## Easy config with modmenu
- Placement Master Toggle: Toggles the ability to vertical slabs
- Crosshair Icon Visibility: How long will the icon be showed for after changing the placement mode
- Slab Lines: Toggles the placement guid when looking at blocks

![config-menu](https://github.com/user-attachments/assets/7bd51ab0-819b-413e-a9f8-f7b1a1ef35fd)


https://github.com/Andrew6rant/Auto-Slabs/assets/57331134/84e2186a-f51c-4147-b98d-9eca6235cc46

Mixed slab functionality and rendering is being tracked on the [mixedslabs branch](https://github.com/Andrew6rant/Auto-Slabs/tree/mixedslabs) of this repository

https://github.com/Andrew6rant/Auto-Slabs/assets/57331134/ba89a5bd-cac9-4c24-bb84-bf58e168b73d

57 changes: 41 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'fabric-loom' version '1.11-SNAPSHOT'
id 'maven-publish'

}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
Expand All @@ -17,12 +14,18 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven {
url = "https://jitpack.io"
}
maven {
url = uri("https://ueaj.dev/maven")
}
maven {
url "https://maven.terraformersmc.com/releases/"
}
maven {
url "https://jitpack.io"
}
maven {
url = "https://api.modrinth.com/maven"
}
}

dependencies {
Expand All @@ -33,30 +36,51 @@ dependencies {

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Uncomment the following line to enable the deprecated Fabric API modules.

// ARRP from JitPack
modImplementation include("com.github.TriibuNupsik:ARRP:${project.arrp_version}")

// MidnightLib from TeamMidnightDust
modImplementation include ("maven.modrinth:midnightlib:${project.midnightlib_version}")

modImplementation ("com.terraformersmc:modmenu:${project.modmenu_version}") {
exclude module: "fabric-api"
}

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
modApi("com.github.Virtuoel:Statement:${project.statement_version}", {
exclude group: "net.fabricmc.fabric-api"
})
modImplementation("net.devtech:arrp:${project.arrp_version}")
}

processResources {
inputs.property "version", project.version
inputs.property "loader_version", project.loader_version
filteringCharset "UTF-8"

filesMatching("fabric.mod.json") {
expand "version": project.version
expand "version": project.version,
"loader_version": project.loader_version
}
}

def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
it.options.release = 17
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release.set(targetJavaVersion)
}
}

java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
Expand All @@ -72,7 +96,8 @@ jar {
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}
Expand Down
16 changes: 9 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
loader_version=0.14.12
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.0

# Mod Properties
mod_version=1.0.0
mod_version=1.2.0
maven_group=io.github.andrew6rant.autoslabs
archives_base_name=autoslabs

# Dependencies
fabric_version=0.72.0+1.19.3
statement_version=4.2.5
arrp_version=0.6.7
fabric_version=0.116.4+1.21.1
# statement_version=4.2.9 # Removed - using internal fork
arrp_version=0.10.0
midnightlib_version=1.6.9+1.21-fabric
modmenu_version=11.0.3
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
105 changes: 37 additions & 68 deletions src/main/java/io/github/andrew6rant/autoslabs/AutoSlabs.java
Original file line number Diff line number Diff line change
@@ -1,87 +1,56 @@
package io.github.andrew6rant.autoslabs;

import io.github.andrew6rant.autoslabs.config.CommonConfig;
import io.github.andrew6rant.autoslabs.statement.StatementStateRefresher;
import io.github.andrew6rant.autoslabs.util.Util;
import net.devtech.arrp.api.RRPCallback;
import net.devtech.arrp.api.RuntimeResourcePack;
import net.devtech.arrp.json.blockstate.JState;
import net.devtech.arrp.json.blockstate.JVariant;
import net.devtech.arrp.json.models.JModel;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.block.Block;
import net.minecraft.block.SlabBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.registry.Registries;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import virtuoel.statement.api.StateRefresher;

import java.util.HashMap;
import java.util.Map;

import static io.github.andrew6rant.autoslabs.config.CommonConfig.dumpResources;

public class AutoSlabs implements ModInitializer {
public static final RuntimeResourcePack AUTO_SLABS_RESOURCES = RuntimeResourcePack.create("autoslabs:resources");
public static final RuntimeResourcePack AUTO_SLABS_RESOURCES = RuntimeResourcePack.create(Identifier.of("autoslabs", "resources"));

public static final Map<PlayerEntity, SlabLockEnum> slabLockPosition = new HashMap<>();

@Override
public void onInitialize() {
// Register config with MidnightLib
CommonConfig.init("auto_slabs", CommonConfig.class);

// Config is initialized in a static block in StateMixin. I need it to run earlier than State$get, and AutoSlabs$onInitialize is too late.
for (Block block : Registries.BLOCK) {
if (block instanceof SlabBlock) {
StateRefresher.INSTANCE.addBlockProperty(block, EnumProperty.of("vertical_type", VerticalType.class), VerticalType.FALSE);
Identifier id = Registries.BLOCK.getId(block);
String namespace = id.getNamespace();
String path = id.getPath();
Identifier vertical_north_south_top_slab = new Identifier(namespace, "block/"+path + "_vertical_north_south_top");
Identifier vertical_north_south_bottom_slab = new Identifier(namespace, "block/"+path + "_vertical_north_south_bottom");
Identifier vertical_east_west_top_slab = new Identifier(namespace, "block/"+path + "_vertical_east_west_top");
Identifier vertical_east_west_bottom_slab = new Identifier(namespace, "block/"+path + "_vertical_east_west_bottom");
// Yes, I know these models are incredibly inefficient, but I need to parent them this way for the best mod compatibility.
JModel verticalSlabNorthSouthTopModel = JModel.model().parent(namespace+":block/"+path)
.element(JModel.element().from(0, 0, 0).to(16, 16, 8)
.faces(JModel.faces()
.north(JModel.face("side").cullface(Direction.NORTH).uv(0, 0, 16, 16))
.east(JModel.face("side").cullface(Direction.EAST).uv(0, 0, 8, 16))
.south(JModel.face("side").cullface(Direction.SOUTH).uv(0, 0, 16, 16))
.west(JModel.face("side").cullface(Direction.WEST).uv(0, 0, 8, 16))
.up(JModel.face("top").cullface(Direction.UP).uv(0, 0, 16, 8))
.down(JModel.face("bottom").cullface(Direction.DOWN).uv(0, 0, 16, 8))));
JModel verticalSlabNorthSouthBottomModel = JModel.model().parent(namespace+":block/"+path)
.element(JModel.element().from(0, 0, 8).to(16, 16, 16)
.faces(JModel.faces()
.north(JModel.face("side").cullface(Direction.NORTH).uv(0, 0, 16, 16))
.east(JModel.face("side").cullface(Direction.EAST).uv(0, 0, 8, 16))
.south(JModel.face("side").cullface(Direction.SOUTH).uv(0, 0, 16, 16))
.west(JModel.face("side").cullface(Direction.WEST).uv(8, 0, 16, 16))
.up(JModel.face("top").cullface(Direction.UP).uv(0, 8, 16, 16))
.down(JModel.face("bottom").cullface(Direction.DOWN).uv(0, 0, 16, 8))));
JModel verticalSlabEastWestTopModel = JModel.model().parent(namespace+":block/"+path)
.element(JModel.element().from(8, 0, 0).to(16, 16, 16)
.faces(JModel.faces()
.north(JModel.face("side").cullface(Direction.NORTH).uv(0, 0, 8, 16))
.east(JModel.face("side").cullface(Direction.EAST).uv(0, 0, 16, 16))
.south(JModel.face("side").cullface(Direction.SOUTH).uv(8, 0, 16, 16))
.west(JModel.face("side").cullface(Direction.WEST).uv(0, 0, 16, 16))
.up(JModel.face("top").cullface(Direction.UP).uv(8, 0, 16, 16))
.down(JModel.face("bottom").cullface(Direction.DOWN).uv(8, 0, 16, 16))));
JModel verticalSlabEastWestBottomModel = JModel.model().parent(namespace+":block/"+path)
.element(JModel.element().from(0, 0, 0).to(8, 16, 16)
.faces(JModel.faces()
.north(JModel.face("side").cullface(Direction.NORTH).uv(8, 0, 16, 16))
.east(JModel.face("side").cullface(Direction.EAST).uv(0, 0, 16, 16))
.south(JModel.face("side").cullface(Direction.SOUTH).uv(0, 0, 8, 16))
.west(JModel.face("side").cullface(Direction.WEST).uv(0, 0, 16, 16))
.up(JModel.face("top").cullface(Direction.UP).uv(0, 0, 8, 16))
.down(JModel.face("bottom").cullface(Direction.DOWN).uv(0, 0, 8, 16))));
Util.registerSlab(block);
}

RegistryEntryAddedCallback.event(Registries.BLOCK).register((raw, id, block) -> Util.registerSlab(block));
PayloadTypeRegistry.playC2S().register(SlabLockPayload.ID, SlabLockPayload.CODEC);

AUTO_SLABS_RESOURCES.addModel(verticalSlabNorthSouthTopModel, vertical_north_south_top_slab);
AUTO_SLABS_RESOURCES.addModel(verticalSlabNorthSouthBottomModel, vertical_north_south_bottom_slab);
AUTO_SLABS_RESOURCES.addModel(verticalSlabEastWestTopModel, vertical_east_west_top_slab);
AUTO_SLABS_RESOURCES.addModel(verticalSlabEastWestBottomModel, vertical_east_west_bottom_slab);
StatementStateRefresher.INSTANCE.reorderBlockStates();

AUTO_SLABS_RESOURCES.addBlockState(JState.state(new JVariant()
.put("type=bottom,vertical_type=north_south", JState.model(vertical_north_south_bottom_slab))
.put("type=bottom,vertical_type=east_west", JState.model(vertical_east_west_bottom_slab))
.put("type=top,vertical_type=north_south", JState.model(vertical_north_south_top_slab))
.put("type=top,vertical_type=east_west", JState.model(vertical_east_west_top_slab))
), id);
}
// custom ARRP entrypoint that is only available in my fork of ARRP
RRPCallback.BETWEEN_MODS_AND_USER.register(a -> a.add(AUTO_SLABS_RESOURCES));
if (dumpResources) {
AUTO_SLABS_RESOURCES.dump();
}
StateRefresher.INSTANCE.reorderBlockStates();
RRPCallback.BEFORE_USER.register(a -> a.add(AUTO_SLABS_RESOURCES));
//AUTO_SLABS_RESOURCES.dump();

ServerPlayNetworking.registerGlobalReceiver(SlabLockPayload.ID, (payload, context) -> {
SlabLockEnum slabLockBuf = SlabLockEnum.POSITION_VALUES[payload.slabLock()];
slabLockPosition.put(context.player(), slabLockBuf);
});

// Initialize placement handler
PlacementHandler.init();
}
}
Loading