Skip to content

Commit

Permalink
The NeoForge 1.20.4! Got dam!
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai committed Apr 2, 2024
1 parent 95c2b3f commit 73f89f6
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 46 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
- Fixed an issue with hud rendering on Forge introduced in a recent update. (#127)
- Fixed Controlify 2.0 compatibility.
- Updated Forge version to NeoForge 1.20.4.
- LexForge will not be supported from now on.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'dev.architectury.loom' version '1.5-SNAPSHOT' apply(false)
// id 'me.fallenbreath.yamlang' version '1.3.1' apply(false)
id 'me.fallenbreath.yamlang' version '1.3.1' apply(false)
id "me.modmuss50.mod-publish-plugin" version "0.4.4" apply(false)
id 'maven-publish'
}
Expand All @@ -10,7 +10,7 @@ version = "${mod_version}+${minecraft_version}"
subprojects {
apply plugin: 'java'
apply plugin: 'dev.architectury.loom'
// apply plugin: 'me.fallenbreath.yamlang'
apply plugin: 'me.fallenbreath.yamlang'
apply plugin: "me.modmuss50.mod-publish-plugin"
apply plugin: 'maven-publish'

Expand Down Expand Up @@ -131,8 +131,8 @@ subprojects {
enabled = false
}

// yamlang {
// targetSourceSets = [sourceSets.main]
// inputDir = "assets/${mod_id}/lang"
// }
yamlang {
targetSourceSets = [sourceSets.main]
inputDir = "assets/${mod_id}/lang"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.Identifier;
import nl.enjarai.doabarrelroll.api.key.InputContext;
import nl.enjarai.doabarrelroll.mixin.client.key.KeyBindingAccessor;
import nl.enjarai.doabarrelroll.util.key.ContextualKeyBinding;

import java.util.HashMap;
Expand Down Expand Up @@ -81,7 +82,7 @@ public KeyBinding getKeyBinding(InputUtil.Key key) {
public void updateKeysByCode() {
bindingsByKey.clear();
for (KeyBinding keyBinding : keyBindings) {
bindingsByKey.put(keyBinding.boundKey, keyBinding);
bindingsByKey.put(((KeyBindingAccessor) keyBinding).getBoundKey(), keyBinding);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package nl.enjarai.doabarrelroll.mixin.client.key;

import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(KeyBinding.class)
public interface KeyBindingAccessor {
@Accessor
public InputUtil.Key getBoundKey();
}
2 changes: 0 additions & 2 deletions common/src/main/resources/do_a_barrel_roll.accesswidener
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
accessWidener v2 named

accessible field net/minecraft/client/option/KeyBinding boundKey Lnet/minecraft/client/util/InputUtil$Key;
1 change: 1 addition & 0 deletions common/src/main/resources/do_a_barrel_roll.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"client.InGameHudMixin",
"client.LivingEntityMixin",
"client.PlayerEntityMixin",
"client.key.KeyBindingAccessor",
"client.key.KeyBindingEntryMixin",
"client.key.KeyBindingMixin",
"client.roll.CameraMixin",
Expand Down
3 changes: 2 additions & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"cicada": ">=0.6.0 <1.0.0"
},
"breaks": {
"optifabric": "*"
"optifabric": "*",
"controlify": "<2.0.0-"
},

"custom": {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ publish_target_max=1.20.4

# Forge
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=20.4.73-beta
forge_version=20.4.218
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[20.4.73-beta,)
forge_version_range=[20.4.218,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[20.4,)
loader_version_range=[1,)
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
Expand All @@ -43,7 +43,7 @@ mod_description=Microsoft flight simulator for Minecraft elytras.
mod_license=GPL-3.0
mod_url=https://enjarai.dev/
mod_github=enjarai/do-a-barrel-roll
git_branch=arch/1.20
git_branch=arch/1.20.4
mod_modrinth=6FtRfnLg
mod_curseforge=663658
mod_issue_tracker_url=https://github.com/enjarai/do-a-barrel-roll/issues
Expand Down
7 changes: 3 additions & 4 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ publishing {

publishMods {
file = remapJar.archiveFile
displayName = "${property('mod_version')} for Forge ${property('minecraft_version')}"
version = "${project.version}-forge"
displayName = "${property('mod_version')} for NeoForge ${property('minecraft_version')}"
version = "${project.version}-neoforge"
changelog = getRootProject().file("CHANGELOG.md").text
type = STABLE
modLoaders.add("forge")
modLoaders.add("neoforge")

def min = property('publish_target_min')
Expand Down Expand Up @@ -123,7 +122,7 @@ publishMods {
accessToken = providers.gradleProperty('enjaraiGithubToken').get()

commitish = property('git_branch')
tagName = "${project.version}-forge"
tagName = "${project.version}-neoforge"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package nl.enjarai.doabarrelroll;

import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent;
import net.neoforged.neoforge.network.registration.IPayloadRegistrar;
import net.neoforged.neoforge.server.permission.events.PermissionGatherEvent;
import net.neoforged.neoforge.server.permission.nodes.PermissionNode;

import java.util.Objects;

@Mod.EventBusSubscriber
public class WhyIsTherePublicTransportationInThisModLoader {
@SubscribeEvent
Expand All @@ -33,24 +28,4 @@ public static void serverTick(TickEvent.ServerTickEvent event) {
EventCallbacks.serverTick(event.getServer());
}
}

@SubscribeEvent
public static void register(final RegisterPayloadHandlerEvent event) {
final IPayloadRegistrar registrar = event.registrar(DoABarrelRoll.MODID);
registerChannel(registrar, DoABarrelRoll.HANDSHAKE_CHANNEL);
registerChannel(registrar, DoABarrelRoll.ROLL_CHANNEL);
}

private static void registerChannel(IPayloadRegistrar registrar, Identifier id) {
registrar.play(id, buf -> new SillyPayload(buf, id), (payload, ctx) -> {
if (ctx.flow().getReceptionSide().isServer()) {
DoABarrelRollForge.SERVER_LISTENERS.get(id).forEach(
listener -> listener.accept(((ServerPlayerEntity) ctx.player().orElseThrow()).networkHandler, payload.buf(),
replyBuf -> ctx.replyHandler().send(new SillyPayload(replyBuf, id))));
} else {
DoABarrelRollForge.CLIENT_LISTENERS.get(id).forEach(
listener -> listener.accept(payload.buf(), replyBuf -> ctx.replyHandler().send(new SillyPayload(replyBuf, id))));
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package nl.enjarai.doabarrelroll;

import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent;
import net.neoforged.neoforge.network.registration.IPayloadRegistrar;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class WhyIsTherePublicTransportationInThisModLoaderMod {
@SubscribeEvent
public static void register(RegisterPayloadHandlerEvent event) {
final IPayloadRegistrar registrar = event.registrar(DoABarrelRoll.MODID);
registerChannel(registrar, DoABarrelRoll.HANDSHAKE_CHANNEL);
registerChannel(registrar, DoABarrelRoll.ROLL_CHANNEL);
}

private static void registerChannel(IPayloadRegistrar registrar, Identifier id) {
registrar.play(id, buf -> new SillyPayload(buf, id), (payload, ctx) -> {
if (ctx.flow().getReceptionSide().isServer()) {
DoABarrelRollForge.SERVER_LISTENERS.get(id).forEach(
listener -> listener.accept(((ServerPlayerEntity) ctx.player().orElseThrow()).networkHandler, payload.buf(),
replyBuf -> ctx.replyHandler().send(new SillyPayload(replyBuf, id))));
} else {
DoABarrelRollForge.CLIENT_LISTENERS.get(id).forEach(
listener -> listener.accept(payload.buf(), replyBuf -> ctx.replyHandler().send(new SillyPayload(replyBuf, id))));
}
});
}
}
1 change: 0 additions & 1 deletion neoforge/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
public net.minecraft.client.option.KeyBinding boundKey
2 changes: 1 addition & 1 deletion neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ file="META-INF/accesstransformer.cfg"
description='''${mod_description}'''
[[dependencies.'${mod_id}']] #optional
# the modid of the dependency
modId = "forge" #mandatory
modId = "neoforge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
type = "required" #mandatory
# The version range of the dependency
Expand Down

0 comments on commit 73f89f6

Please sign in to comment.