mirror of
https://github.com/TibiNonEst/cauldron-dyeing.git
synced 2024-11-24 11:37:19 -05:00
Backport to 1.17
This commit is contained in:
parent
6418399d20
commit
3c1503af6b
9 changed files with 35 additions and 38 deletions
4
.github/workflows/build-gradle.yml
vendored
4
.github/workflows/build-gradle.yml
vendored
|
@ -8,11 +8,11 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 16
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: 17
|
java-version: 16
|
||||||
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
|
4
.github/workflows/build-release.yml
vendored
4
.github/workflows/build-release.yml
vendored
|
@ -11,11 +11,11 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 16
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: 17
|
java-version: 16
|
||||||
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
|
|
@ -4,8 +4,8 @@ plugins {
|
||||||
id 'org.ajoberstar.grgit' version '4.1.0'
|
id 'org.ajoberstar.grgit' version '4.1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = '17'
|
sourceCompatibility = '16'
|
||||||
targetCompatibility = '17'
|
targetCompatibility = '16'
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = "${project.mod_version}${getVersionMetadata()}"
|
version = "${project.mod_version}${getVersionMetadata()}"
|
||||||
|
@ -27,7 +27,8 @@ var apiModules = [
|
||||||
"fabric-mining-level-api-v1",
|
"fabric-mining-level-api-v1",
|
||||||
"fabric-resource-loader-v0",
|
"fabric-resource-loader-v0",
|
||||||
"fabric-tag-extensions-v0",
|
"fabric-tag-extensions-v0",
|
||||||
"fabric-object-builder-api-v1"
|
"fabric-object-builder-api-v1",
|
||||||
|
"fabric-networking-blockentity-v0"
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.18.1
|
minecraft_version=1.17.1
|
||||||
yarn_mappings=1.18.1+build.18
|
yarn_mappings=1.17.1+build.65
|
||||||
loader_version=0.12.12
|
loader_version=0.12.12
|
||||||
fabric_version=0.46.0+1.18
|
fabric_version=0.46.1+1.17
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.0.0
|
mod_version=1.0.0
|
||||||
|
@ -14,4 +14,4 @@ maven_group=me.tibinonest.mods
|
||||||
archives_base_name=cauldron-dying
|
archives_base_name=cauldron-dying
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
sodium_version=mc1.18.1-0.4.0-alpha6
|
sodium_version=mc1.17.1-0.3.4
|
||||||
|
|
|
@ -2,18 +2,14 @@ package me.tibinonest.mods.cauldron_dyeing.block;
|
||||||
|
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import me.tibinonest.mods.cauldron_dyeing.CauldronDyeing;
|
import me.tibinonest.mods.cauldron_dyeing.CauldronDyeing;
|
||||||
|
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.network.Packet;
|
|
||||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
|
||||||
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
|
||||||
import net.minecraft.server.world.ServerWorld;
|
|
||||||
import net.minecraft.util.DyeColor;
|
import net.minecraft.util.DyeColor;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class WaterCauldronBlockEntity extends BlockEntity {
|
public class WaterCauldronBlockEntity extends BlockEntity implements BlockEntityClientSerializable {
|
||||||
private int[] color;
|
private int[] color;
|
||||||
|
|
||||||
public WaterCauldronBlockEntity(BlockPos pos, BlockState state) {
|
public WaterCauldronBlockEntity(BlockPos pos, BlockState state) {
|
||||||
|
@ -65,9 +61,10 @@ public class WaterCauldronBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeNbt(NbtCompound tag) {
|
public NbtCompound writeNbt(NbtCompound tag) {
|
||||||
super.writeNbt(tag);
|
super.writeNbt(tag);
|
||||||
tag.putIntArray("color", color);
|
tag.putIntArray("color", color);
|
||||||
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,16 +75,14 @@ public class WaterCauldronBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NbtCompound toInitialChunkDataNbt() {
|
public void fromClientTag(NbtCompound tag) {
|
||||||
var nbt = new NbtCompound();
|
color = tag.getIntArray("color");
|
||||||
nbt.putIntArray("color", color);
|
|
||||||
return nbt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
public Packet<ClientPlayPacketListener> toUpdatePacket() {
|
public NbtCompound toClientTag(NbtCompound tag) {
|
||||||
return BlockEntityUpdateS2CPacket.create(this);
|
tag.putIntArray("color", color);
|
||||||
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,7 +91,7 @@ public class WaterCauldronBlockEntity extends BlockEntity {
|
||||||
if (world.isClient()) {
|
if (world.isClient()) {
|
||||||
CauldronDyeing.rebuildBlock(pos);
|
CauldronDyeing.rebuildBlock(pos);
|
||||||
} else {
|
} else {
|
||||||
((ServerWorld) world).getChunkManager().markForUpdate(pos);
|
sync();
|
||||||
}
|
}
|
||||||
super.markDirty();
|
super.markDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package me.tibinonest.mods.cauldron_dyeing.mixin.sodium;
|
package me.tibinonest.mods.cauldron_dyeing.mixin.sodium;
|
||||||
|
|
||||||
|
import me.jellysquid.mods.sodium.client.model.quad.ModelQuadColorProvider;
|
||||||
import me.jellysquid.mods.sodium.client.model.quad.ModelQuadView;
|
import me.jellysquid.mods.sodium.client.model.quad.ModelQuadView;
|
||||||
import me.jellysquid.mods.sodium.client.model.quad.blender.ColorBlender;
|
import me.jellysquid.mods.sodium.client.model.quad.blender.BiomeColorBlender;
|
||||||
import me.jellysquid.mods.sodium.client.model.quad.blender.ColorSampler;
|
import me.jellysquid.mods.sodium.client.model.quad.blender.FlatBiomeColorBlender;
|
||||||
import me.jellysquid.mods.sodium.client.model.quad.blender.FlatColorBlender;
|
|
||||||
import me.jellysquid.mods.sodium.client.render.pipeline.BlockRenderer;
|
import me.jellysquid.mods.sodium.client.render.pipeline.BlockRenderer;
|
||||||
import me.tibinonest.mods.cauldron_dyeing.block.WaterCauldronBlockEntity;
|
import me.tibinonest.mods.cauldron_dyeing.block.WaterCauldronBlockEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -14,15 +14,15 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
@Mixin(BlockRenderer.class)
|
@Mixin(BlockRenderer.class)
|
||||||
public class SodiumBlockRendererMixin {
|
public class SodiumBlockRendererMixin {
|
||||||
@Redirect(method = "renderQuad", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/model/quad/blender/ColorBlender;getColors(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/util/math/BlockPos;Lme/jellysquid/mods/sodium/client/model/quad/ModelQuadView;Lme/jellysquid/mods/sodium/client/model/quad/blender/ColorSampler;Ljava/lang/Object;)[I"))
|
@Redirect(method = "renderQuad", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/model/quad/blender/BiomeColorBlender;getColors(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/util/math/BlockPos;Lme/jellysquid/mods/sodium/client/model/quad/ModelQuadView;Lme/jellysquid/mods/sodium/client/model/quad/ModelQuadColorProvider;Ljava/lang/Object;)[I"))
|
||||||
private <T> int[] redirectGetColors(ColorBlender instance, BlockRenderView world, BlockPos pos, ModelQuadView quad, ColorSampler<T> sampler, T state) {
|
private <T> int[] redirectGetColors(BiomeColorBlender instance, BlockRenderView world, BlockPos pos, ModelQuadView quad, ModelQuadColorProvider<T> handler, T fluidState) {
|
||||||
var blockEntity = world.getBlockEntity(pos);
|
var blockEntity = world.getBlockEntity(pos);
|
||||||
|
|
||||||
if (blockEntity instanceof WaterCauldronBlockEntity) {
|
if (blockEntity instanceof WaterCauldronBlockEntity) {
|
||||||
var flatBiomeColorBlender = new FlatColorBlender();
|
var flatBiomeColorBlender = new FlatBiomeColorBlender();
|
||||||
return flatBiomeColorBlender.getColors(world, pos, quad, sampler, state);
|
return flatBiomeColorBlender.getColors(world, pos, quad, handler, fluidState);
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance.getColors(world, pos, quad, sampler, state);
|
return instance.getColors(world, pos, quad, handler, fluidState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"package": "me.tibinonest.mods.cauldron_dyeing.mixin.sodium",
|
"package": "me.tibinonest.mods.cauldron_dyeing.mixin.sodium",
|
||||||
"required": false,
|
"required": false,
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_16",
|
||||||
"client": [
|
"client": [
|
||||||
"SodiumBlockRendererMixin"
|
"SodiumBlockRendererMixin"
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"package": "me.tibinonest.mods.cauldron_dyeing.mixin",
|
"package": "me.tibinonest.mods.cauldron_dyeing.mixin",
|
||||||
"required": true,
|
"required": true,
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_16",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"BlocksMixin",
|
"BlocksMixin",
|
||||||
"CauldronBehaviorMixin",
|
"CauldronBehaviorMixin",
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
"cauldron-dyeing.compat.sodium.mixins.json"
|
"cauldron-dyeing.compat.sodium.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"minecraft": ">=1.18",
|
"minecraft": ">=1.17",
|
||||||
"fabricloader": ">=0.12.0",
|
"fabricloader": ">=0.12.0",
|
||||||
"fabric-object-builder-api-v1": ">=0.1"
|
"fabric-object-builder-api-v1": ">=0.1",
|
||||||
|
"fabric-networking-blockentity-v0": ">=0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue