aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/common
diff options
context:
space:
mode:
authorbotn365 <42187820+botn365@users.noreply.github.com>2019-12-08 12:54:21 +0100
committerGitHub <noreply@github.com>2019-12-08 12:54:21 +0100
commit584ebeaa18fba9de4922b09def9f7cf1b5d31eae (patch)
treef74277077620b21df5dae75083975be3ca11dc8a /src/Java/gtPlusPlus/core/common
parent9ba6d563d1b69bc8aa88d48754c273dae77aa713 (diff)
parente49fbd1330c0875ff531ff25119afe15b54c9448 (diff)
downloadGT5-Unofficial-584ebeaa18fba9de4922b09def9f7cf1b5d31eae.tar.gz
GT5-Unofficial-584ebeaa18fba9de4922b09def9f7cf1b5d31eae.tar.bz2
GT5-Unofficial-584ebeaa18fba9de4922b09def9f7cf1b5d31eae.zip
Merge pull request #1 from alkcorp/DevTop
Dev top
Diffstat (limited to 'src/Java/gtPlusPlus/core/common')
-rw-r--r--src/Java/gtPlusPlus/core/common/BasePlayer.java183
1 files changed, 22 insertions, 161 deletions
diff --git a/src/Java/gtPlusPlus/core/common/BasePlayer.java b/src/Java/gtPlusPlus/core/common/BasePlayer.java
index d60925102a..4686f34207 100644
--- a/src/Java/gtPlusPlus/core/common/BasePlayer.java
+++ b/src/Java/gtPlusPlus/core/common/BasePlayer.java
@@ -1,19 +1,14 @@
package gtPlusPlus.core.common;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.audio.PositionedSoundRecord;
-import net.minecraft.client.entity.EntityClientPlayerMP;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.settings.GameSettings;
-import net.minecraft.network.play.client.C0BPacketEntityAction;
-import net.minecraft.potion.Potion;
-import net.minecraft.util.MovementInputFromOptions;
-import net.minecraft.util.ResourceLocation;
-
import api.player.client.ClientPlayerAPI;
import api.player.client.ClientPlayerBase;
import gtPlusPlus.core.handler.events.CustomMovementHandler;
import gtPlusPlus.core.handler.events.SneakManager;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.settings.GameSettings;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.potion.Potion;
+import net.minecraft.util.MovementInputFromOptions;
public class BasePlayer extends ClientPlayerBase
{
@@ -30,8 +25,17 @@ public class BasePlayer extends ClientPlayerBase
* EntityPlayerSP.onLivingUpdate() - Adapted to PlayerAPI
*/
@Override
- public void onLivingUpdate()
- {
+ public void onLivingUpdate() {
+
+ super.onLivingUpdate();
+ EntityPlayer aPlayer = this.player;
+ if (aPlayer != null) {
+ SneakManager aSneak = SneakManager.get(aPlayer);
+ if (!aSneak.isWearingRing()) {
+ return;
+ }
+ }
+
if(this.player.sprintingTicksLeft > 0)
{
--this.player.sprintingTicksLeft;
@@ -57,54 +61,9 @@ public class BasePlayer extends ClientPlayerBase
}
else
{
- this.player.prevTimeInPortal = this.player.timeInPortal;
- if(this.playerAPI.getInPortalField())
- {
- if(this.mc.currentScreen != null)
- {
- this.mc.displayGuiScreen((GuiScreen)null);
- }
-
- if(this.player.timeInPortal == 0.0F)
- {
- this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("portal.trigger"), (this.player.getRNG().nextFloat() * 0.4F) + 0.8F));
- }
-
- this.player.timeInPortal += 0.0125F;
-
- if(this.player.timeInPortal >= 1.0F)
- {
- this.player.timeInPortal = 1.0F;
- }
-
- this.playerAPI.setInPortalField(false);
- }
- else if(this.player.isPotionActive(Potion.confusion) && (this.player.getActivePotionEffect(Potion.confusion).getDuration() > 60))
- {
- this.player.timeInPortal += 0.006666667F;
- if(this.player.timeInPortal > 1.0F)
- {
- this.player.timeInPortal = 1.0F;
- }
- }
- else
- {
- if(this.player.timeInPortal > 0.0F)
- {
- this.player.timeInPortal -= 0.05F;
- }
-
- if(this.player.timeInPortal < 0.0F)
- {
- this.player.timeInPortal = 0.0F;
- }
- }
- if(this.player.timeUntilPortal > 0)
- {
- --this.player.timeUntilPortal;
- }
+
final boolean isJumping = this.player.movementInput.jump;
@@ -112,23 +71,6 @@ public class BasePlayer extends ClientPlayerBase
final boolean isMovingForward = this.player.movementInput.moveForward >= minSpeed;
this.customMovementInput.update(this.mc, (MovementInputFromOptions)this.player.movementInput, this.player);
- if(this.player.isUsingItem() && !this.player.isRiding())
- {
- this.player.movementInput.moveStrafe *= 0.2F;
- this.player.movementInput.moveForward *= 0.2F;
- this.playerAPI.setSprintToggleTimerField(0);
- }
-
- if(this.player.movementInput.sneak && (this.player.ySize < 0.2F))
- {
- this.player.ySize = 0.2F;
- }
-
- this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D));
- this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D));
- this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D));
- this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D));
- final boolean enoughHunger = (this.player.getFoodStats().getFoodLevel() > 6.0F) || this.player.capabilities.isFlying;
/*
* Begin ToggleSneak Changes - ToggleSprint
@@ -151,7 +93,7 @@ public class BasePlayer extends ClientPlayerBase
if(isSprintDisabled)
{
//Utils.LOG_INFO("Sprint pressed");
- if(aSneak.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness))
+ if(aSneak.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness))
{
if((this.playerAPI.getSprintToggleTimerField() <= 0) && !this.settings.keyBindSprint.getIsKeyPressed())
{
@@ -170,7 +112,7 @@ public class BasePlayer extends ClientPlayerBase
}
}
- if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed())
+ if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed())
{
if (aSneak.Sprinting()){
this.player.setSprinting(true);
@@ -192,7 +134,7 @@ public class BasePlayer extends ClientPlayerBase
// 5/6/14 - onGround check removed to match vanilla's 'start sprint while jumping' behavior.
//if(this.player.onGround && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased)
- if(enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased)
+ if(!this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased)
{
if((canDoubleTap && !this.player.isSprinting()) || !canDoubleTap)
{
@@ -204,7 +146,7 @@ public class BasePlayer extends ClientPlayerBase
}
}
- if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness))
+ if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness))
{
if(this.playerAPI.getSprintToggleTimerField() == 0)
{
@@ -223,7 +165,7 @@ public class BasePlayer extends ClientPlayerBase
// If sprinting, break the sprint in appropriate circumstances:
// Player stops moving forward, runs into something, or gets too hungry
- if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally || !enoughHunger))
+ if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally))
{
this.player.setSprinting(false);
@@ -265,87 +207,6 @@ public class BasePlayer extends ClientPlayerBase
// this.handledDebugPress = false;
// }
- //
- // Fly Speed Boosting - Added 5/7/2014
- //
- if(this.player.capabilities.getFlySpeed() != 0.05F)
- {
- this.player.capabilities.setFlySpeed(0.05F);
- }
-
-
- if(this.player.capabilities.allowFlying && !isJumping && this.player.movementInput.jump)
- {
- if(this.playerAPI.getFlyToggleTimerField() == 0)
- {
- this.playerAPI.setFlyToggleTimerField(7);
- }
- else
- {
- this.player.capabilities.isFlying = !this.player.capabilities.isFlying;
- this.player.sendPlayerAbilities();
- this.playerAPI.setFlyToggleTimerField(0);
- }
- }
-
- if(this.player.capabilities.isFlying)
- {
- if(this.player.movementInput.sneak)
- {
- this.player.motionY -= 0.15D;
- }
- if(this.player.movementInput.jump)
- {
- this.player.motionY += 0.15D;
- }
- }
-
- if(this.player.isRidingHorse())
- {
- if(this.playerAPI.getHorseJumpPowerCounterField() < 0)
- {
- this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1);
- if(this.playerAPI.getHorseJumpPowerCounterField() == 0)
- {
- this.playerAPI.setHorseJumpPowerField(0.0F);
- }
- }
-
- if(isJumping && !this.player.movementInput.jump)
- {
- this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() - 10);
- this.playerAPI.setHorseJumpPowerCounterField(-10);
- ((EntityClientPlayerMP)this.player).sendQueue.addToSendQueue(new C0BPacketEntityAction(this.player, 6, (int)(this.player.getHorseJumpPower() * 100.0F)));
- }
- else if(!isJumping && this.player.movementInput.jump)
- {
- this.playerAPI.setHorseJumpPowerCounterField(0);
- this.playerAPI.setHorseJumpPowerField(0.0F);
- }
- else if(isJumping)
- {
- this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1);
- if(this.playerAPI.getHorseJumpPowerCounterField() < 10)
- {
- this.playerAPI.setHorseJumpPowerField(this.playerAPI.getHorseJumpPowerCounterField() * 0.1F);
- }
- else
- {
- this.playerAPI.setHorseJumpPowerField(0.8F + ((2.0F / (this.playerAPI.getHorseJumpPowerCounterField() - 9)) * 0.1F));
- }
- }
- }
- else
- {
- this.playerAPI.setHorseJumpPowerField(0.0F);
- }
-
- this.playerAPI.superOnLivingUpdate();
- if(this.player.onGround && this.player.capabilities.isFlying)
- {
- this.player.capabilities.isFlying = false;
- this.player.sendPlayerAbilities();
- }
}
}
} \ No newline at end of file