本文整理汇总了Java中net.minecraft.util.MovementInput类的典型用法代码示例。如果您正苦于以下问题:Java MovementInput类的具体用法?Java MovementInput怎么用?Java MovementInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MovementInput类属于net.minecraft.util包,在下文中一共展示了MovementInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMoveSpeedEntity
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public static void setMoveSpeedEntity(double speed) {
if (MC.player != null && MC.player.getRidingEntity() != null) {
MovementInput movementInput = MC.player.movementInput;
double forward = movementInput.moveForward;
double strafe = movementInput.moveStrafe;
float yaw = MC.player.rotationYaw;
if ((forward == 0.0D) && (strafe == 0.0D)) {
MC.player.getRidingEntity().motionX = (0.0D);
MC.player.getRidingEntity().motionZ = (0.0D);
} else {
if (forward != 0.0D) {
if (strafe > 0.0D) yaw += (forward > 0.0D ? -45 : 45);
else if (strafe < 0.0D) yaw += (forward > 0.0D ? 45 : -45);
strafe = 0.0D;
if (forward > 0.0D) forward = 1.0D;
else if (forward < 0.0D) forward = -1.0D;
}
MC.player.getRidingEntity().motionX = (forward * speed * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * speed * Math.sin(Math.toRadians(yaw + 90.0F)));
MC.player.getRidingEntity().motionZ = (forward * speed * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * speed * Math.cos(Math.toRadians(yaw + 90.0F)));
}
}
}
示例2: moveStraightTo
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public boolean moveStraightTo(final double x,final double y,final double z,boolean autoFace)
{
System.out.println("Movin to "+x+","+y+","+z);
if(autoFace)faceTowards(x,y+getPlayer().getEyeHeight(),z);
MovementInput m = new MovementInput(){
@Override
public void updatePlayerMoveState() {
super.updatePlayerMoveState();
if((int)(getPlayer().posX)==(int)x&&(int)(getPlayer().posY)==(int)y&&(int)(getPlayer().posZ)==(int)z){
resetPlayerInput();System.out.println("Player Reached");}
}
};
m.forwardKeyDown=true;
m.moveForward=1;
setPlayerInput(m);
return true;
}
示例3: moveForward
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public static boolean moveForward(boolean jump) {
MovementInput movement = new MovementInput();
movement.moveForward = (float) 0.55D;
movement.jump = jump;
snapToGrid();
overrideMovement(movement);
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
resetAllInputs();
timer.cancel();
}
}, 440, 10);
return true;
}
示例4: onDisplay
import net.minecraft.util.MovementInput; //导入依赖的package包/类
@PaneEventHandler
public void onDisplay(PaneDisplayEvent e) {
oldRenderDistance = mc.gameSettings.renderDistanceChunks;
mc.gameSettings.renderDistanceChunks = 3;
fakeWorld = new WorldClient(new NetHandlerPlayClient(Minecraft.getMinecraft(), null, new NetworkManager(true)), new WorldSettings(new WorldInfo(new NBTTagCompound())), 0, EnumDifficulty.EASY, Minecraft.getMinecraft().mcProfiler);
for (int x = -1; x <= 1; x++) {
for (int z = -1; z <= 1; z++) {
fakeWorld.getChunkProvider().loadChunk(x, z);
}
}
fakeWorld.setBlock(0, 64, 0, Blocks.lit_furnace);
fakeWorld.getGameRules().setOrCreateGameRule("doDaylightCycle", "false");
fakeWorld.setWorldTime(6000);
mc.thePlayer = new EntityClientPlayerMP(mc, fakeWorld,
new FakeSession(), new FakeNetHandler(mc, null, new FakeNetManager(true)),
new FakeStatFileWriter());
mc.thePlayer.sendQueue.getNetworkManager().setNetHandler(mc.thePlayer.sendQueue);
mc.thePlayer.movementInput = new MovementInput();
mc.playerController = new PlayerControllerMP(mc, mc.thePlayer.sendQueue);
mc.renderViewEntity = mc.thePlayer;
mc.theWorld = fakeWorld;
mc.renderGlobal.setWorldAndLoadRenderers(fakeWorld);
MinecraftForge.EVENT_BUS.register(this);
}
示例5: DummyPlayer
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public DummyPlayer(EntityPlayer player) {
super(getWorld(player), getProfile(player));
this.playerBody = player;
this.inventory = player.inventory;
this.movementInput = new MovementInput();
placeAt(player);
}
示例6: onUpdate
import net.minecraft.util.MovementInput; //导入依赖的package包/类
@Override
public void onUpdate(EntityPlayerSP player) {
if(isEnabled()) {
if (player.ridingEntity != null) {
MovementInput movementInput = player.movementInput;
double forward = movementInput.moveForward;
double strafe = movementInput.moveStrafe;
float yaw = player.rotationYaw;
if ((forward == 0.0D) && (strafe == 0.0D)) {
player.ridingEntity.motionX = 0.0D;
player.ridingEntity.motionZ = 0.0D;
}else{
if (forward != 0.0D) {
if (strafe > 0.0D) {
yaw += (forward > 0.0D ? -45 : 45);
}else if (strafe < 0.0D) {
yaw += (forward > 0.0D ? 45 : -45);
}
strafe = 0.0D;
if (forward > 0.0D) {
forward = 1.0D;
}else if (forward < 0.0D) {
forward = -1.0D;
}
}
player.ridingEntity.motionX = (forward * entitySpeed.getValue() * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * entitySpeed.getValue() * Math.sin(Math.toRadians(yaw + 90.0F)));
player.ridingEntity.motionZ = (forward * entitySpeed.getValue() * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * entitySpeed.getValue() * Math.cos(Math.toRadians(yaw + 90.0F)));
}
}
}
}
示例7: updateInputs
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public void updateInputs(MovementInput input) {
if (isBeingRidden() && world.isRemote) {
double motionFactor = 0.0f;
if (input.forwardKeyDown) {
motionFactor += forwardMomentum;
}
if (input.backKeyDown) {
motionFactor -= backMOmentum;
}
if (input.leftKeyDown) {
deltaRotation += -(rotationMomentum);
}
if (input.rightKeyDown) {
deltaRotation += rotationMomentum;
}
// slight forward momentum while turning
if (input.rightKeyDown != input.leftKeyDown && !input.forwardKeyDown && !input.backKeyDown) {
motionFactor += slideMomentum;
}
ascendMode = input.jump;
motionY -= currentDescentRate();
rotationYaw += deltaRotation;
motionX += MathHelper.sin((float) Math.toRadians(-rotationYaw)) * motionFactor;
motionZ += MathHelper.cos((float) Math.toRadians(rotationYaw)) * motionFactor;
if (((ConfigHandler.getWeatherAffectsDrift() && isBadWeather()) || allowTurbulence) && rand.nextBoolean()) {
applyTurbulence(world.isThundering());
}
}
}
示例8: updateMovementState
import net.minecraft.util.MovementInput; //导入依赖的package包/类
@SubscribeEvent
public static void updateMovementState(InputUpdateEvent evt) {
final MovementInput input = evt.getMovementInput();
final EntityPlayer owner = evt.getEntityPlayer();
if (input.jump && !wasJumping) input.jump = postMovementEvent(owner, PlayerMovementEvent.Type.JUMP);
if (input.sneak && !wasSneaking) input.sneak = postMovementEvent(owner, PlayerMovementEvent.Type.SNEAK);
wasJumping = input.jump;
wasSneaking = input.sneak;
}
示例9: getMover
import net.minecraft.util.MovementInput; //导入依赖的package包/类
/** Provide access to the MovementInput object we are using to control the player.<br>
* This is required by the unit tests.
* @return our MovementInput object.
*/
public MovementInput getMover()
{
return this.overrideMovement;
}
示例10: get
import net.minecraft.util.MovementInput; //导入依赖的package包/类
private static MovementInput get() {
return Minecraft.getMinecraft().player.movementInput;
}
示例11: NullMovementInput
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public NullMovementInput(MovementInput original) {
this.original = original;
}
示例12: setPlayerInput
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public void setPlayerInput(MovementInput i)
{
if(prevIn==null)prevIn = getPlayer().movementInput;
getPlayer().movementInput = i;
}
示例13: MovementInputWiimote
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public MovementInputWiimote(MovementInput oldMovementInput,
WiiMoteListener listener) {
this.oldMovementInput = oldMovementInput;
this.listener = listener;
}
示例14: EntityCamera
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public EntityCamera(Minecraft mcIn, World worldIn, NetHandlerPlayClient p_i46278_3_, StatisticsManager p_i46278_4_, RecipeBook p_i46278_5_, MovementInput input) {
super(mcIn, worldIn, p_i46278_3_, p_i46278_4_, p_i46278_5_);
this.movementInput = input;
}
示例15: overrideMovement
import net.minecraft.util.MovementInput; //导入依赖的package包/类
public static void overrideMovement(MovementInput i) {
if (resetMovementInput == null) {
resetMovementInput = mc.thePlayer.movementInput;
}
mc.thePlayer.movementInput = i;
}