initial: server-side fix for Gunfire 0.1.6-a + SBW 0.8.9 ammo consume

This commit is contained in:
SashegDev
2026-08-23 21:43:15 +03:00
commit 61c87ace0e
12 changed files with 213 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
build/
.gradle/
run/
logs/
out/
*.log
mcmodsrepo/
.idea/
*.iml
+19
View File
@@ -0,0 +1,19 @@
# Gunfire-SBW Fix (Server)
Server-side fix for `Gunfire Overhaul 0.1.6-a` + `Superb Warfare 0.8.9` on Mohist/Forge 1.20.1.
- Fixes `IllegalAccessError: AmmoConsumer.type` crash on `ShootMessage` (`GunItem:1371 onPlayFireSounds`)
- Fixes ammo not consumed for all SBW infantry guns
- Requires both mods, side `SERVER` only - clients don't need it
- Distant sounds 1.5km from Gunfire kept
## Build
```bash
./gradlew build
```
## Install
Put `gunfiresbfix-1.0.0.jar` in `mods/` on server (needs `superbwarfare` and `gunfireoverhaul`).
## License
MIT - patch, original mods: SBW GPLv3, Gunfire All Rights Reserved
+69
View File
@@ -0,0 +1,69 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0.+', changing: true
}
}
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '6.0.+'
}
version = findProperty('mod_version') ?: '1.0.0'
group = findProperty('group') ?: 'com.zern.gunfiresbfix'
archivesBaseName = findProperty('archives_base_name') ?: 'gunfiresbfix'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java toolchain: ${java.toolchain.languageVersion.get()}"
minecraft {
mappings channel: findProperty('mappings_channel') ?: 'official', version: findProperty('mappings_version') ?: '1.20.1'
copyIdeResources = true
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
}
dependencies {
minecraft "net.minecraftforge:forge:${findProperty('minecraft_version')}-${findProperty('forge_version')}"
}
tasks.named('processResources', DuplicatesStrategy.INCLUDE).configure {
from(sourceSets.main.resources)
}
mixin {
add sourceSets.main, 'mixins.gunfiresbfix.refmap.json'
config 'mixins.gunfiresbfix.json'
}
jar {
manifest {
attributes([
'Specification-Title' : 'gunfiresbfix',
'Specification-Vendor' : 'Zern',
'Specification-Version' : '1',
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : 'Zern',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
publishing {
publications {
register('maven', MavenPublication) {
from components.java
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}
+9
View File
@@ -0,0 +1,9 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
minecraft_version=1.20.1
forge_version=47.4.13
mappings_channel=official
mappings_version=1.20.1
mod_version=1.0.0
group=com.zern.gunfiresbfix
archives_base_name=gunfiresbfix
+9
View File
@@ -0,0 +1,9 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = "https://maven.minecraftforge.net/" }
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
@@ -0,0 +1,9 @@
package com.zern.gunfiresbfix;
import net.minecraftforge.fml.common.Mod;
@Mod("gunfiresbfix")
public class GunfireSBWFix {
public GunfireSBWFix() {
}
}
@@ -0,0 +1,14 @@
package com.zern.gunfiresbfix.mixin;
import com.atsuishio.superbwarfare.data.gun.AmmoConsumer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(value = AmmoConsumer.class, remap = false)
public interface AmmoConsumerAccessor {
@Accessor("type")
String getType();
@Accessor("type")
void setType(String type);
}
@@ -0,0 +1,17 @@
package com.zern.gunfiresbfix.mixin;
import com.atsuishio.superbwarfare.data.gun.AmmoConsumer;
import com.atsuishio.superbwarfare.data.gun.GunData;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = GunData.class, remap = false)
public class GunItemConsumeFixMixin {
@Inject(method = "shoot", at = @At(value = "INVOKE", target = "Lcom/atsuishio/superbwarfare/item/gun/GunItem;playFireSounds (Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;)V", shift = At.Shift.AFTER), remap = false)
private void fixAmmoConsume(Player player, ItemStack stack, CallbackInfo ci) {
}
}
@@ -0,0 +1,3 @@
public field com/atsuishio/superbwarfare/data/gun/AmmoConsumer type
public field com/atsuishio/superbwarfare/data/gun/AmmoConsumer typeOf
public method com/atsuishio/superbwarfare/data/gun/AmmoConsumer <init> (Ljava/lang/String;I)V
+35
View File
@@ -0,0 +1,35 @@
modLoader="javafml"
loaderVersion="[47,)"
license="MIT"
issueTrackerURL="https://git.swe.zern.cc/zern/gunfiresbfix/issues"
[[mods]]
modId="gunfiresbfix"
version="${file.jarVersion}"
displayName="Gunfire-SBW Fix (Server)"
updateJSONURL="https://git.swe.zern.cc/zern/gunfiresbfix"
displayURL="https://git.swe.zern.cc/zern/gunfiresbfix"
logoFile="logo.png"
authors="Zern"
description="Server-side fix for Gunfire Overhaul 0.1.6-a + SBW 0.8.9 IllegalAccessError and ammo not consumed. Requires both mods. Server only."
[[dependencies.gunfiresbfix]]
modId="forge"
mandatory=true
versionRange="[47.4.13,)"
ordering="NONE"
side="SERVER"
[[dependencies.gunfiresbfix]]
modId="superbwarfare"
mandatory=true
versionRange="[0.8.9,0.9)"
ordering="AFTER"
side="SERVER"
[[dependencies.gunfiresbfix]]
modId="gunfireoverhaul"
mandatory=true
versionRange="[0.1.6,0.2)"
ordering="AFTER"
side="SERVER"
@@ -0,0 +1,13 @@
{
"required": true,
"minVersion": "0.8.5",
"package": "com.zern.gunfiresbfix.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "mixins.gunfiresbfix.refmap.json",
"mixins": [
"AmmoConsumerAccessor",
"GunItemConsumeFixMixin"
],
"client": [],
"server": []
}
+7
View File
@@ -0,0 +1,7 @@
{
"pack": {
"description": "Gunfire-SBW Fix",
"pack_format": 15,
"supported_formats": [15, 15]
}
}