-
-
Save anonymous/ad453cbe13f3b9f92c2a 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.Main; | |
import com.koopamillion.item.Mitems; | |
import cpw.mods.fml.common.network.simpleimpl.IMessage; | |
import cpw.mods.fml.common.network.simpleimpl.MessageContext; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.item.ItemStack; | |
public class JetpackHandler { | |
public IMessage handleServerMessage(EntityPlayer player, JetpackMessage message, MessageContext ctx) { | |
ItemStack stack; | |
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; | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment