Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.Looke81.BioWarfare.handler;
- import java.util.Random;
- import com.Looke81.BioWarfare.BioWarfare;
- import com.Looke81.BioWarfare.ReflectionHelper;
- import com.Looke81.BioWarfare.Potion.ShaderChange;
- import com.Looke81.BioWarfare.armor.HazmatSuit;
- import com.Looke81.BioWarfare.blocks.BacteriaTest;
- import com.Looke81.BioWarfare.blocks.twobytwoDirt;
- import com.Looke81.BioWarfare.items.Microscope;
- import com.google.common.base.Throwables;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.shader.ShaderGroup;
- import net.minecraft.client.util.JsonException;
- import net.minecraft.entity.DataWatcher;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.monster.EntityCreeper;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.ItemStack;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.server.MinecraftServer;
- import net.minecraft.util.ChatComponentText;
- import net.minecraft.util.ChatComponentTranslation;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.world.World;
- import net.minecraftforge.event.entity.living.LivingAttackEvent;
- import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
- import cpw.mods.fml.common.eventhandler.SubscribeEvent;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class BioWarfareEventHandler {
- public static boolean ShouldBeEffected = false;
- public static int tickcounter = 0;
- public static boolean damagebypotiontest = false;
- private static final Random random = new Random();
- public static boolean HasMicroscopeInInv = false;
- public static boolean isRemote;
- @SubscribeEvent
- public void onLivingUpdateEvent(LivingUpdateEvent event)
- {
- // do something to player every update tick:
- if (event.entity instanceof EntityPlayer){
- EntityPlayer player = (EntityPlayer) event.entity;
- if (HazmatSuit.HazmatSuitBootsEquiped == true && HazmatSuit.HazmatSuitLegsEquiped == true && HazmatSuit.HazmatSuitChestEquiped == true && HazmatSuit.HazmatSuitHelmEquiped == true){
- HazmatSuit.HazmatSuitBootsEquiped = false;
- HazmatSuit.HazmatSuitLegsEquiped = false;
- HazmatSuit.HazmatSuitChestEquiped = false;
- HazmatSuit.HazmatSuitHelmEquiped = false;
- HazmatSuit.HazmatSuitOn = true;
- }else{
- HazmatSuit.HazmatSuitOn = false;
- }
- tickcounter ++;
- int x = (int) Math.floor(player.posX);
- int y = (int) (player.posY - player.getYOffset());
- int z = (int) Math.floor(player.posZ);
- if (player.worldObj.getBlock(x, y , z) == BioWarfare.blockBacteriaTest && (HazmatSuit.HazmatSuitOn== true)){
- }else if(player.worldObj.getBlock(x, y , z) == BioWarfare.blockBacteriaTest && (HazmatSuit.HazmatSuitOn== false)){
- player.addPotionEffect(new PotionEffect(Potion.poison.getId(), 20, 30));
- }
- if (player.getActivePotionEffect(BioWarfare.PotionTest) != null && player.getActivePotionEffect(BioWarfare.PotionTest).getDuration() != 1) {
- /* if (event.entityLiving.worldObj.rand.nextInt(200) == 0){
- EntityCreeper creeper = new EntityCreeper(player.worldObj);
- try {
- ReflectionHelper.setProperty(creeper, 0, "explosionRadius", "field_82226_g");
- DataWatcher watcher = ReflectionHelper.getProperty(creeper, "dataWatcher", "field_70180_af");
- } catch (Throwable t) {
- throw Throwables.propagate(t);
- }
- creeper.setPosition(player.posX ,player.posY ,player.posZ );
- player.worldObj.spawnEntityInWorld(creeper);
- }*/
- ShaderChange.flip(random, player);
- }else if (player.getActivePotionEffect(BioWarfare.PotionTest) != null && player.getActivePotionEffect(BioWarfare.PotionTest).getDuration() == 1){
- ShaderChange.noShader(random, player);
- }
- if (player.isPotionActive(BioWarfare.Toxic)) {
- double x2 = event.entity.posX ;
- double y2 = event.entity.posY ;
- double z2 = event.entity.posZ ;
- if (event.entityLiving.worldObj.rand.nextInt(6) == 0){
- player.worldObj.spawnParticle("mobSpell", x2,y2 -0.5,z2, 0, 255, 0);
- }
- if (event.entityLiving.worldObj.rand.nextInt(20) == 0 && !(player.capabilities.isCreativeMode)) {
- player.heal(-2);
- }
- }
- //____________________________________________________________________________________________________________
- if (player.inventory.hasItem(BioWarfare.itemUnknownPathogen) && (HazmatSuit.HazmatSuitOn== true)){
- ShouldBeEffected = false;
- HazmatSuit.HazmatSuitOn=false;
- }else if (player.inventory.hasItem(BioWarfare.itemUnknownPathogen)){
- ShouldBeEffected = true;
- }else{
- ShouldBeEffected = false;
- }
- if (ShouldBeEffected == true){
- player.addPotionEffect(new PotionEffect(Potion.poison.getId(), 20, 30));
- }
- if (player.inventory.hasItem(BioWarfare.itemMicroscope) && (player.capabilities.isCreativeMode == false)){
- HasMicroscopeInInv = true;
- }else{
- HasMicroscopeInInv = false;
- }
- if (player.worldObj.isRemote == true){
- isRemote=true;
- }
- if (player.worldObj.isRemote == false){
- isRemote=false;
- }
- }
- }
- @SubscribeEvent
- public void onEntityDamaged(LivingAttackEvent event){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement