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

1.18 Branch Fixes #65

Open
wants to merge 21 commits into
base: 1.18
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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<h1 align="center">Art of Alchemy</h1>
<p align="center">
<!-- TODO: Mod Banner Here -->
<a href="https://github.com/CafeteriaGuild/Art-of-Alchemy"><img title="Art of Alchemy" height="300" src="https://raw.githubusercontent.com/CafeteriaGuild/Art-of-Alchemy/main/src/main/resources/assets/artofalchemy/banner.png"/></a>
<br/>
<a href="https://www.curseforge.com/minecraft/mc-mods/fabric-api"><img title="Requires Fabric API" height="50" src="https://i.imgur.com/Ol1Tcf8.png"/></a>
<br/>
Expand Down
33 changes: 16 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
plugins {
id 'fabric-loom' version '0.9.+'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = project.archives_base_name
version = project.mod_version + "+" + project.minecraft_version
group = project.maven_group

if (System.env.RUN_COUNT) { // only change version if we're in github's workflow environment - full releases shouldn't have the +build
version = version + "+build." + System.env.RUN_COUNT // automatically increments every time the workflow runs, but won't affect fabric.mod.json dependencies
base {
archivesBaseName = project.archives_base_name
}

minecraft {
if (System.env.RUN_COUNT) { // only change version if we're in github's workflow environment - full releases shouldn't have the +build
version = version + "+build." + System.env.RUN_COUNT // automatically increments every time the workflow runs, but won't affect fabric.mod.json dependencies
}

repositories {
Expand All @@ -27,7 +24,7 @@ repositories {

maven {
name = 'TerraformersMC'
url = 'https://maven.kotlindiscord.com/repository/terraformers/'
url = 'https://maven.terraformersmc.com/'
}

maven {
Expand Down Expand Up @@ -70,18 +67,20 @@ processResources {
// 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
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"

it.options.release = 16
it.options.release = 17
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
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()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jar {
Expand Down
13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true

# Fabric properties
minecraft_version=1.18-pre1
yarn_mappings=1.18-pre1+build.11
loader_version=0.12.5
minecraft_version = 1.18.1
yarn_mappings = 1.18+build.1
loader_version = 0.15.3

# Mod properties
mod_version = 1.3.4
mod_version = 1.3.5-alpha
maven_group = dev.cafeteria.artofalchemy
archives_base_name = artofalchemy

# Dependencies
fabric_api_version = 0.42.2+1.18
fabric_api_version = 0.46.6+1.18

libgui_version = 5.0.0+1.18-pre1
libgui_version = 5.0.0+1.18
modmenu_version = 3.0.0
clothconfig_version = 6.0.42
7 changes: 4 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Fri Apr 10 15:58:04 MST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.cafeteria.artofalchemy.blockentity;

import org.jetbrains.annotations.Nullable;

import dev.cafeteria.artofalchemy.AoAConfig;
import dev.cafeteria.artofalchemy.ArtOfAlchemy;
import dev.cafeteria.artofalchemy.block.BlockCalcinator;
Expand All @@ -10,9 +12,9 @@
import dev.cafeteria.artofalchemy.util.FuelHelper;
import dev.cafeteria.artofalchemy.util.ImplementedInventory;
import io.github.cottonmc.cotton.gui.PropertyDelegateHolder;
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory;
import net.fabricmc.fabric.api.tag.TagFactory;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
Expand All @@ -23,7 +25,10 @@
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerContext;
Expand All @@ -38,7 +43,7 @@

public class BlockEntityCalcinator extends BlockEntity
implements ImplementedInventory, BlockEntityTicker<BlockEntityCalcinator>, PropertyDelegateHolder,
BlockEntityClientSerializable, SidedInventory, ExtendedScreenHandlerFactory {
SidedInventory, ExtendedScreenHandlerFactory {

protected static final int[] TOP_SLOTS = {
0
Expand Down Expand Up @@ -189,9 +194,10 @@ private void doCraft(final RecipeCalcination recipe) {

}

@Nullable
@Override
public void fromClientTag(final NbtCompound tag) {
this.readNbt(tag);
public Packet<ClientPlayPacketListener> toUpdatePacket() {
return BlockEntityUpdateS2CPacket.create(this);
}

@Override
Expand Down Expand Up @@ -250,6 +256,10 @@ public void markDirty() {
this.sync();
}
}

public void sync() {
world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS);
}

@Override
public void readNbt(final NbtCompound tag) {
Expand Down Expand Up @@ -323,17 +333,17 @@ public void tick(
}

@Override
public NbtCompound toClientTag(final NbtCompound tag) {
return this.writeNbt(tag);
public NbtCompound toInitialChunkDataNbt() {
return createNbt();
}

@Override
public NbtCompound writeNbt(final NbtCompound tag) {
public void writeNbt(final NbtCompound tag) {
tag.putInt("fuel", this.fuel);
tag.putInt("progress", this.progress);
tag.putInt("maxFuel", this.maxFuel);
Inventories.writeNbt(tag, this.items);
return super.writeNbt(tag);
super.writeNbt(tag);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.cafeteria.artofalchemy.blockentity;

import org.jetbrains.annotations.Nullable;

import dev.cafeteria.artofalchemy.AoAConfig;
import dev.cafeteria.artofalchemy.ArtOfAlchemy;
import dev.cafeteria.artofalchemy.block.BlockDissolver;
Expand All @@ -14,12 +16,12 @@
import dev.cafeteria.artofalchemy.util.AoAHelper;
import dev.cafeteria.artofalchemy.util.ImplementedInventory;
import io.github.cottonmc.cotton.gui.PropertyDelegateHolder;
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory;
import net.fabricmc.fabric.api.tag.TagFactory;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleVariantStorage;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
Expand All @@ -30,7 +32,10 @@
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerContext;
Expand All @@ -45,7 +50,7 @@
@SuppressWarnings("deprecation") // Experimental API
public class BlockEntityDissolver extends BlockEntity
implements ImplementedInventory, BlockEntityTicker<BlockEntityDissolver>, PropertyDelegateHolder,
BlockEntityClientSerializable, HasEssentia, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory {
HasEssentia, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory {

private static final int[] TOP_SLOTS = {
0
Expand Down Expand Up @@ -210,9 +215,10 @@ private void doCraft(final RecipeDissolution recipe) {
this.addAlkahest(-alkahestCost);
}

@Nullable
@Override
public void fromClientTag(final NbtCompound tag) {
this.readNbt(tag);
public Packet<ClientPlayPacketListener> toUpdatePacket() {
return BlockEntityUpdateS2CPacket.create(this);
}

@Override
Expand Down Expand Up @@ -302,10 +308,9 @@ public void readNbt(final NbtCompound tag) {
this.essentia = new EssentiaContainer(tag.getCompound("essentia"));
}

@Override
public void sync() {
AoANetworking.sendEssentiaPacket(this.world, this.pos, 0, this.essentia);
BlockEntityClientSerializable.super.sync();
world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS);
}

@Override
Expand Down Expand Up @@ -358,8 +363,8 @@ public void tick(
}

@Override
public NbtCompound toClientTag(final NbtCompound tag) {
return this.writeNbt(tag);
public NbtCompound toInitialChunkDataNbt() {
return createNbt();
}

private boolean updateStatus(final int status) {
Expand All @@ -371,14 +376,14 @@ private boolean updateStatus(final int status) {
}

@Override
public NbtCompound writeNbt(final NbtCompound tag) {
public void writeNbt(final NbtCompound tag) {
tag.putInt("alkahest", AoAHelper.mBFromFluid(this.getAlkahest())); // As mB mostly for legacy reasons
tag.putInt("progress", this.progress);
tag.putInt("max_progress", this.maxProgress);
tag.putInt("status", this.status);
tag.put("essentia", this.essentia.writeNbt());
Inventories.writeNbt(tag, this.items);
return super.writeNbt(tag);
super.writeNbt(tag);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.cafeteria.artofalchemy.blockentity;

import org.jetbrains.annotations.Nullable;

import dev.cafeteria.artofalchemy.AoAConfig;
import dev.cafeteria.artofalchemy.ArtOfAlchemy;
import dev.cafeteria.artofalchemy.block.BlockDissolver;
Expand All @@ -12,12 +14,12 @@
import dev.cafeteria.artofalchemy.util.FuelHelper;
import dev.cafeteria.artofalchemy.util.ImplementedInventory;
import io.github.cottonmc.cotton.gui.PropertyDelegateHolder;
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory;
import net.fabricmc.fabric.api.tag.TagFactory;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleVariantStorage;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
Expand All @@ -28,7 +30,10 @@
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerContext;
Expand All @@ -43,7 +48,7 @@
@SuppressWarnings("deprecation") // Experimental API
public class BlockEntityDistiller extends BlockEntity
implements ImplementedInventory, BlockEntityTicker<BlockEntityDistiller>, PropertyDelegateHolder,
BlockEntityClientSerializable, HasEssentia, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory {
HasEssentia, HasAlkahest, SidedInventory, ExtendedScreenHandlerFactory {

private static final int[] TOP_SLOTS = {
0
Expand Down Expand Up @@ -161,9 +166,10 @@ private void distill() {
this.updateEssentiaTankSize();
}

@Nullable
@Override
public void fromClientTag(final NbtCompound tag) {
this.readNbt(tag);
public Packet<ClientPlayPacketListener> toUpdatePacket() {
return BlockEntityUpdateS2CPacket.create(this);
}

@Override
Expand Down Expand Up @@ -300,11 +306,10 @@ private void setLit(final boolean lit) {
this.updateLit();
}

@Override
public void sync() {
// AoANetworking.sendEssentiaPacket(world, pos, 0, essentiaInput); // KG: Is
// this needed?
BlockEntityClientSerializable.super.sync();
world.updateListeners(pos, world.getBlockState(pos), world.getBlockState(pos), Block.NOTIFY_LISTENERS);
}

@Override
Expand Down Expand Up @@ -339,8 +344,8 @@ public void tick(
}

@Override
public NbtCompound toClientTag(final NbtCompound tag) {
return this.writeNbt(tag);
public NbtCompound toInitialChunkDataNbt() {
return createNbt();
}

private void tryConvertEssentia() { // KG: Not clean, could have issues if this function is missed for a tick.
Expand All @@ -360,14 +365,14 @@ private void updateLit() {
}

@Override
public NbtCompound writeNbt(final NbtCompound tag) {
public void writeNbt(final NbtCompound tag) {
tag.putInt("progress", this.progress);
tag.putInt("fuel", this.fuel);
tag.putInt("essentia", this.essentia);
tag.putInt("alkahest", AoAHelper.mBFromFluid(this.getAlkahest())); // As mB mostly for legacy reasons
tag.put("essentiaInput", this.essentiaInput.writeNbt());
Inventories.writeNbt(tag, this.items);
return super.writeNbt(tag);
super.writeNbt(tag);
}

@Override
Expand Down
Loading