Skip to content

Commit ee64484

Browse files
authored
Merge pull request #10 from 1whohears/1.19.2-dev
1.19.2 dev V0.5.6
2 parents d9924bd + 093fd82 commit ee64484

File tree

82 files changed

+1640
-879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1640
-879
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ build
2525
*.bak
2626
*.launch
2727
**/run/
28+
aoa_graphs/~$aoa_graphs.xlsx

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ Join the discord for development updates. Additionally, I appreciate any and all
1111

1212
https://discord.gg/dWgQTRxCJm
1313

14-
Check out my channel where I'll post guides and other videos showing of the mod!
14+
Check out my youtube where I'll post guides and other videos showing the mod!
1515

1616
https://youtu.be/P4Flz0XOtTk

aoa_graphs/aoa_graphs.xlsx

14.2 KB
Binary file not shown.

build.gradle

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ apply plugin: 'maven-publish'
1818

1919
group = 'com.onewhohears.dscombat'
2020
archivesBaseName = 'dscombat-1.19.2'
21-
version = '0.5.3'
21+
version = '0.5.6'
2222

2323
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
2424

2525
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
2626
minecraft {
27-
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
28-
2927
mappings channel: 'parchment', version: '2022.11.27-1.19.2'
3028

3129
runs {
@@ -89,17 +87,17 @@ dependencies {
8987
}
9088

9189
jar {
92-
manifest {
93-
attributes([
94-
"Specification-Title" : "Diamond Star Combat",
95-
"Specification-Vendor" : "1whohears",
96-
"Specification-Version" : version,
97-
"Implementation-Title" : "Diamond Star Combat",
98-
"Implementation-Version" : version,
99-
"Implementation-Vendor" : "1whohears",
100-
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
101-
])
102-
}
90+
manifest {
91+
attributes([
92+
"Specification-Title" : "Diamond Star Combat",
93+
"Specification-Vendor" : "1whohears",
94+
"Specification-Version" : version,
95+
"Implementation-Title" : "Diamond Star Combat",
96+
"Implementation-Version" : version,
97+
"Implementation-Vendor" : "1whohears",
98+
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
99+
])
100+
}
103101
}
104102

105103
jar.finalizedBy('reobfJar')
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.onewhohears.dscombat;
2+
3+
import org.apache.commons.lang3.tuple.Pair;
4+
5+
import net.minecraftforge.common.ForgeConfigSpec;
6+
7+
public class Config {
8+
9+
public static class Client {
10+
11+
public final ForgeConfigSpec.DoubleValue mouseModeMaxRadius;
12+
public final ForgeConfigSpec.DoubleValue mouseStickDeadzoneRadius;
13+
public final ForgeConfigSpec.BooleanValue cameraTurnRelativeToVehicle;
14+
public final ForgeConfigSpec.BooleanValue customDismount;
15+
public final ForgeConfigSpec.BooleanValue debugMode;
16+
17+
public Client(ForgeConfigSpec.Builder builder) {
18+
mouseModeMaxRadius = builder
19+
.comment("Only for vehicles in Mouse Mode. How far your mouse must move from rest to get a maximum angle.")
20+
.defineInRange("mouseModeMaxRadius", 1000d, 0, 10000d);
21+
mouseStickDeadzoneRadius = builder
22+
.comment("Only for vehicles in Mouse Mode. How far your mouse must move from rest to register an input.")
23+
.defineInRange("mouseStickDeadzoneRadius", 100d, 0, 1000d);
24+
cameraTurnRelativeToVehicle = builder
25+
.comment("If enabled, turning your player head may feel more natural.")
26+
.worldRestart()
27+
.define("cameraTurnRelativeToVehicle", true);
28+
customDismount = builder
29+
.comment("If enabled, your sneak key binding becomes Special2, and Special2 binding becomes dismount.")
30+
.define("customDismount", true);
31+
debugMode = builder
32+
.comment("Stats for nerds.")
33+
.define("debugMode", false);
34+
}
35+
36+
}
37+
38+
public static class Server {
39+
40+
public Server(ForgeConfigSpec.Builder builder) {
41+
42+
}
43+
44+
}
45+
46+
static final ForgeConfigSpec clientSpec;
47+
public static final Config.Client CLIENT;
48+
49+
static final ForgeConfigSpec serverSpec;
50+
public static final Config.Server SERVER;
51+
52+
static {
53+
final Pair<Client, ForgeConfigSpec> clientSpecPair = new ForgeConfigSpec.Builder()
54+
.configure(Config.Client::new);
55+
clientSpec = clientSpecPair.getRight();
56+
CLIENT = clientSpecPair.getLeft();
57+
58+
final Pair<Server, ForgeConfigSpec> serverSpecPair = new ForgeConfigSpec.Builder()
59+
.configure(Server::new);
60+
serverSpec = serverSpecPair.getRight();
61+
SERVER = serverSpecPair.getLeft();
62+
}
63+
64+
}

src/main/java/com/onewhohears/dscombat/DSCombatMod.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import com.onewhohears.dscombat.client.screen.AircraftScreen;
55
import com.onewhohears.dscombat.client.screen.WeaponsBlockScreen;
66
import com.onewhohears.dscombat.common.network.PacketHandler;
7-
import com.onewhohears.dscombat.data.AircraftPresets;
7+
import com.onewhohears.dscombat.data.aircraft.AircraftPresets;
88
import com.onewhohears.dscombat.data.radar.RadarPresets;
99
import com.onewhohears.dscombat.data.weapon.WeaponPresets;
1010
import com.onewhohears.dscombat.init.DataSerializers;
@@ -18,7 +18,9 @@
1818

1919
import net.minecraft.client.gui.screens.MenuScreens;
2020
import net.minecraftforge.eventbus.api.IEventBus;
21+
import net.minecraftforge.fml.ModLoadingContext;
2122
import net.minecraftforge.fml.common.Mod;
23+
import net.minecraftforge.fml.config.ModConfig;
2224
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
2325
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
2426
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@@ -29,6 +31,8 @@ public class DSCombatMod {
2931
public static final String MODID = "dscombat";
3032

3133
public DSCombatMod() {
34+
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Config.clientSpec);
35+
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.serverSpec);
3236
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
3337
// ORDER MATTERS
3438
WeaponPresets.setupPresets();

src/main/java/com/onewhohears/dscombat/client/event/ClientModEvents.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.onewhohears.dscombat.client.event;
22

33
import com.onewhohears.dscombat.DSCombatMod;
4-
import com.onewhohears.dscombat.client.input.KeyInit;
4+
import com.onewhohears.dscombat.client.input.DSCKeys;
55
import com.onewhohears.dscombat.client.overlay.PilotOverlay;
66
import com.onewhohears.dscombat.client.renderer.RendererEntityAircraft;
77
import com.onewhohears.dscombat.client.renderer.RendererEntityInvisible;
@@ -54,7 +54,7 @@ public final class ClientModEvents {
5454

5555
@SubscribeEvent
5656
public static void clientSetup(RegisterKeyMappingsEvent event) {
57-
KeyInit.init(event);
57+
DSCKeys.init(event);
5858
}
5959

6060
@SubscribeEvent

src/main/java/com/onewhohears/dscombat/client/event/forgebus/ClientCameraEvents.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.lwjgl.glfw.GLFW;
77
import org.lwjgl.glfw.GLFWCursorPosCallbackI;
88

9+
import com.onewhohears.dscombat.Config;
910
import com.onewhohears.dscombat.DSCombatMod;
1011
import com.onewhohears.dscombat.entity.aircraft.EntityAircraft;
1112
import com.onewhohears.dscombat.entity.parts.EntitySeat;
@@ -68,11 +69,12 @@ public static void cameraSetup(ViewportEvent.ComputeCameraAngles event) {
6869
}
6970
}
7071

71-
@SubscribeEvent
72+
@SubscribeEvent(priority = EventPriority.NORMAL)
7273
public static void clientTickSetMouseCallback(TickEvent.ClientTickEvent event) {
7374
Minecraft m = Minecraft.getInstance();
74-
if (m.player == null || m.player.tickCount != 1 || getVanillaOnMove() == null) return;
75-
// TODO make client config for custom mouse callback
75+
if (m.player == null || m.player.tickCount != 1) return;
76+
if (!Config.CLIENT.cameraTurnRelativeToVehicle.get()) return;
77+
if (getVanillaOnMove() == null) return;
7678
GLFW.glfwSetCursorPosCallback(m.getWindow().getWindow(), ClientCameraEvents.customMouseCallback);
7779
}
7880

src/main/java/com/onewhohears/dscombat/client/event/forgebus/ClientInputEvents.java

Lines changed: 54 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
import java.util.List;
44

5+
import com.onewhohears.dscombat.Config;
56
import com.onewhohears.dscombat.DSCombatMod;
6-
import com.onewhohears.dscombat.client.input.KeyInit;
7+
import com.onewhohears.dscombat.client.input.DSCKeys;
78
import com.onewhohears.dscombat.common.network.PacketHandler;
89
import com.onewhohears.dscombat.common.network.toserver.ToServerFlightControl;
910
import com.onewhohears.dscombat.common.network.toserver.ToServerShootTurret;
1011
import com.onewhohears.dscombat.common.network.toserver.ToServerSwitchSeat;
1112
import com.onewhohears.dscombat.data.radar.RadarData.RadarPing;
1213
import com.onewhohears.dscombat.data.radar.RadarSystem;
1314
import com.onewhohears.dscombat.entity.aircraft.EntityAircraft;
15+
import com.onewhohears.dscombat.entity.parts.EntitySeat;
1416
import com.onewhohears.dscombat.entity.parts.EntityTurret;
1517
import com.onewhohears.dscombat.util.math.UtilGeometry;
1618

@@ -21,6 +23,7 @@
2123
import net.minecraft.world.phys.HitResult.Type;
2224
import net.minecraftforge.api.distmarker.Dist;
2325
import net.minecraftforge.client.event.InputEvent;
26+
import net.minecraftforge.client.event.MovementInputUpdateEvent;
2427
import net.minecraftforge.event.TickEvent;
2528
import net.minecraftforge.event.TickEvent.Phase;
2629
import net.minecraftforge.eventbus.api.EventPriority;
@@ -34,65 +37,64 @@ public final class ClientInputEvents {
3437
private static double mouseCenterX = 0;
3538
private static double mouseCenterY = 0;
3639

37-
// TODO make client config for deadZone and max
38-
private static final double deadZone = 150;
39-
private static final double max = 1000;
40-
4140
private static final double tan1 = Math.tan(Math.toRadians(1));
4241

4342
private static int hoverIndex = -1;
4443

45-
@SubscribeEvent
44+
@SubscribeEvent(priority = EventPriority.HIGHEST)
4645
public static void clientTickPilotControl(TickEvent.ClientTickEvent event) {
4746
if (event.phase != Phase.END) return;
4847
Minecraft m = Minecraft.getInstance();
4948
final var player = m.player;
5049
if (player == null) return;
51-
boolean select = KeyInit.weaponSelectKey.consumeClick();
52-
boolean openMenu = KeyInit.planeMenuKey.consumeClick();
53-
boolean mouseMode = KeyInit.mouseModeKey.consumeClick();
54-
boolean gear = KeyInit.landingGear.consumeClick();
55-
boolean radarMode = KeyInit.radarModeKey.consumeClick();
50+
boolean select = DSCKeys.weaponSelectKey.consumeClick();
51+
boolean openMenu = DSCKeys.planeMenuKey.consumeClick();
52+
boolean mouseMode = DSCKeys.mouseModeKey.consumeClick();
53+
boolean gear = DSCKeys.landingGear.consumeClick();
54+
boolean radarMode = DSCKeys.radarModeKey.consumeClick();
5655
if (!player.isPassenger()) return;
5756
if (!(player.getRootVehicle() instanceof EntityAircraft plane)) return;
5857
Entity controller = plane.getControllingPassenger();
5958
if (controller == null || !controller.equals(player)) return;
60-
if (KeyInit.resetMouseKey.isDown()) centerMouse();
59+
if (DSCKeys.resetMouseKey.isDown()) centerMouse();
6160
else if (m.screen != null) centerMouse();
6261
double mouseX = m.mouseHandler.xpos() - mouseCenterX;
6362
double mouseY = -(m.mouseHandler.ypos() - mouseCenterY);
64-
boolean flare = KeyInit.flareKey.isDown();
65-
boolean shoot = KeyInit.shootKey.isDown();
66-
boolean flip = KeyInit.flipControlsKey.isDown();
67-
boolean special = KeyInit.specialKey.isDown();
63+
boolean flare = DSCKeys.flareKey.isDown();
64+
boolean shoot = DSCKeys.shootKey.isDown();
65+
boolean flip = DSCKeys.flipControlsKey.isDown();
66+
boolean special = DSCKeys.specialKey.isDown();
67+
boolean special2 = DSCKeys.special2Key.isDown();
6868
float pitch = 0, roll = 0, yaw = 0, throttle = 0;
6969
boolean pitchUp, pitchDown, yawLeft, yawRight;
7070
boolean rollLeft, rollRight, throttleUp, throttleDown;
7171
if (!plane.isFreeLook()) flip = !flip;
7272
if (flip) {
73-
pitchUp = KeyInit.throttleUpKey.isDown();
74-
pitchDown = KeyInit.throttleDownKey.isDown();
75-
yawLeft = KeyInit.rollLeftKey.isDown();
76-
yawRight = KeyInit.rollRightKey.isDown();
77-
rollLeft = KeyInit.yawLeftKey.isDown();
78-
rollRight = KeyInit.yawRightKey.isDown();
79-
throttleUp = KeyInit.pitchUpKey.isDown();
80-
throttleDown = KeyInit.pitchDownKey.isDown();
73+
pitchUp = DSCKeys.throttleUpKey.isDown();
74+
pitchDown = DSCKeys.throttleDownKey.isDown();
75+
yawLeft = DSCKeys.rollLeftKey.isDown();
76+
yawRight = DSCKeys.rollRightKey.isDown();
77+
rollLeft = DSCKeys.yawLeftKey.isDown();
78+
rollRight = DSCKeys.yawRightKey.isDown();
79+
throttleUp = DSCKeys.pitchUpKey.isDown();
80+
throttleDown = DSCKeys.pitchDownKey.isDown();
8181
} else {
82-
yawLeft = KeyInit.yawLeftKey.isDown();
83-
yawRight = KeyInit.yawRightKey.isDown();
84-
pitchUp = KeyInit.pitchUpKey.isDown();
85-
pitchDown = KeyInit.pitchDownKey.isDown();
86-
rollLeft = KeyInit.rollLeftKey.isDown();
87-
rollRight = KeyInit.rollRightKey.isDown();
88-
throttleUp = KeyInit.throttleUpKey.isDown();
89-
throttleDown = KeyInit.throttleDownKey.isDown();
82+
yawLeft = DSCKeys.yawLeftKey.isDown();
83+
yawRight = DSCKeys.yawRightKey.isDown();
84+
pitchUp = DSCKeys.pitchUpKey.isDown();
85+
pitchDown = DSCKeys.pitchDownKey.isDown();
86+
rollLeft = DSCKeys.rollLeftKey.isDown();
87+
rollRight = DSCKeys.rollRightKey.isDown();
88+
throttleUp = DSCKeys.throttleUpKey.isDown();
89+
throttleDown = DSCKeys.throttleDownKey.isDown();
9090
}
9191
if (!plane.isFreeLook()) {
9292
double ya = Math.abs(mouseY);
9393
double xa = Math.abs(mouseX);
9494
float ys = (float) Math.signum(mouseY);
9595
float xs = (float) Math.signum(mouseX);
96+
double deadZone = Config.CLIENT.mouseStickDeadzoneRadius.get();
97+
double max = Config.CLIENT.mouseModeMaxRadius.get();
9698
double md = max-deadZone;
9799
if (ya > max) {
98100
pitch = ys;
@@ -114,26 +116,26 @@ public static void clientTickPilotControl(TickEvent.ClientTickEvent event) {
114116
if (throttleUp) throttle += 1;
115117
if (throttleDown) throttle -= 1;
116118
PacketHandler.INSTANCE.sendToServer(new ToServerFlightControl(
117-
throttle, pitch, roll, yaw,
118-
mouseMode, flare, shoot, select, openMenu, gear,
119-
special, radarMode, rollLeft && rollRight));
120-
plane.updateControls(throttle, pitch, roll, yaw,
119+
throttle, pitch, roll, yaw, mouseMode,
120+
flare, shoot, select, openMenu, gear,
121+
special, special2, radarMode,
122+
rollLeft && rollRight));
123+
plane.updateControls(throttle, pitch, roll, yaw,
121124
mouseMode, flare, shoot, select, openMenu,
122-
special, radarMode, rollLeft && rollRight);
125+
special, special2, radarMode,
126+
rollLeft && rollRight);
123127
if (mouseMode && !plane.isFreeLook()) centerMouse();
124128
}
125129

126-
@SubscribeEvent
130+
@SubscribeEvent(priority = EventPriority.HIGH)
127131
public static void clientTickPassengerControl(TickEvent.ClientTickEvent event) {
128132
if (event.phase != Phase.END) return;
129133
Minecraft m = Minecraft.getInstance();
130134
final var player = m.player;
131135
if (player == null || !player.isPassenger()) return;
132136
if (!(player.getRootVehicle() instanceof EntityAircraft plane)) return;
133-
// DISMOUNT
134-
135137
// SWITCH SEAT
136-
if (KeyInit.changeSeat.consumeClick()) {
138+
if (DSCKeys.changeSeat.consumeClick()) {
137139
PacketHandler.INSTANCE.sendToServer(new ToServerSwitchSeat(plane.getId()));
138140
}
139141
// SELECT RADAR PING
@@ -151,10 +153,20 @@ public static void clientTickPassengerControl(TickEvent.ClientTickEvent event) {
151153
}
152154
if (!hovering) resetHoverIndex();
153155
// TURRET SHOOT
154-
boolean shoot = KeyInit.shootKey.isDown();
156+
boolean shoot = DSCKeys.shootKey.isDown();
155157
if (shoot && player.getVehicle() instanceof EntityTurret turret) {
156158
PacketHandler.INSTANCE.sendToServer(new ToServerShootTurret(turret));
157159
}
160+
161+
}
162+
163+
@SubscribeEvent(priority = EventPriority.NORMAL)
164+
public static void clientMoveInput(MovementInputUpdateEvent event) {
165+
Player player = event.getEntity();
166+
if (!(player.getVehicle() instanceof EntitySeat plane)) return;
167+
if (Config.CLIENT.customDismount.get()) {
168+
event.getInput().shiftKeyDown = DSCKeys.dismount.isDown();
169+
}
158170
}
159171

160172
public static void centerMouse() {

src/main/java/com/onewhohears/dscombat/client/event/forgebus/ClientRenderEvents.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static void playerRender(RenderPlayerEvent.Pre event) {
3434
float[] relangles = UtilAngles.globalToRelativeDegrees(player.getXRot(), player.getYRot(), q);
3535
player.setYBodyRot(relangles[1]);
3636
player.setYHeadRot(relangles[1]);
37-
// HOW set player head model part x rot to relangles[0]
37+
// HOW 2 set player head model part x rot to relangles[0]
3838
//event.getRenderer().getModel().head.xRot = (float) Math.toRadians(relangles[0]);
3939
//event.getRenderer().getModel().head.xRot = 0;
4040
/*event.getRenderer().getModel().setupAnim((LocalPlayer)player, 0f,
@@ -46,7 +46,7 @@ public static void onRenderPlayerHand(RenderHandEvent event) {
4646
Minecraft m = Minecraft.getInstance();
4747
final var player = m.player;
4848
if (!(player.getVehicle() instanceof EntitySeat seat)) return;
49-
// HOW revive vanilla hand swing effect
49+
// HOW 1 revive vanilla hand swing effect also mr crayfish guns doesn't visually work
5050
event.getPoseStack().setIdentity();
5151
}
5252

0 commit comments

Comments
 (0)