Skip to content

Commit

Permalink
Update to 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiDragon committed Oct 10, 2023
1 parent c01cffe commit e3f2d7c
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 108 deletions.
71 changes: 13 additions & 58 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,64 +8,19 @@ on:
required: true
type: choice
options: ["release", "beta", "alpha"]
minecraft-versions:
description: Overrides for supported versions
required: false
type: string

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Gradle Caching
uses: burrunan/gradle-cache-action@v1
with:
gradle-distribution-sha-256-sum-warning: false

- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build

- name: Read mod version
id: versions
uses: christian-draeger/[email protected]
with:
path: gradle.properties
properties: "mod_version minecraft_version"

- name: Read changelog
uses: juliangruber/read-file-action@v1
id: changelog
with:
path: "./changelog/${{ steps.versions.outputs.mod_version }}+${{ steps.versions.outputs.minecraft_version }}.md"

- name: Publish
uses: Kir-Antipov/[email protected]
with:
name: "v${{ steps.versions.outputs.mod_version }} [${{ steps.versions.outputs.minecraft_version }}]"
version: ${{ steps.versions.outputs.mod_version }}+mc.${{ steps.versions.outputs.minecraft_version }}
version-type: ${{ inputs.version-type }}

loaders: fabric quilt
java: 17 18 19 20

game-versions: ${{ steps.versions.outputs.minecraft_version }}
changelog: ${{ steps.changelog.outputs.content }}

modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-id: 8cCfmdw2
modrinth-featured: false

curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
curseforge-id: 842545

github-token: ${{ secrets.GITHUB_TOKEN }}
github-tag: ${{ steps.versions.outputs.mod_version }}+mc.${{ steps.versions.outputs.minecraft_version }}
uses: MattiDragon/MattiDragon/.github/workflows/publish-mc-mod.yaml@c066f67d80ff22e0b63bb5ad5c4ac83f583ad211
with:
version-type: ${{ inputs.version-type }}
minecraft-versions: ${{ inputs.minecraft-versions }}
modrinth-id: 8cCfmdw2
curseforge-id: 842545
secrets:
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'io.github.juuxel.loom-vineflower' version '1.11.0'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'maven-publish'
}

version project.mod_version + "+mc.$minecraft_version"
group project.maven_group
base.archivesName = project.archives_base_name

