aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/common
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-12-30 01:48:09 +0000
committerGitHub <noreply@github.com>2019-12-30 01:48:09 +0000
commit5af823e80a611090216375fecd3794d345446830 (patch)
treec54a19977b4a25cb86f54394eb9711aaf268efe3 /src/Java/gtPlusPlus/core/common
parenta731e939c6b9a70ac9fd444dbf06243f63f29c06 (diff)
parentcc825179dce70a5f2c4a13730639e3300243e21a (diff)
downloadGT5-Unofficial-5af823e80a611090216375fecd3794d345446830.tar.gz
GT5-Unofficial-5af823e80a611090216375fecd3794d345446830.tar.bz2
GT5-Unofficial-5af823e80a611090216375fecd3794d345446830.zip
Merge pull request #525 from alkcorp/DevTop
+ 6 Months of work, let's get the ball rolling.
Diffstat (limited to 'src/Java/gtPlusPlus/core/common')
-rw-r--r--src/Java/gtPlusPlus/core/common/BasePlayer.java213
-rw-r--r--src/Java/gtPlusPlus/core/common/CommonProxy.java61
-rw-r--r--src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java2
3 files changed, 96 insertions, 180 deletions
diff --git a/src/Java/gtPlusPlus/core/common/BasePlayer.java b/src/Java/gtPlusPlus/core/common/BasePlayer.java
index 1b3f67b8d6..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,44 +71,29 @@ 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
*/
+ SneakManager aSneak = SneakManager.get(this.player);
final boolean isSprintDisabled = false;
- final boolean canDoubleTap = SneakManager.optionDoubleTap;
+ final boolean canDoubleTap = aSneak.optionDoubleTap;
+
// Detect when ToggleSprint was disabled in the in-game options menu
- if(SneakManager.wasSprintDisabled)
+ if(aSneak.wasSprintDisabled)
{
this.player.setSprinting(false);
- this.customMovementInput.UpdateSprint(false, false);
- SneakManager.wasSprintDisabled = false;
+ this.customMovementInput.UpdateSprint(false, false, aSneak);
+ aSneak.wasSprintDisabled = false;
}
// Default Sprint routine converted to PlayerAPI, use if ToggleSprint is disabled - TODO - Disable sprinting as a whole
if(isSprintDisabled)
{
//Utils.LOG_INFO("Sprint pressed");
- if(SneakManager.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())
{
@@ -157,26 +101,26 @@ public class BasePlayer extends ClientPlayerBase
}
else
{
- if (SneakManager.Sprinting()){
+ if (aSneak.Sprinting()){
this.player.setSprinting(true);
- this.customMovementInput.UpdateSprint(true, false);
+ this.customMovementInput.UpdateSprint(true, false, aSneak);
}
else {
this.player.setSprinting(false);
- this.customMovementInput.UpdateSprint(false, false);
+ this.customMovementInput.UpdateSprint(false, false, aSneak);
}
}
}
- 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 (SneakManager.Sprinting()){
+ if (aSneak.Sprinting()){
this.player.setSprinting(true);
- this.customMovementInput.UpdateSprint(true, false);
+ this.customMovementInput.UpdateSprint(true, false, aSneak);
}
else {
this.player.setSprinting(false);
- this.customMovementInput.UpdateSprint(false, false);
+ this.customMovementInput.UpdateSprint(false, false, aSneak);
}
}
}
@@ -190,11 +134,11 @@ 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)
{
- if (SneakManager.Sprinting()){
+ if (aSneak.Sprinting()){
this.player.setSprinting(state);
} else {
this.player.setSprinting(false);
@@ -202,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)
{
@@ -210,9 +154,9 @@ public class BasePlayer extends ClientPlayerBase
}
else
{
- if (SneakManager.Sprinting()){
+ if (aSneak.Sprinting()){
this.player.setSprinting(true);
- this.customMovementInput.UpdateSprint(true, true);
+ this.customMovementInput.UpdateSprint(true, true, aSneak);
this.playerAPI.setSprintToggleTimerField(0);
}
}
@@ -221,14 +165,14 @@ 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);
// Undo toggle if we resumed vanilla operation due to Hold&Release, DoubleTap, Fly, Ride
if ((this.customMovementInput.sprintHeldAndReleased == true) || isSprintDisabled || this.customMovementInput.sprintDoubleTapped || this.player.capabilities.isFlying || this.player.isRiding())
{
- this.customMovementInput.UpdateSprint(false, false);
+ this.customMovementInput.UpdateSprint(false, false, aSneak);
}
}
@@ -263,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
diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java
index 03b0f944b7..1ce16bf4de 100644
--- a/src/Java/gtPlusPlus/core/common/CommonProxy.java
+++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java
@@ -12,6 +12,8 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.OrePrefixes;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.Pair;
import gtPlusPlus.api.objects.minecraft.ChunkManager;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.creative.AddToCreativeTab;
@@ -51,12 +53,14 @@ import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner;
import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO;
import gtPlusPlus.xmod.galacticraft.handler.HandlerTooltip_GC;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
-import gtPlusPlus.xmod.thermalfoundation.item.TF_Items;
+import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityZombie;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.common.ForgeChunkManager;
public class CommonProxy {
@@ -144,6 +148,8 @@ public class CommonProxy {
// Block Handler for all events.
Utils.registerEvent(new BlockEventHandler());
Utils.registerEvent(new GeneralTooltipEventHandler());
+ // Handles Tooltips for items giving custom multiblock behaviour
+ Utils.registerEvent(new SpecialBehaviourTooltipHandler());
// Handles Custom tooltips for EIO.
Utils.registerEvent(new HandlerTooltip_EIO());
// Handles Custom Tooltips for GC
@@ -187,12 +193,22 @@ public class CommonProxy {
}
// Compat Handling
+ Logger.INFO("Removing recipes from other mods.");
COMPAT_HANDLER.RemoveRecipesFromOtherMods();
+ Logger.INFO("Initialising Handler, Then Adding Recipes");
COMPAT_HANDLER.InitialiseHandlerThenAddRecipes();
- COMPAT_HANDLER.startLoadingGregAPIBasedRecipes();
+ Logger.INFO("Loading Intermod staging.");
COMPAT_IntermodStaging.postInit(e);
+ Logger.INFO("Loading queued recipes.");
COMPAT_HANDLER.runQueuedRecipes();
+ Logger.INFO("Registering custom mob drops.");
registerCustomMobDrops();
+
+ // Moved last in postInit().
+ // 12/12/19 - Alkalus
+ // Moved last, to prevent recipes being generated post initialisation.
+ Logger.INFO("Loading Gregtech API recipes.");
+ COMPAT_HANDLER.startLoadingGregAPIBasedRecipes();
}
public void serverStarting(final FMLServerStartingEvent e) {
@@ -258,7 +274,7 @@ public class CommonProxy {
//Special mobs Support
if (ReflectionUtils.doesClassExist("toast.specialMobs.entity.zombie.EntityBrutishZombie")) {
- Class aBrutishZombie = ReflectionUtils.getClass("toast.specialMobs.entity.zombie.EntityBrutishZombie");
+ Class<?> aBrutishZombie = ReflectionUtils.getClass("toast.specialMobs.entity.zombie.EntityBrutishZombie");
ItemStack aFortune1 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1);
ItemStack aFortune2 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1);
ItemStack aFortune3 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1);
@@ -268,8 +284,45 @@ public class CommonProxy {
EntityUtils.registerDropsForMob(aBrutishZombie, ItemUtils.getItemStackOfAmountFromOreDict("ingotRedAlloy", 1), 3, 200);
}
+ //GalaxySpace Support
+ if (ReflectionUtils.doesClassExist("galaxyspace.SolarSystem.moons.europa.entities.EntityEvolvedColdBlaze")) {
+ Class<?> aColdBlaze = ReflectionUtils.getClass("galaxyspace.SolarSystem.moons.europa.entities.EntityEvolvedColdBlaze");
+ ItemStack aSmallBlizz, aTinyBlizz, aSmallCryo, aTinyCryo;
+ aSmallBlizz = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallBlizz", 1);
+ aTinyBlizz = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyBlizz", 1);
+ aSmallCryo = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallCryotheum", 1);
+ aTinyCryo = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyCryotheum", 1);
+ EntityUtils.registerDropsForMob(aColdBlaze, ItemUtils.getItemStackOfAmountFromOreDict("stickBlizz", 1), 2, 500);
+ if (aSmallBlizz != null) {
+ EntityUtils.registerDropsForMob(aColdBlaze, aSmallBlizz, 2, 750);
+ }
+ if (aTinyBlizz != null) {
+ EntityUtils.registerDropsForMob(aColdBlaze, aTinyBlizz, 4, 1500);
+ }
+ if (aSmallCryo != null) {
+ EntityUtils.registerDropsForMob(aColdBlaze, aSmallCryo, 1, 50);
+ }
+ if (aTinyCryo != null) {
+ EntityUtils.registerDropsForMob(aColdBlaze, aTinyCryo, 2, 100);
+ }
+ }
-
+ }
+
+ protected final AutoMap<Pair<Item, IItemRenderer>> mItemRenderMappings = new AutoMap<Pair<Item, IItemRenderer>>();
+
+
+ public static void registerItemRendererGlobal(Item aItem, IItemRenderer aRenderer) {
+ GTplusplus.proxy.registerItemRenderer(aItem, aRenderer);
+ }
+
+ public void registerItemRenderer(Item aItem, IItemRenderer aRenderer) {
+ if (Utils.isServer()) {
+ return;
+ }
+ else {
+ mItemRenderMappings.add(new Pair<Item, IItemRenderer>(aItem, aRenderer));
+ }
}
}
diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java
index 06467503d8..12b3a94083 100644
--- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java
+++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java
@@ -23,7 +23,7 @@ public class COMPAT_PlayerAPI {
public static class clientProxy{
public static void initPre(){
- Utils.registerEvent(SneakManager.instance);
+ //Utils.registerEvent(SneakManager.instance);
}
public static void Init(){