mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
i really hope this doesn't break anything
This commit is contained in:
parent
4086b8633d
commit
2a1575c578
@ -20,7 +20,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
|
||||
|
||||
private boolean[] keysPressed = new boolean[EnumKeybind.values().length];
|
||||
|
||||
public static final int dashCooldownLength = 10;
|
||||
public static final int dashCooldownLength = 5;
|
||||
public int dashCooldown = 0;
|
||||
|
||||
public int totalDashCount = 0;
|
||||
|
||||
@ -8,8 +8,11 @@ import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.config.RadiationConfig;
|
||||
import com.hbm.explosion.ExplosionNukeSmall;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.extprop.HbmLivingProps.ContaminationEffect;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.interfaces.IArmorModDash;
|
||||
import com.hbm.items.armor.ArmorFSB;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
@ -31,11 +34,13 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityEffectHandler {
|
||||
@ -76,6 +81,8 @@ public class EntityEffectHandler {
|
||||
handleRadiation(entity);
|
||||
handleDigamma(entity);
|
||||
handleLungDisease(entity);
|
||||
|
||||
handleDashing(entity);
|
||||
}
|
||||
|
||||
private static void handleContamination(EntityLivingBase entity) {
|
||||
@ -405,4 +412,92 @@ public class EntityEffectHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleDashing(Entity entity) {
|
||||
|
||||
//AAAAAAAAAAAAAAAAAAAAEEEEEEEEEEEEEEEEEEEE
|
||||
if(entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(player);
|
||||
|
||||
props.setDashCount(0);
|
||||
|
||||
ArmorFSB chestplate = null;
|
||||
|
||||
int armorDashCount = 0;
|
||||
int armorModDashCount = 0;
|
||||
|
||||
if(ArmorFSB.hasFSBArmor(player)) {
|
||||
ItemStack plate = player.inventory.armorInventory[2];
|
||||
|
||||
chestplate = (ArmorFSB)plate.getItem();
|
||||
}
|
||||
|
||||
if(chestplate != null)
|
||||
armorDashCount = chestplate.dashCount;
|
||||
|
||||
for(int armorSlot = 0; armorSlot < 4; armorSlot++) {
|
||||
ItemStack armorStack = player.inventory.armorInventory[armorSlot];
|
||||
|
||||
if(armorStack != null && armorStack.getItem() instanceof ItemArmor) {
|
||||
ItemArmor armor = (ItemArmor)armorStack.getItem();
|
||||
|
||||
for(int modSlot = 0; modSlot < 8; modSlot++) {
|
||||
ItemStack mod = ArmorModHandler.pryMods(armorStack)[modSlot];
|
||||
|
||||
if(mod != null && mod.getItem() instanceof IArmorModDash) {
|
||||
int count = ((IArmorModDash)mod.getItem()).getDashes();
|
||||
armorModDashCount += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int dashCount = armorDashCount + armorModDashCount;
|
||||
|
||||
//System.out.println(dashCount);
|
||||
|
||||
if(dashCount * 30 < props.getStamina())
|
||||
props.setStamina(dashCount * 30);
|
||||
|
||||
if(dashCount > 0) {
|
||||
|
||||
int perDash = 30;
|
||||
|
||||
props.setDashCount(dashCount);
|
||||
|
||||
int stamina = props.getStamina();
|
||||
|
||||
if(props.getDashCooldown() <= 0) {
|
||||
|
||||
if(!player.capabilities.isFlying && player.isSneaking() && stamina >= perDash) {
|
||||
|
||||
Vec3 lookingIn = player.getLookVec();
|
||||
|
||||
player.addVelocity(lookingIn.xCoord, 0, lookingIn.zCoord);
|
||||
player.playSound("hbm:player.dash", 1.0F, 1.0F);
|
||||
|
||||
props.setDashCooldown(HbmPlayerProps.dashCooldownLength);
|
||||
stamina -= perDash;
|
||||
}
|
||||
} else {
|
||||
props.setDashCooldown(props.getDashCooldown() - 1);
|
||||
}
|
||||
|
||||
if(stamina < props.getDashCount() * perDash) {
|
||||
stamina++;
|
||||
|
||||
if(stamina % perDash == perDash-1) {
|
||||
|
||||
player.playSound("hbm:player.dashRecharge", 1.0F, (1.0F + ((1F/12F)*(stamina/perDash))));
|
||||
stamina++;
|
||||
}
|
||||
}
|
||||
|
||||
props.setStamina(stamina);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
6
src/main/java/com/hbm/interfaces/IArmorModDash.java
Normal file
6
src/main/java/com/hbm/interfaces/IArmorModDash.java
Normal file
@ -0,0 +1,6 @@
|
||||
package com.hbm.interfaces;
|
||||
|
||||
public interface IArmorModDash {
|
||||
|
||||
public int getDashes();
|
||||
}
|
||||
@ -4812,7 +4812,7 @@ public class ModItems {
|
||||
.addEffect(new PotionEffect(Potion.moveSpeed.id, 20, 6))
|
||||
.addEffect(new PotionEffect(Potion.regeneration.id, 20, 1))
|
||||
.addEffect(new PotionEffect(Potion.nightVision.id, 15 * 20, 0))
|
||||
.setDashCount(6)
|
||||
.setDashCount(3)
|
||||
.setUnlocalizedName("bismuth_helmet").setTextureName(RefStrings.MODID + ":bismuth_helmet");
|
||||
bismuth_plate = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 1, RefStrings.MODID + ":textures/armor/starmetal_2.png").cloneStats((ArmorFSB) bismuth_helmet).setCap(8F).setMod(0.3F).setUnlocalizedName("bismuth_plate").setTextureName(RefStrings.MODID + ":bismuth_plate");
|
||||
bismuth_legs = new ArmorBismuth(MainRegistry.aMatBismuth, 7, 2, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) bismuth_helmet).setCap(8F).setMod(0.3F).setUnlocalizedName("bismuth_legs").setTextureName(RefStrings.MODID + ":bismuth_legs");
|
||||
|
||||
@ -462,7 +462,7 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
|
||||
} catch(Exception x) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(dashCount > 0) {
|
||||
|
||||
int perDash = 60;
|
||||
@ -478,6 +478,8 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
|
||||
if(!player.capabilities.isFlying && player.isSneaking() && stamina >= perDash) {
|
||||
|
||||
Vec3 lookingIn = player.getLookVec();
|
||||
lookingIn.yCoord = 0;
|
||||
lookingIn.normalize();
|
||||
player.addVelocity(lookingIn.xCoord, 0, lookingIn.zCoord);
|
||||
player.playSound("hbm:player.dash", 1.0F, 1.0F);
|
||||
|
||||
@ -499,7 +501,7 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
|
||||
}
|
||||
|
||||
props.setStamina(stamina);
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,42 +1,47 @@
|
||||
package com.hbm.items.armor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.hbm.handler.ArmorModHandler;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class ItemModV1 extends ItemArmorMod {
|
||||
|
||||
private static final UUID speed = UUID.fromString("1d11e63e-28c4-4e14-b09f-fe0bd1be708f");
|
||||
|
||||
public ItemModV1() {
|
||||
super(ArmorModHandler.extra, false, true, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getModifiers(ItemStack armor) {
|
||||
Multimap multimap = super.getAttributeModifiers(armor);
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(speed, "V1 SPEED", 0.5, 2));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
list.add(EnumChatFormatting.RED + "BLOOD IS FUEL");
|
||||
list.add("");
|
||||
super.addInformation(stack, player, list, bool);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDesc(List list, ItemStack stack, ItemStack armor) {
|
||||
list.add(EnumChatFormatting.RED + " " + stack.getDisplayName() + " (BLOOD IS FUEL)");
|
||||
}
|
||||
}
|
||||
package com.hbm.items.armor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.hbm.handler.ArmorModHandler;
|
||||
import com.hbm.interfaces.IArmorModDash;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class ItemModV1 extends ItemArmorMod implements IArmorModDash {
|
||||
|
||||
private static final UUID speed = UUID.fromString("1d11e63e-28c4-4e14-b09f-fe0bd1be708f");
|
||||
|
||||
public ItemModV1() {
|
||||
super(ArmorModHandler.extra, false, true, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap getModifiers(ItemStack armor) {
|
||||
Multimap multimap = super.getAttributeModifiers(armor);
|
||||
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(speed, "V1 SPEED", 0.5, 2));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
list.add(EnumChatFormatting.RED + "BLOOD IS FUEL");
|
||||
list.add("");
|
||||
super.addInformation(stack, player, list, bool);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDesc(List list, ItemStack stack, ItemStack armor) {
|
||||
list.add(EnumChatFormatting.RED + " " + stack.getDisplayName() + " (BLOOD IS FUEL)");
|
||||
}
|
||||
|
||||
public int getDashes() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,14 +246,12 @@ public class ModEventHandlerClient {
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
}
|
||||
if(ArmorFSB.hasFSBArmor(player)) {
|
||||
ArmorFSB chestplate = (ArmorFSB)player.inventory.armorInventory[2].getItem();
|
||||
if(chestplate.dashCount > 0) {
|
||||
HbmPlayerProps props = (HbmPlayerProps)player.getExtendedProperties("NTM_EXT_PLAYER");
|
||||
RenderScreenOverlay.renderDashBar(event.resolution, Minecraft.getMinecraft().ingameGUI, props);
|
||||
HbmPlayerProps props = HbmPlayerProps.getData(player);
|
||||
if(props.getDashCount() > 0) {
|
||||
RenderScreenOverlay.renderDashBar(event.resolution, Minecraft.getMinecraft().ingameGUI, props);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -206,8 +206,8 @@ public class RenderScreenOverlay {
|
||||
if(y == rows && x > finalColumns)
|
||||
break;
|
||||
gui.drawTexturedModalRect(posX + (width+2)*x, posY - 12*y, 76, 48, width, 10);
|
||||
int staminaDiv = stamina / 60;
|
||||
int staminaMod = stamina % 60;
|
||||
int staminaDiv = stamina / 30;
|
||||
int staminaMod = stamina % 30;
|
||||
int barID = (3*y)+x;
|
||||
int barStatus = 1; //0 = red, 1 = normal, 2 = greyed, 3 = dashed, 4 = ascended
|
||||
int barSize = width;
|
||||
@ -215,19 +215,19 @@ public class RenderScreenOverlay {
|
||||
barStatus = 3;
|
||||
} else if(staminaDiv == barID) {
|
||||
barStatus = 2;
|
||||
barSize = (int)((float)(stamina % 60) * (width/60F) );
|
||||
barSize = (int)((float)(stamina % 30) * (width/30F) );
|
||||
if(barID == 0)
|
||||
barStatus = 0;
|
||||
}
|
||||
gui.drawTexturedModalRect(posX + (width+2)*x, posY - 12*y, 76, 18+(10*barStatus), barSize, 10);
|
||||
|
||||
if(staminaDiv == barID && staminaMod >= 57) {
|
||||
if(staminaDiv == barID && staminaMod >= 27) {
|
||||
fadeOut = 1F;
|
||||
}
|
||||
if(fadeOut > 0 && staminaDiv-1 == barID) {
|
||||
GL11.glColor4f(1F, 1F, 1F, fadeOut);
|
||||
int bar = barID;
|
||||
if(stamina % 60 >= 50)
|
||||
if(stamina % 30 >= 25)
|
||||
bar++;
|
||||
int yPos = y;
|
||||
if(bar / 3 != y)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user