Fixed Keybinds and updated version number

This commit is contained in:
Tschipp 2017-08-27 22:14:20 +02:00
parent 15b2226da1
commit 66dffa7350
3 changed files with 45 additions and 15 deletions

View File

@ -27,7 +27,7 @@ public class CarryOn {
public static CarryOn instance;
public static final String MODID = "carryon";
public static final String VERSION = "1.2";
public static final String VERSION = "1.3";
public static final String NAME = "Carry On";
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
public static final Logger LOGGER = LogManager.getFormatterLogger("CarryOn");

View File

@ -1,8 +1,6 @@
package tschipp.carryon.client.event;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@ -36,13 +34,17 @@ import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import tschipp.carryon.CarryOn;
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
import tschipp.carryon.common.config.CarryOnConfig;
import tschipp.carryon.common.handler.ModelOverridesHandler;
import tschipp.carryon.common.handler.RegistrationHandler;
import tschipp.carryon.common.item.ItemEntity;
import tschipp.carryon.common.item.ItemTile;
import tschipp.carryon.network.server.SyncKeybindPacket;
public class RenderEvents
{
@ -65,6 +67,30 @@ public class RenderEvents
}
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPlayerTick(PlayerTickEvent event)
{
EntityPlayer player = event.player;
if (player != null && event.side == Side.CLIENT)
{
boolean keyPressed = CarryOnKeybinds.carryKey.isKeyDown();
boolean playerKeyPressed = CarryOnKeybinds.isKeyPressed(player);
if (keyPressed && !playerKeyPressed)
{
CarryOnKeybinds.setKeyPressed(player, true);
CarryOn.network.sendToServer(new SyncKeybindPacket(true));
}
else if(!keyPressed && playerKeyPressed)
{
CarryOnKeybinds.setKeyPressed(player, false);
CarryOn.network.sendToServer(new SyncKeybindPacket(false));
}
}
}
/*
* Prevents the Player from opening Guis
*/
@ -265,7 +291,6 @@ public class RenderEvents
GlStateManager.popMatrix();
}
}
/*
@ -276,7 +301,8 @@ public class RenderEvents
public void onPlayerRenderPre(RenderPlayerEvent.Pre event)
{
if (!Loader.isModLoaded("mobends") && CarryOnConfig.settings.renderArms) {
if (!Loader.isModLoaded("mobends") && CarryOnConfig.settings.renderArms)
{
EntityPlayer player = event.getEntityPlayer();
AbstractClientPlayer aplayer = (AbstractClientPlayer) player;
@ -289,18 +315,20 @@ public class RenderEvents
ModelRenderer fakeLeftArm = new ModelRenderer(model, 32, 48);
ModelRenderer fakeRightArm = new ModelRenderer(model, 40, 16);
player.setArrowCountInEntity(0); //TODO Temporary Fix
player.setArrowCountInEntity(0); // TODO Temporary Fix
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack)) || (stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack)))
{
if (model.bipedBody.childModels != null && !model.bipedBody.childModels.isEmpty())
{
for (int k = 0; k < model.bipedBody.childModels.size(); k++) {
for (int k = 0; k < model.bipedBody.childModels.size(); k++)
{
float chkRot = model.bipedBody.childModels.get(k).rotateAngleX;
if (chkRot == -0.9001F || chkRot == -1.2001F || chkRot == -1.4001F || chkRot == -1.7001F) {
if (chkRot == -0.9001F || chkRot == -1.2001F || chkRot == -1.4001F || chkRot == -1.7001F)
{
model.bipedBody.childModels.remove(k);
k = k -1;
k = k - 1;
}
}
@ -336,12 +364,12 @@ public class RenderEvents
{
if (!player.isSneaking())
{
fakeRightArm.rotateAngleX = -.9001F;
fakeRightArm.rotateAngleX = -.9001F;
fakeLeftArm.rotateAngleX = -.9001F;
}
else
{
fakeRightArm.rotateAngleX = -1.4001F;
fakeRightArm.rotateAngleX = -1.4001F;
fakeLeftArm.rotateAngleX = -1.4001F;
}
}
@ -373,9 +401,11 @@ public class RenderEvents
if (model.bipedBody.childModels != null && !model.bipedBody.childModels.isEmpty())
{
for (int k = 0; k < model.bipedBody.childModels.size(); k++) {
for (int k = 0; k < model.bipedBody.childModels.size(); k++)
{
float chkRot = model.bipedBody.childModels.get(k).rotateAngleX;
if (chkRot == - 0.9001F || chkRot == -1.2001F || chkRot == -1.4001F || chkRot == -1.7001F) {
if (chkRot == -0.9001F || chkRot == -1.2001F || chkRot == -1.4001F || chkRot == -1.7001F)
{
model.bipedBody.childModels.remove(k);
k = k - 1;
}
@ -383,7 +413,7 @@ public class RenderEvents
}
}
if (stack.isEmpty() || (stack.getItem() != RegistrationHandler.itemTile && stack.getItem() != RegistrationHandler.itemEntity))
if (stack.isEmpty() || (stack.getItem() != RegistrationHandler.itemTile && stack.getItem() != RegistrationHandler.itemEntity))
{
model.bipedLeftArm.isHidden = false;
model.bipedRightArm.isHidden = false;

View File

@ -2,7 +2,7 @@
{
"modid" : "carryon",
"name" : "Carry On",
"version" : "1.2", "mcversion" : "1.11.2",
"version" : "1.3", "mcversion" : "1.11.2",
"url" : "",
"credits" : "Tschipp, Purplicious_Cow, cy4n",
"authorList" : ["Tschipp, Purplicious_Cow, cy4n"],