Created
March 27, 2016 17:37
-
-
Save anonymous/b6e65790f34ee3ae4bb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.koopamillion.item; | |
import com.koopamillion.lib.RefStrings; | |
import net.minecraft.client.Minecraft; | |
import net.minecraft.entity.Entity; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.item.ItemArmor; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.util.MathHelper; | |
import net.minecraft.world.World; | |
public class jetpack extends ItemArmor{ | |
public jetpack(ArmorMaterial p_i45325_1_, int p_i45325_2_, int p_i45325_3_) { | |
super(p_i45325_1_, p_i45325_2_, p_i45325_3_); | |
} | |
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){ | |
if(stack.getItem() == Mitems.jetpack) { | |
return RefStrings.MODID + ":textures/model/armor/jetpack.png"; | |
}else{ | |
return null; | |
} | |
} | |
@Override | |
public void onArmorTick(World world, EntityPlayer player, ItemStack stack){ | |
if(stack.getItem() == Mitems.jetpack && Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed()){ //HERE! | |
int yaw = (int)player.rotationYaw; | |
if (yaw<0) | |
yaw+=360; | |
yaw+=22; | |
yaw%=360; | |
int facing = yaw/45; // 360degrees divided by 45 == 8 zones | |
if(facing == 0){ | |
player.motionZ = 0.5; | |
} | |
if(facing == 1){ | |
player.motionZ = 0.5; | |
player.motionX = -0.5; | |
} | |
if(facing == 2){ | |
player.motionX = -0.5; | |
} | |
if(facing == 3){ | |
player.motionX = -0.5; | |
player.motionZ = -0.5; | |
} | |
if(facing == 4){ | |
player.motionZ = -0.5; | |
} | |
if(facing == 5){ | |
player.motionZ = -0.5; | |
player.motionX = 0.5; | |
} | |
if(facing == 6){ | |
player.motionX = 0.5; | |
} | |
if(facing == 7){ | |
player.motionZ = 0.5; | |
player.motionX = 0.5; | |
} | |
player.motionY = 0.5; | |
world.spawnParticle("flame", player.posX + 0.2, player.posY - 0.6, player.posZ - 0.2, 0, -0.3, 0); | |
world.spawnParticle("flame", player.posX - 0.2, player.posY - 0.6, player.posZ - 0.2, 0, -0.3, 0); | |
world.spawnParticle("largesmoke", player.posX + 0.2, player.posY - 0.6, player.posZ - 0.2, 0, -0.3, 0); | |
world.spawnParticle("largesmoke", player.posX - 0.2, player.posY - 0.6, player.posZ - 0.2, 0, -0.3, 0); | |
world.spawnParticle("lava", player.posX + 0.2, player.posY - 0.6, player.posZ - 0.2, 0, -0.3, 0); | |
world.spawnParticle("lava", player.posX - 0.2, player.posY - 0.6, player.posZ - 0.2, 0, -0.3, 0); | |
Mitems.jetpack.setDamage(stack, Mitems.jetpack.getDamage(stack) + 1); | |
} | |
if(stack.getItemDamage() >= 720){ | |
player.setCurrentItemOrArmor(3, new ItemStack(Mitems.jetpackDead)); | |
} | |
if(stack.getItem() == Mitems.jetpack){ | |
player.fallDistance = 0F; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment