Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have a Biscuit? #1

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Illusionist

An official add-on for [Trickster](https://github.com/enjarai/trickster) which re-adds the Shadow Ploy and Revelation Ploy which are no longer present in Trickster 2.0.0-beta.1 and onward. These ploys exist to interact with shadow blocks, which are, quite simply, a method of disguising a block as any other. Shadow blocks were removed from the main Trickster mod due to issues regarding Sodium support; as such, this add-on currently breaks with Sodium.
An official add-on for [Trickster](https://github.com/enjarai/trickster) which re-adds the Shadow Ploy and Revelation Ploy which are no longer present in Trickster 2.0.0-beta.1 and onward. These ploys exist to interact with shadow blocks, which are, quite simply, a method of disguising a block as any other. Shadow blocks were removed from the main Trickster mod due to issues regarding Sodium support; as such, this add-on currently breaks with most versions of Sodium.

![](https://i.enjarai.dev/u/iNOvDC.png)
249 changes: 131 additions & 118 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,164 +1,177 @@
plugins {
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish'
id "me.modmuss50.mod-publish-plugin" version "0.4.4"
id 'me.fallenbreath.yamlang' version '1.3.1'
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish'
id "me.modmuss50.mod-publish-plugin" version "0.4.4"
id 'me.fallenbreath.yamlang' version '1.3.1'
}

version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
archivesName = project.archives_base_name
}

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// 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://maven.enjarai.dev/releases"
}
maven {
url "https://maven.enjarai.dev/mirrors"
}

maven {
name "Terraformers Maven"
url 'https://maven.terraformersmc.com'
}
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// 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://maven.enjarai.dev/releases"
}
maven {
url "https://maven.enjarai.dev/mirrors"
}

maven {
//noinspection GroovyAssignabilityCheck
name "Terraformers Maven"
url 'https://maven.terraformersmc.com'
}
exclusiveContent {
forRepository {
//noinspection ForeignDelegate
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
}

loom {
splitEnvironmentSourceSets()

mods {
"illusionist" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

splitEnvironmentSourceSets()

mods {
"illusionist" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${property('deps.minecraft')}"
mappings "net.fabricmc:yarn:${property('deps.yarn')}:v2"
modImplementation "net.fabricmc:fabric-loader:${property('deps.floader')}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric-api')}"
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${property('deps.minecraft')}"
mappings "net.fabricmc:yarn:${property('deps.yarn')}:v2"
modImplementation "net.fabricmc:fabric-loader:${property('deps.floader')}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric-api')}"

modImplementation "dev.enjarai:trickster:${property('deps.trickster')}"
modImplementation "dev.enjarai:trickster:${property('deps.trickster')}"

modImplementation "com.terraformersmc:modmenu:${property('deps.modmenu')}"
modImplementation "com.terraformersmc:modmenu:${property('deps.modmenu')}"
modClientCompileOnly modLocalRuntime("maven.modrinth:sodium:${property("deps.sodium")}")
}

processResources {
inputs.property "version", project.version
inputs.property "version", project.version

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

tasks.withType(JavaCompile).configureEach {
it.options.release = 21
it.options.release = 21
}

java {
// 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.
withSourcesJar()
// 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.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}" }
}
}

yamlang {
targetSourceSets = [sourceSets.main]
inputDir = "assets/illusionist/lang"
targetSourceSets = [sourceSets.main]
inputDir = "assets/illusionist/lang"
}

// configure the maven publication
publishing {
repositories {
maven {
name = "enjaraiMaven"
url = "https://maven.enjarai.dev/releases"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}

publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = archivesBaseName
version = version

from components.java
}
}
repositories {
maven {
name = "enjaraiMaven"
url = "https://maven.enjarai.dev/releases"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}

publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = archivesBaseName
version = version

from components.java
}
}
}

publishMods {
file = remapJar.archiveFile
displayName = "Illusionist ${property('mod_version')} for Trickster ${property('deps.trickster')}"
version = project.version
changelog = getRootProject().file("CHANGELOG.md").text
type = STABLE
modLoaders.add("fabric")

def min = property('publish_target_min')
def max = property('publish_target_max')

if (providers.gradleProperty('enjaraiModrinthToken').present) {
modrinth {
projectId = property('mod_modrinth')
accessToken = providers.gradleProperty('enjaraiModrinthToken').get()

if (min == max) {
minecraftVersions.add(min)
} else {
minecraftVersionRange {
start = min
end = max
}
}

requires {
slug = "trickster"
}
}
}

if (providers.gradleProperty('enjaraiGithubToken').present) {
github {
repository = property('mod_github')
accessToken = providers.gradleProperty('enjaraiGithubToken').get()

commitish = property('git_branch')
tagName = project.version
}
}
file = remapJar.archiveFile
displayName = "Illusionist ${property('mod_version')} for Trickster ${property('deps.trickster')}"
version = project.version
changelog = getRootProject().file("CHANGELOG.md").text
type = STABLE
modLoaders.add("fabric")

def min = property('publish_target_min')
def max = property('publish_target_max')

if (providers.gradleProperty('enjaraiModrinthToken').present) {
modrinth {
projectId = property('mod_modrinth')
accessToken = providers.gradleProperty('enjaraiModrinthToken').get()

if (min == max) {
minecraftVersions.add(min)
} else {
minecraftVersionRange {
start = min
end = max
}
}

requires {
slug = "trickster"
}
}
}

if (providers.gradleProperty('enjaraiGithubToken').present) {
github {
repository = property('mod_github')
accessToken = providers.gradleProperty('enjaraiGithubToken').get()

commitish = property('git_branch')
tagName = project.version
}
}
}

tasks.register('publishAll') {
group 'publishing'
dependsOn 'publish'
dependsOn 'publishMods'
group 'publishing'
dependsOn 'publish'
dependsOn 'publishMods'
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ deps.floader=0.15.11

# Dependencies
deps.fabric-api=0.100.1+1.21
deps.trickster=2.0.0-beta.1
deps.trickster=2.0.0-beta.7
deps.modmenu=11.0.1

deps.sodium=mc1.21.1-0.6.0-fabric
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import net.fabricmc.api.ClientModInitializer;

public class IllusionistClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package stellarwitch7.illusionist.accessor;

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minecraft.block.Block;

import java.util.concurrent.atomic.AtomicReference;

public interface ClonedChunkSectionAccessor {
/**
* Gets the shadow block states for this chunk section.
* @return the shadow block states for this chunk section
*/
Int2ObjectOpenHashMap<Block> illusionist$getBlockStates();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package stellarwitch7.illusionist.accessor;

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.caffeinemc.mods.sodium.client.world.cloned.ChunkRenderContext;
import net.minecraft.block.Block;
import net.minecraft.util.math.BlockPos;
import stellarwitch7.illusionist.mixin.client.sodium.LevelSliceInvoker;

public interface LevelSliceExt {

/**
* Gets the x-coordinate of the origin block of this level slice.
*
* @return the x-coordinate of the origin block of this level slice
*/
int getOriginBlockX();

/**
* Gets the y-coordinate of the origin block of this level slice.
*
* @return the y-coordinate of the origin block of this level slice
*/
int getOriginBlockY();

/**
* Gets the z-coordinate of the origin block of this level slice.
*
* @return the z-coordinate of the origin block of this level slice
*/
int getOriginBlockZ();

Int2ObjectOpenHashMap<Block> illusionist$getShadowBlockStates(int sectionIndex);

/**
* Gets the local section index for the given coordinates
*
* @param x the x-coordinate of the section (different from the block x-coordinate)
* @param y the y-coordinate of the section (different from the block y-coordinate)
* @param z the z-coordinate of the section (different from the block z-coordinate)
* @return the index of the section in the local section array (the same as the one in {@link ChunkRenderContext})
*/
private static int invokeGetLocalSectionIndexInternal(int x, int y, int z) {
return LevelSliceInvoker.invokeGetLocalSectionIndex(x, y, z);
}

private static int getLocalSectionIndexO(int x, int y, int z) {
return invokeGetLocalSectionIndexInternal(x >> 4, y >> 4, z >> 4);
}

default int getLocalSectionIndexO1(int x, int y, int z) {
return getLocalSectionIndexO(x - getOriginBlockX(), y - getOriginBlockY(), z - getOriginBlockZ());
}
default int getLocalSectionIndexO1(BlockPos pos) {
return getLocalSectionIndexO1(pos.getX(), pos.getY(), pos.getZ());
}
}
Loading