xanax, it's xanax

This commit is contained in:
Bob 2021-01-11 22:50:37 +01:00
parent b49e2ded8e
commit 6972a6825e
20 changed files with 212 additions and 87 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

View File

@ -2,6 +2,7 @@ package com.hbm.entity.mob.botprime;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.interfaces.IRadiationImmune;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
@ -10,7 +11,7 @@ import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class EntityBOTPrimeBase extends EntityWormBaseNT {
public abstract class EntityBOTPrimeBase extends EntityWormBaseNT implements IRadiationImmune {
public int attackCounter = 0;

View File

@ -0,0 +1,132 @@
package com.hbm.extprop;
import java.util.UUID;
import com.hbm.lib.ModDamageSource;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
public class HbmLivingProps implements IExtendedEntityProperties {
public static final String key = "NTM_EXT_LIVING";
public static final UUID digamma_UUID = UUID.fromString("2a3d8aec-5ab9-4218-9b8b-ca812bdf378b");
public EntityLivingBase entity;
/// VALS ///
private float radiation;
private float digamma;
public HbmLivingProps(EntityLivingBase entity) {
this.entity = entity;
}
/// DATA ///
public static HbmLivingProps registerData(EntityLivingBase entity) {
entity.registerExtendedProperties(key, new HbmLivingProps(entity));
return (HbmLivingProps) entity.getExtendedProperties(key);
}
public static HbmLivingProps getData(EntityLivingBase entity) {
HbmLivingProps props = (HbmLivingProps) entity.getExtendedProperties(key);
return props != null ? props : registerData(entity);
}
/// RADIATION ///
public static float getRadiation(EntityLivingBase entity) {
return getData(entity).radiation;
}
public static void setRadiation(EntityLivingBase entity, float rad) {
getData(entity).radiation = rad;
}
public static void incrementRadiation(EntityLivingBase entity, float rad) {
HbmLivingProps data = getData(entity);
float radiation = getData(entity).radiation + rad;
if(radiation > 2500)
radiation = 2500;
if(radiation < 0)
radiation = 0;
data.setRadiation(entity, radiation);
}
/// DIGAMA ///
public static float getDigamma(EntityLivingBase entity) {
return getData(entity).digamma;
}
public static void setDigamma(EntityLivingBase entity, float digamma) {
getData(entity).digamma = digamma;
float healthMod = (float)Math.pow(0.5, digamma) - 1F;
IAttributeInstance attributeinstance = entity.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
try {
attributeinstance.removeModifier(attributeinstance.getModifier(digamma_UUID));
} catch(Exception ex) { }
attributeinstance.applyModifier(new AttributeModifier(digamma_UUID, "digamma", healthMod, 2));
if(entity.getHealth() > entity.getMaxHealth()) {
entity.setHealth(entity.getMaxHealth());
}
if((entity.getMaxHealth() <= 0 || digamma >= 10.0F) && entity.isEntityAlive()) {
entity.setAbsorptionAmount(0);
entity.attackEntityFrom(ModDamageSource.radiation, 500F);
entity.setHealth(0);
if(entity.isEntityAlive())
entity.onDeath(ModDamageSource.radiation);
}
}
public static void incrementDigamma(EntityLivingBase entity, float digamma) {
HbmLivingProps data = getData(entity);
float dRad = getDigamma(entity) + digamma;
if(dRad > 10)
dRad = 10;
if(dRad < 0)
dRad = 0;
data.setDigamma(entity, dRad);
}
@Override
public void init(Entity entity, World world) { }
@Override
public void saveNBTData(NBTTagCompound nbt) {
NBTTagCompound props = new NBTTagCompound();
props.setFloat("hfr_radiation", radiation);
props.setFloat("hfr_digamma", digamma);
nbt.setTag("HbmLivingProps", props);
}
@Override
public void loadNBTData(NBTTagCompound nbt) {
NBTTagCompound props = (NBTTagCompound) nbt.getTag("HbmLivingProps");
if(props != null) {
radiation = props.getFloat("hfr_radiation");
digamma = props.getFloat("hfr_digamma");
}
}
}

View File

@ -8,26 +8,26 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
public class HbmExtendedProperties implements IExtendedEntityProperties {
public class HbmPlayerProps implements IExtendedEntityProperties {
public static final String key = "NTM_EXT_PROPS";
public static final String key = "NTM_EXT_PLAYER";
public EntityPlayer player;
private boolean[] keysPressed = new boolean[EnumKeybind.values().length];
public HbmExtendedProperties(EntityPlayer player) {
public HbmPlayerProps(EntityPlayer player) {
this.player = player;
}
public static HbmExtendedProperties registerData(EntityPlayer player) {
public static HbmPlayerProps registerData(EntityPlayer player) {
player.registerExtendedProperties(key, new HbmExtendedProperties(player));
return (HbmExtendedProperties) player.getExtendedProperties(key);
player.registerExtendedProperties(key, new HbmPlayerProps(player));
return (HbmPlayerProps) player.getExtendedProperties(key);
}
public static HbmExtendedProperties getData(EntityPlayer player) {
public static HbmPlayerProps getData(EntityPlayer player) {
HbmExtendedProperties props = (HbmExtendedProperties) player.getExtendedProperties(key);
HbmPlayerProps props = (HbmPlayerProps) player.getExtendedProperties(key);
return props != null ? props : registerData(player);
}

View File

@ -3823,10 +3823,10 @@ public class ModItems {
.addEffect(new PotionEffect(Potion.jump.id, 20, 0))
.setBlastProtection(0.25F)
.setMod(0.2F)
.setFireproof(true)
.setHasGeigerSound(true)
.setHasCustomGeiger(true)
.addResistance("fall", 0.5F).setUnlocalizedName("hev_helmet").setTextureName(RefStrings.MODID + ":hev_helmet");
.addResistance("fall", 0.5F)
.addResistance("onFire", 0F).setUnlocalizedName("hev_helmet").setTextureName(RefStrings.MODID + ":hev_helmet");
hev_plate = new ArmorHEV(aMatHEV, 7, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png", 1000000, 10000, 2500, 0).cloneStats((ArmorFSB) hev_helmet).setUnlocalizedName("hev_plate").setTextureName(RefStrings.MODID + ":hev_plate");
hev_legs = new ArmorHEV(aMatHEV, 7, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", 1000000, 10000, 2500, 0).cloneStats((ArmorFSB) hev_helmet).setUnlocalizedName("hev_legs").setTextureName(RefStrings.MODID + ":hev_legs");
hev_boots = new ArmorHEV(aMatHEV, 7, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", 1000000, 10000, 2500, 0).cloneStats((ArmorFSB) hev_helmet).setUnlocalizedName("hev_boots").setTextureName(RefStrings.MODID + ":hev_boots");

View File

@ -2,7 +2,7 @@ package com.hbm.items.armor;
import java.util.List;
import com.hbm.extprop.HbmExtendedProperties;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
@ -47,7 +47,7 @@ public class ArmorBJJetpack extends ArmorBJ {
super.onArmorTick(world, player, stack);
HbmExtendedProperties props = HbmExtendedProperties.getData(player);
HbmPlayerProps props = HbmPlayerProps.getData(player);
if(world.isRemote) {

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.lwjgl.opengl.GL11;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.items.ModItems;
import com.hbm.render.model.ModelArmorHEV;
import com.hbm.saveddata.RadiationSavedData;
@ -75,8 +76,7 @@ public class ArmorHEV extends ArmorFSBPowered {
private void renderOverlay(RenderGameOverlayEvent.Pre event, EntityPlayer player) {
float in = 0;
in = player.getEntityData().getFloat("hfr_radiation");
float in = HbmLivingProps.getRadiation(player);
float radiation = 0;

View File

@ -2,7 +2,7 @@ package com.hbm.items.armor;
import java.util.List;
import com.hbm.extprop.HbmExtendedProperties;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.main.MainRegistry;
@ -33,7 +33,7 @@ public class JetpackBooster extends JetpackBase {
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
HbmExtendedProperties props = HbmExtendedProperties.getData(player);
HbmPlayerProps props = HbmPlayerProps.getData(player);
if(world.isRemote) {

View File

@ -2,7 +2,7 @@ package com.hbm.items.armor;
import java.util.List;
import com.hbm.extprop.HbmExtendedProperties;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.main.MainRegistry;
@ -34,7 +34,7 @@ public class JetpackBreak extends JetpackBase {
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
HbmExtendedProperties props = HbmExtendedProperties.getData(player);
HbmPlayerProps props = HbmPlayerProps.getData(player);
if(world.isRemote) {

View File

@ -2,7 +2,7 @@ package com.hbm.items.armor;
import java.util.List;
import com.hbm.extprop.HbmExtendedProperties;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.main.MainRegistry;
@ -32,7 +32,7 @@ public class JetpackRegular extends JetpackBase {
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
HbmExtendedProperties props = HbmExtendedProperties.getData(player);
HbmPlayerProps props = HbmPlayerProps.getData(player);
if(world.isRemote) {

View File

@ -2,7 +2,7 @@ package com.hbm.items.armor;
import java.util.List;
import com.hbm.extprop.HbmExtendedProperties;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.main.MainRegistry;
@ -35,7 +35,7 @@ public class JetpackVectorized extends JetpackBase {
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
HbmExtendedProperties props = HbmExtendedProperties.getData(player);
HbmPlayerProps props = HbmPlayerProps.getData(player);
if(world.isRemote) {

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.hbm.config.WeaponConfig;
import com.hbm.entity.effect.EntityRagingVortex;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.lib.ModDamageSource;
import com.hbm.util.I18nUtil;
@ -32,19 +33,7 @@ public class ItemDigamma extends ItemRadioactive {
if(entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
if(player.ticksExisted % digamma == 0 && !player.capabilities.isCreativeMode) {
player.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("digamma", -0.5D, 2));
if(player.getHealth() > player.getMaxHealth())
player.setHealth(player.getMaxHealth());
if(player.getMaxHealth() <= 0) {
player.attackEntityFrom(ModDamageSource.radiation, 100F);
player.onDeath(ModDamageSource.radiation);
}
}
HbmLivingProps.incrementDigamma(player, 1F / ((float) digamma));
}
}
@ -57,7 +46,7 @@ public class ItemDigamma extends ItemRadioactive {
list.add("");
super.addInformation(stack, player, list, bool);
float d = ((int)((1000F / 60) * 10)) / 10F;
float d = ((int)((1000F / digamma) * 10F)) / 10F;
list.add(EnumChatFormatting.RED + "[" + I18nUtil.resolveKey("trait.digamma") + "]");
list.add(EnumChatFormatting.DARK_RED + "" + d + "DRX/s");

View File

@ -25,7 +25,8 @@ import com.hbm.entity.mob.EntityTaintedCreeper;
import com.hbm.entity.mob.botprime.EntityBOTPrimeHead;
import com.hbm.entity.projectile.EntityBurningFOEQ;
import com.hbm.entity.projectile.EntityMeteor;
import com.hbm.extprop.HbmExtendedProperties;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.BossSpawnHandler;
import com.hbm.handler.RadiationWorldHandler;
import com.hbm.handler.HTTPHandler;
@ -71,6 +72,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntitySign;
@ -138,17 +140,20 @@ public class ModEventHandler
if(event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entity;
HbmPlayerProps.getData(player); //this already calls the register method if it's null so no further action required
}
if(event.entity instanceof EntityLivingBase) {
if(HbmExtendedProperties.getData(player) == null) {
}
EntityLivingBase living = (EntityLivingBase) event.entity;
HbmLivingProps.getData(living); //ditto
}
}
@SubscribeEvent
public void onEntityDeath(LivingDeathEvent event) {
event.entityLiving.getEntityData().setFloat("hfr_radiation", 0);
HbmLivingProps.setRadiation(event.entityLiving, 0);
if(event.entity.worldObj.isRemote)
return;
@ -280,7 +285,8 @@ public class ModEventHandler
if(o instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP)o;
PacketDispatcher.wrapper.sendTo(new RadSurveyPacket(player.getEntityData().getFloat("hfr_radiation")), player);
//TODO: replace with packet that sends all to-sync data
PacketDispatcher.wrapper.sendTo(new RadSurveyPacket(HbmLivingProps.getRadiation(player)), player);
}
}
@ -319,7 +325,7 @@ public class ModEventHandler
}
}
float eRad = entity.getEntityData().getFloat("hfr_radiation");
float eRad = HbmLivingProps.getRadiation(entity);
if(entity instanceof EntityCreeper && eRad >= 200 && entity.getHealth() > 0) {
@ -375,12 +381,12 @@ public class ModEventHandler
continue;
if(eRad > 2500)
entity.getEntityData().setFloat("hfr_radiation", 2500);
HbmLivingProps.setRadiation(entity, 2500);
if(eRad >= 1000) {
entity.attackEntityFrom(ModDamageSource.radiation, 1000F);
entity.getEntityData().setFloat("hfr_radiation", 0);
HbmLivingProps.setRadiation(entity, 0);
if(entity.getHealth() > 0) {
entity.setHealth(0);
@ -565,12 +571,13 @@ public class ModEventHandler
}
}
/*@SubscribeEvent
public void itemSmelted(PlayerEvent.ItemSmeltedEvent e) {
if(e.smelting.getItem().equals(ModItems.ingot_titanium)) {
e.player.addStat(MainRegistry.achievementGetTitanium, 1);
}
}*/
@SubscribeEvent
public void onPlayerClone(net.minecraftforge.event.entity.player.PlayerEvent.Clone event) {
NBTTagCompound data = new NBTTagCompound();
HbmPlayerProps.getData(event.original).saveNBTData(data);
HbmPlayerProps.getData(event.entityPlayer).loadNBTData(data);
}
@SubscribeEvent
public void itemCrafted(PlayerEvent.ItemCraftedEvent e) {

View File

@ -7,6 +7,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.projectile.EntityChopperMine;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.HTTPHandler;
import com.hbm.handler.HazmatRegistry;
import com.hbm.interfaces.IHoldableWeapon;
@ -90,9 +91,7 @@ public class ModEventHandlerClient {
if(player.inventory.hasItem(ModItems.geiger_counter)) {
float rads = 0;
rads = player.getEntityData().getFloat("hfr_radiation");
float rads = HbmLivingProps.getRadiation(player);
RenderScreenOverlay.renderRadCounter(event.resolution, rads, Minecraft.getMinecraft().ingameGUI);
}

View File

@ -1,6 +1,6 @@
package com.hbm.packet;
import com.hbm.extprop.HbmExtendedProperties;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
@ -39,7 +39,7 @@ public class KeybindPacket implements IMessage {
public IMessage onMessage(KeybindPacket m, MessageContext ctx) {
EntityPlayer p = ctx.getServerHandler().playerEntity;
HbmExtendedProperties props = HbmExtendedProperties.getData(p);
HbmPlayerProps props = HbmPlayerProps.getData(p);
props.setKeyPressed(EnumKeybind.values()[m.key], m.pressed);

View File

@ -1,5 +1,7 @@
package com.hbm.packet;
import com.hbm.extprop.HbmLivingProps;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
@ -43,7 +45,7 @@ public class RadSurveyPacket implements IMessage {
try {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
player.getEntityData().setFloat("hfr_radiation", m.rad);
HbmLivingProps.setRadiation(player, m.rad);
} catch (Exception x) { }
return null;

View File

@ -9,6 +9,7 @@ import com.hbm.config.PotionConfig;
import com.hbm.entity.mob.EntityTaintCrab;
import com.hbm.entity.mob.EntityTaintedCreeper;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.lib.ModDamageSource;
import com.hbm.util.ContaminationUtil;
@ -112,12 +113,8 @@ public class HbmPotion extends Potion {
ContaminationUtil.applyRadData(entity, (float)(level + 1F) * 0.05F);
}
if(this == radaway) {
float rad = entity.getEntityData().getFloat("hfr_radiation");
rad -= (level + 1);
if(rad < 0) rad = 0;
entity.getEntityData().setFloat("hfr_radiation", rad);
HbmLivingProps.incrementRadiation(entity, -(level + 1));
}
if(this == bang) {

View File

@ -2,7 +2,9 @@ package com.hbm.tileentity.machine;
import java.util.List;
import net.minecraft.entity.Entity;
import com.hbm.extprop.HbmLivingProps;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
@ -10,21 +12,14 @@ public class TileEntityDecon extends TileEntity {
@Override
public void updateEntity() {
if (!this.worldObj.isRemote) {
List<Entity> entities = this.worldObj.getEntitiesWithinAABB(Entity.class,
AxisAlignedBB.getBoundingBox(this.xCoord - 0.5, this.yCoord, this.zCoord - 0.5, this.xCoord + 1.5,
this.yCoord + 2, this.zCoord + 1.5));
if (!entities.isEmpty()) {
for (Entity e : entities) {
float f = e.getEntityData().getFloat("hfr_radiation");
f -= 0.5F;
if(f < 0) f = 0;
e.getEntityData().setFloat("hfr_radiation", f);
if(!this.worldObj.isRemote) {
List<EntityLivingBase> entities = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 0.5, this.yCoord, this.zCoord - 0.5, this.xCoord + 1.5, this.yCoord + 2, this.zCoord + 1.5));
if(!entities.isEmpty()) {
for(EntityLivingBase e : entities) {
HbmLivingProps.incrementRadiation(e, -0.5F);
}
}
}

View File

@ -1,5 +1,6 @@
package com.hbm.util;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.HazmatRegistry;
import com.hbm.interfaces.IRadiationImmune;
import com.hbm.potion.HbmPotion;
@ -55,8 +56,7 @@ public class ContaminationUtil {
f *= calculateRadiationMod(entity);
float rad = e.getEntityData().getFloat("hfr_radiation");
e.getEntityData().setFloat("hfr_radiation", Math.min(rad + f, 2500));
HbmLivingProps.incrementRadiation(entity, f);
}
public static void applyRadDirect(Entity e, float f) {
@ -70,11 +70,12 @@ public class ContaminationUtil {
if(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode)
return;
if(((EntityLivingBase)e).isPotionActive(HbmPotion.mutation))
return;
EntityLivingBase entity = (EntityLivingBase)e;
float rad = e.getEntityData().getFloat("hfr_radiation");
e.getEntityData().setFloat("hfr_radiation", Math.min(rad + f, 2500));
if(entity.isPotionActive(HbmPotion.mutation))
return;
HbmLivingProps.incrementRadiation(entity, f);
}
public static float getRads(Entity e) {
@ -85,14 +86,16 @@ public class ContaminationUtil {
if(e instanceof IRadiationImmune)
return 0.0F;
return e.getEntityData().getFloat("hfr_radiation");
EntityLivingBase entity = (EntityLivingBase)e;
return HbmLivingProps.getRadiation(entity);
}
public static void printGeigerData(EntityPlayer player) {
World world = player.worldObj;
double eRad = ((int)(player.getEntityData().getFloat("hfr_radiation") * 10)) / 10D;
double eRad = ((int)(HbmLivingProps.getRadiation(player) * 10)) / 10D;
RadiationSavedData data = RadiationSavedData.getData(player.worldObj);
Chunk chunk = world.getChunkFromBlockCoords((int)player.posX, (int)player.posZ);