repositories {
maven { url "https://maven.nucleoid.xyz" }
maven { url "https://kneelawk.com/maven/" }
maven { url "https://maven.alexiil.uk/" }
maven { url "https://maven.isxander.dev/releases" }
maven { url "https://maven.terraformersmc.com" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'https://maven.quiltmc.org/repository/release/' }
mavenLocal()
maven { url "https://jitpack.io" }
}
Expand All @@ -36,10 +38,10 @@ dependencies {
modImplementation include("xyz.nucleoid:server-translations-api:$server_translation_api_version")
modImplementation include("teamreborn:energy:$energy_version")
modImplementation include("com.kneelawk:graphlib:$graphlib_version")
modImplementation include("com.github.mattidragon:ConfigToolkit:$configtoolkit_version")
annotationProcessor clientAnnotationProcessor("com.github.mattidragon:ConfigToolkit:$configtoolkit_version")

// Config
modImplementation include("com.github.mattidragon:ConfigToolkit:$configtoolkit_version")
annotationProcessor clientAnnotationProcessor("com.github.mattidragon:ConfigToolkit:$configtoolkit_version")
modImplementation include("dev.isxander.yacl:yet-another-config-lib-fabric:$yacl_version")
modImplementation "com.terraformersmc:modmenu:$modmenu_version"

Expand Down Expand Up @@ -94,7 +96,6 @@ tasks.withType(JavaCompile).configureEach {
}

java {
archivesBaseName = project.archives_base_name
withSourcesJar()
}

Expand Down
11 changes: 0 additions & 11 deletions changelog/2.0.0+1.20.1.md

This file was deleted.

3 changes: 0 additions & 3 deletions changelog/2.0.1+1.20.1.md

This file was deleted.

1 change: 1 addition & 0 deletions changelog/2.0.1+1.20.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Update to 1.20.2
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

minecraft_version=1.20.1
yarn_mappings=1.20.1+build.9
loader_version=0.14.21
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.2
loader_version=0.14.22

mod_version=2.0.1
maven_group=io.github.mattidragon.powernetworks
archives_base_name=power-networks

fabric_api_version=0.85.0+1.20.1
mixin_extras_version=0.2.0-beta.9
polymer_version=0.5.5+1.20.1
graphlib_version=1.1.1+1.20
fabric_api_version=0.89.3+1.20.2
mixin_extras_version=0.2.0-rc.5
polymer_version=0.6.0+1.20.2
graphlib_version=1.4.0+1.20.2
server_translation_api_version=2.0.0+1.20
energy_version=3.0.0
yacl_version=3.0.3+1.20
modmenu_version=7.1.0
yacl_version=3.2.1+1.20.2
modmenu_version=8.0.0
configtoolkit_version=1.0.0
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-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package io.github.mattidragon.powernetworks.client;

import eu.pb4.polymer.networking.api.client.PolymerClientNetworking;
import io.github.mattidragon.powernetworks.block.ModBlocks;
import io.github.mattidragon.powernetworks.client.config.ConfigClient;
import io.github.mattidragon.powernetworks.client.renderer.CoilBlockEntityRenderer;
import io.github.mattidragon.powernetworks.networking.ConfigEditPackets;
import io.github.mattidragon.powernetworks.networking.PowerNetworksNetworking;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
import net.minecraft.nbt.NbtByte;

public class PowerNetworksClient implements ClientModInitializer {
@Override
Expand All @@ -17,5 +20,8 @@ public void onInitializeClient() {
ClientPlayNetworking.registerGlobalReceiver(ConfigEditPackets.StartEditingPacket.TYPE, (packet, player, responseSender) ->
MinecraftClient.getInstance().setScreen(ConfigClient.createScreen(null, packet.config(), config ->
responseSender.sendPacket(new ConfigEditPackets.ApplyChangesPacket(config)))));

PolymerClientNetworking.setClientMetadata(PowerNetworksNetworking.CLIENT_RENDERING, NbtByte.ONE);
PolymerClientNetworking.setClientMetadata(PowerNetworksNetworking.CLIENT_EDITING, NbtByte.ONE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import java.util.function.Function;

import static io.github.mattidragon.powernetworks.config.ConfigData.DEFAULT;

public class ConfigClient {
public static final Function<Float, Text> FLOAT_FORMATTER;
public static final ValueFormatter<Float> FLOAT_FORMATTER;

static {
var format = NumberFormat.getNumberInstance(Locale.ROOT);
Expand Down Expand Up @@ -217,13 +216,13 @@ private static ConfigCategory createClientCategory(MutableClientCategory instanc
.name(Text.translatable("config.power_networks.client.wireWidth"))
.description(OptionDescription.of(Text.translatable("config.power_networks.client.wireWidth.description")))
.binding(DEFAULT.client().wireWidth(), instance::wireWidth, instance::wireWidth)
.controller(option -> FloatFieldControllerBuilder.create(option).range(0f, 1f).valueFormatter(FLOAT_FORMATTER))
.controller(option -> FloatFieldControllerBuilder.create(option).range(0f, 1f).formatValue(FLOAT_FORMATTER))
.build())
.option(Option.<Float>createBuilder()
.name(Text.translatable("config.power_networks.client.hangFactor"))
.description(OptionDescription.of(Text.translatable("config.power_networks.client.hangFactor.description")))
.binding(DEFAULT.client().hangFactor(), instance::hangFactor, instance::hangFactor)
.controller(option -> FloatFieldControllerBuilder.create(option).range(0f, 1f).valueFormatter(FLOAT_FORMATTER))
.controller(option -> FloatFieldControllerBuilder.create(option).range(0f, 1f).formatValue(FLOAT_FORMATTER))
.build())
.group(ListOption.<Color>createBuilder()
.initial(Color.BLACK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import dev.isxander.yacl3.gui.ImageRenderer;
import dev.isxander.yacl3.gui.image.ImageRenderer;
import net.minecraft.block.SkullBlock;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
Expand All @@ -27,7 +27,7 @@ public PlayerHeadImageRenderer(String value) {
}

@Override
public int render(DrawContext graphics, int x, int y, int renderWidth) {
public int render(DrawContext graphics, int x, int y, int renderWidth, float tickDelta) {
var client = MinecraftClient.getInstance();
int size = renderWidth / 2;
time += client.getLastFrameDuration();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.mattidragon.powernetworks;

import eu.pb4.polymer.core.api.item.PolymerItemGroupUtils;
import eu.pb4.polymer.networking.api.PolymerServerNetworking;
import eu.pb4.polymer.networking.api.server.PolymerServerNetworking;
import io.github.mattidragon.configloader.api.ConfigManager;
import io.github.mattidragon.powernetworks.block.ModBlocks;
import io.github.mattidragon.powernetworks.config.ConfigData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
import io.github.mattidragon.powernetworks.item.ModItems;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.data.server.recipe.RecipeExporter;
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.recipe.book.RecipeCategory;

import java.util.function.Consumer;

public class RecipeProvider extends FabricRecipeProvider {
RecipeProvider(FabricDataOutput output) {
super(output);
}

@Override
public void generate(Consumer<RecipeJsonProvider> exporter) {
public void generate(RecipeExporter exporter) {
ShapedRecipeJsonBuilder.create(RecipeCategory.REDSTONE, ModItems.WIRE, 16)
.input('I', Items.COPPER_INGOT)
.input('N', Items.IRON_NUGGET)
Expand All @@ -32,7 +30,7 @@ public void generate(Consumer<RecipeJsonProvider> exporter) {
createCoilRecipe(ModItems.ULTIMATE_COIL, Items.NETHERITE_INGOT, exporter);
}

private static void createCoilRecipe(Item coil, Item material, Consumer<RecipeJsonProvider> exporter) {
private static void createCoilRecipe(Item coil, Item material, RecipeExporter exporter) {
ShapedRecipeJsonBuilder.create(RecipeCategory.REDSTONE, coil, 2)
.input('I', material)
.input('W', ModItems.WIRE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
public interface EntityAttachS2CPacketAccess {
@Mutable
@Accessor
void setAttachedId(int value);
void setAttachedEntityId(int value);

@Mutable
@Accessor
void setHoldingId(int value);
void setHoldingEntityId(int value);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package io.github.mattidragon.powernetworks.networking;

import eu.pb4.polymer.networking.api.PolymerServerNetworking;
import eu.pb4.polymer.networking.api.server.PolymerServerNetworking;
import io.github.mattidragon.powernetworks.PowerNetworks;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.nbt.NbtByte;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
Expand All @@ -13,9 +14,6 @@ public class PowerNetworksNetworking {
public static final Identifier CLIENT_EDITING = PowerNetworks.id("client_editing");

public static void register() {
PolymerServerNetworking.registerSendPacket(CLIENT_RENDERING, 0);
PolymerServerNetworking.registerSendPacket(CLIENT_EDITING, 0);

ServerPlayNetworking.registerGlobalReceiver(ConfigEditPackets.ApplyChangesPacket.TYPE, (packet, player, responseSender) -> {
if (!player.hasPermissionLevel(2) || !PowerNetworks.CONFIG.get().misc().allowRemoteEdits()) {
player.sendMessage(Text.translatable("power_networks.config_edit.denied").formatted(Formatting.RED));
Expand All @@ -27,6 +25,7 @@ public static void register() {
}

public static boolean supportsClientRendering(ServerPlayerEntity player) {
return PolymerServerNetworking.getSupportedVersion(player.networkHandler, CLIENT_RENDERING) == 0;
var value = PolymerServerNetworking.getMetadata(player.networkHandler, CLIENT_RENDERING, NbtByte.TYPE);
return value != null && value.byteValue() == 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public void startWatching(ServerPlayerEntity player, Consumer<Packet<ClientPlayP
// Packet constructor requires us to provide actual entities, but we don't have them, so we use unsafe and set the fields ourselves.
var leashPacket = UnsafeUtil.createUnsafe(EntityAttachS2CPacket.class);
var leashPacketAccess = (EntityAttachS2CPacketAccess) leashPacket;
leashPacketAccess.setHoldingId(targetId);
leashPacketAccess.setAttachedId(getEntityIds().getInt(0));
leashPacketAccess.setHoldingEntityId(targetId);
leashPacketAccess.setAttachedEntityId(getEntityIds().getInt(0));
packetConsumer.accept(leashPacket);
}
}

0 comments on commit e3f2d7c

Please sign in to comment.