Skip to content

Commit 3bcbbcc

Browse files
authored
Merge pull request #5 from N3ROO/MC_1.16.3_dev
Version 1.3.0
2 parents a47a685 + bdf8a42 commit 3bcbbcc

File tree

6 files changed

+48
-9
lines changed

6 files changed

+48
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Version 1.3.0
2+
3+
- Support for the best controller mod - [Controllable](https://mrcrayfish.com/mods?id=controllable)
4+
15
## Version 1.2.1
26

37
- The config file is now reloaded automatically when updated

build.gradle

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
buildscript {
22
repositories {
3-
maven { url = 'https://files.minecraftforge.net/maven' }
3+
maven {
4+
url = 'https://files.minecraftforge.net/maven'
5+
}
46
jcenter()
57
mavenCentral()
68
}
@@ -13,15 +15,16 @@ apply plugin: 'net.minecraftforge.gradle'
1315
apply plugin: 'eclipse'
1416
apply plugin: 'maven-publish'
1517

16-
version = '1.2.1-MC1.16.x'
18+
version = '1.3.0-MC1.16.x'
1719
group = 'dev.nero.aimassistance' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
1820
archivesBaseName = 'aimassistance'
1921

2022
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
2123

2224
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
2325
minecraft {
24-
mappings channel: 'snapshot', version: '20200514-1.16'
26+
//mappings channel: 'snapshot', version: '20200514-1.16'
27+
mappings channel: 'snapshot', version: '20200707-1.16.1'
2528

2629
runs {
2730
client {
@@ -42,6 +45,13 @@ minecraft {
4245
}
4346
}
4447

48+
repositories {
49+
maven {
50+
url = "https://www.cursemaven.com"
51+
}
52+
}
53+
4554
dependencies {
4655
minecraft 'net.minecraftforge:forge:1.16.3-34.1.0'
56+
compile fg.deobf('curse.maven:controllable:3068902')
4757
}

src/main/java/dev/nero/aimassistance/AimAssistanceMod.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
import net.minecraftforge.common.MinecraftForge;
88
import net.minecraftforge.event.TickEvent;
99
import net.minecraftforge.eventbus.api.SubscribeEvent;
10+
import net.minecraftforge.fml.ModList;
1011
import net.minecraftforge.fml.ModLoadingContext;
1112
import net.minecraftforge.fml.common.Mod;
1213
import net.minecraftforge.fml.config.ModConfig;
14+
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
1315
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
1416
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
1517

@@ -21,11 +23,13 @@ public class AimAssistanceMod
2123
// private static final Logger LOGGER = LogManager.getLogger();
2224

2325
public static final String MOD_ID = "aimassistancemod";
26+
public static final String CONTROLLABLE_MOD_ID = "controllable";
2427
private AimAssistance aimAssistance;
2528

2629
public AimAssistanceMod() {
2730
// Register the setup method for modloading
28-
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
31+
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onCommonSetup);
32+
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
2933

3034
// Register ourselves for server and other game events we are interested in
3135
MinecraftForge.EVENT_BUS.register(this);
@@ -34,11 +38,18 @@ public AimAssistanceMod() {
3438
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Config.CLIENT_SPEC);
3539
}
3640

37-
private void setup(final FMLCommonSetupEvent event) {
41+
private void onCommonSetup(final FMLCommonSetupEvent event) {
3842
aimAssistance = new AimAssistance();
3943
Config.bakeConfig(); // init config values
4044
}
4145

46+
private void onClientSetup(final FMLClientSetupEvent event) {
47+
if(ModList.get().isLoaded(CONTROLLABLE_MOD_ID))
48+
{
49+
Wrapper.setSupportForControllable(ModList.get().isLoaded(CONTROLLABLE_MOD_ID));
50+
}
51+
}
52+
4253
@SubscribeEvent
4354
public void onPlayerTick(TickEvent.PlayerTickEvent playerTickEvent) {
4455
if (Wrapper.playerPlaying()) {

src/main/java/dev/nero/aimassistance/utils/Wrapper.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.nero.aimassistance.utils;
22

3+
import com.mrcrayfish.controllable.Controllable;
34
import dev.nero.aimassistance.core.Target;
45
import dev.nero.aimassistance.core.TargetType;
56
import net.minecraft.client.Minecraft;
@@ -12,6 +13,14 @@
1213
public class Wrapper {
1314

1415
public static Minecraft MC = Minecraft.getInstance();
16+
private static boolean supportForControllable;
17+
18+
/**
19+
* @param support if true, it will use the Controllable mod events
20+
*/
21+
public static void setSupportForControllable(boolean support) {
22+
supportForControllable = support;
23+
}
1524

1625
/**
1726
* @return true if the player is playing
@@ -24,7 +33,10 @@ public static boolean playerPlaying() {
2433
* @return true if the player is pressing the attack key
2534
*/
2635
public static boolean attackKeyPressed() {
27-
return Wrapper.MC.gameSettings.keyBindAttack.isKeyDown();
36+
// could use that as well: GLFW.glfwGetMouseButton(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS;
37+
boolean attackPressed = Wrapper.MC.gameSettings.keyBindAttack.isKeyDown(); // vanilla
38+
attackPressed |= supportForControllable && Controllable.getController() != null && Controllable.getController().getRTriggerValue() != 0.0F; // controller
39+
return attackPressed;
2840
}
2941

3042
/**

src/main/resources/META-INF/mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license="MIT License"
55

66
[[mods]]
77
modId="aimassistancemod"
8-
version="1.2.1"
8+
version="1.3.0"
99
displayName="Aim Assistance"
1010
updateJSONURL="https://raw.githubusercontent.com/N3ROO/AimAssistanceMod/MC_1.16.3/update.json"
1111
displayURL="https://github.com/N3ROO/AimAssistanceMod/"

update.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"homepage": "https://github.com/N3ROO/AimAssistanceMod/releases",
33
"promos": {
4-
"1.16.3-latest": "1.2.1",
5-
"1.16.3-recommended": "1.2.1"
4+
"1.16.3-latest": "1.3.0",
5+
"1.16.3-recommended": "1.3.0",
6+
"1.15.2-latest": "1.2.0",
7+
"1.15.2-recommended": "1.2.0"
68
}
79
}

0 commit comments

Comments
 (0)