Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

version = "0.15.2-1.12.2"
version = "0.15.3-1.12.2"
group = "com.mrcrayfish.guns" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "guns"

Expand Down Expand Up @@ -42,7 +42,7 @@ repositories {

dependencies {
compile 'obfuscate:Obfuscate:0.2.6:1.12.2'
provided 'controllable:Controllable:1.12.2:0.3.0'
provided 'controllable:Controllable:1.12.2:0.8.0'
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mrcrayfish/guns/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class Reference
{
public static final String MOD_ID = "cgm";
public static final String MOD_NAME = "MrCrayfish's Gun Mod";
public static final String MOD_VERSION = "0.15.2";
public static final String MOD_VERSION = "0.15.3";
public static final String MC_VERSION = "[1.12.2]";
public static final String DEPENDENCIES = "required-after:obfuscate@[0.2.1,);after:controllable@[0.3.0,)";
public static final String PROXY_CLIENT = "com.mrcrayfish.guns.proxy.ClientProxy";
Expand Down
53 changes: 18 additions & 35 deletions src/main/java/com/mrcrayfish/guns/client/ControllerEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
*/
public class ControllerEvents
{
private boolean shooting = false;
private int reloadCounter = -1;

@SubscribeEvent
public void onButtonInput(ControllerEvent.ButtonInput event)
{
EntityPlayer player = Minecraft.getMinecraft().player;
World world = Minecraft.getMinecraft().world;
if(player != null && world != null)
if(player != null && world != null && Minecraft.getMinecraft().currentScreen == null)
{
ItemStack heldItem = player.getHeldItemMainhand();
switch(event.getButton())
Expand All @@ -52,11 +51,6 @@ public void onButtonInput(ControllerEvent.ButtonInput event)
}
break;
case Buttons.LEFT_TRIGGER:
if(heldItem.getItem() instanceof ItemGun)
{
event.setCanceled(true);
}
break;
case Buttons.RIGHT_THUMB_STICK:
if(heldItem.getItem() instanceof ItemGun)
{
Expand All @@ -69,7 +63,7 @@ public void onButtonInput(ControllerEvent.ButtonInput event)
event.setCanceled(true);
if(event.getState())
{
reloadCounter = 0;
this.reloadCounter = 0;
}
}
break;
Expand All @@ -93,27 +87,14 @@ public void onControllerTurn(ControllerEvent.Turn event)
if (scope != null)
{
ItemScope.Type scopeType = ItemScope.Type.getFromStack(scope);
if(scopeType != null)
switch(scopeType)
{
switch(scopeType)
{
case LONG:
if(event.getController().getState().rightStickClick)
{
event.setYawSpeed(1.5F);
event.setPitchSpeed(1.0F);
}
else
{
event.setYawSpeed(3.5F);
event.setPitchSpeed(3.0F);
}
break;
case MEDIUM:
event.setYawSpeed(6.66F);
event.setPitchSpeed(5.0F);
break;
}
case LONG:
case MEDIUM:
boolean isSteadyAiming = event.getController().isButtonPressed(Buttons.RIGHT_THUMB_STICK);
event.setYawSpeed(isSteadyAiming ? 2.5F : 5.0F);
event.setPitchSpeed(isSteadyAiming ? 1.875F : 3.75F);
break;
}
}
}
Expand All @@ -124,8 +105,7 @@ public void onControllerTurn(ControllerEvent.Turn event)
public void updateAvailableActions(AvailableActionsEvent event)
{
Minecraft mc = Minecraft.getMinecraft();
if(mc.currentScreen != null)
return;
if(mc.currentScreen != null) return;

EntityPlayer player = Minecraft.getMinecraft().player;
if(player != null)
Expand All @@ -147,9 +127,12 @@ public void updateAvailableActions(AvailableActionsEvent event)
if (scope != null && MrCrayfishGunMod.proxy.isZooming())
{
ItemScope.Type scopeType = ItemScope.Type.getFromStack(scope);
if(scopeType == ItemScope.Type.LONG)
switch(scopeType)
{
event.getActions().put(Buttons.RIGHT_THUMB_STICK, new Action("Hold Breath", Action.Side.RIGHT));
case LONG:
case MEDIUM:
event.getActions().put(Buttons.RIGHT_THUMB_STICK, new Action("Steady Aim", Action.Side.RIGHT));
break;
}
}
}
Expand All @@ -171,7 +154,7 @@ public void onRender(TickEvent.RenderTickEvent event)
if(player == null)
return;

if(controller.getState().rightTrigger > 0.05)
if(controller.isButtonPressed(Buttons.RIGHT_TRIGGER) && Minecraft.getMinecraft().currentScreen == null)
{
ItemStack heldItem = player.getHeldItemMainhand();
if(heldItem.getItem() instanceof ItemGun)
Expand All @@ -186,7 +169,7 @@ public void onRender(TickEvent.RenderTickEvent event)

if(mc.currentScreen == null && reloadCounter != -1)
{
if(controller.getState().x)
if(controller.isButtonPressed(Buttons.X))
{
reloadCounter++;
}
Expand All @@ -198,7 +181,7 @@ public void onRender(TickEvent.RenderTickEvent event)
PacketHandler.INSTANCE.sendToServer(new MessageUnload());
reloadCounter = -1;
}
else if(reloadCounter > 0 && !controller.getState().x)
else if(reloadCounter > 0 && !controller.isButtonPressed(Buttons.X))
{
if(!Minecraft.getMinecraft().player.getDataManager().get(CommonEvents.RELOADING))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mrcrayfish.guns.client.render.gun.model;

import com.mrcrayfish.controllable.Controllable;
import com.mrcrayfish.controllable.client.Buttons;
import com.mrcrayfish.controllable.client.Controller;
import com.mrcrayfish.guns.GunConfig;
import com.mrcrayfish.guns.client.render.gun.IOverrideModel;
Expand Down Expand Up @@ -37,7 +38,7 @@ public void tick(EntityLivingBase entity)
Controller controller = Controllable.getController();
if(controller != null)
{
shooting |= controller.getState().rightTrigger >= 0.5;
shooting |= controller.isButtonPressed(Buttons.RIGHT_TRIGGER);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/mrcrayfish/guns/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mrcrayfish.guns.proxy;

import com.mrcrayfish.controllable.Controllable;
import com.mrcrayfish.controllable.client.Buttons;
import com.mrcrayfish.controllable.client.Controller;
import com.mrcrayfish.guns.GunConfig;
import com.mrcrayfish.guns.client.ControllerEvents;
Expand Down Expand Up @@ -209,7 +210,7 @@ public boolean isZooming()
Controller controller = Controllable.getController();
if(controller != null)
{
zooming |= controller.getLTriggerValue() >= 0.5;
zooming |= controller.isButtonPressed(Buttons.LEFT_TRIGGER);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "cgm",
"name": "MrCrayfish's Gun Mod",
"description": "Adds Guns in Minecraft. Created as a part of MrCrayfish's Mod Week",
"version": "0.15.2",
"version": "0.15.3",
"mcversion": "1.12.2",
"url": "",
"updateUrl": "",
Expand Down