当前位置: 首页>>代码示例>>Java>>正文


Java MovementInput类代码示例

本文整理汇总了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)));

        }
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:27,代码来源:BoatFly.java

示例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;
}
 
开发者ID:jaideepheer,项目名称:MinecraftForge-BotAPI,代码行数:18,代码来源:PlayerMovementController.java

示例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;
}
 
开发者ID:h2r,项目名称:burlapcraft,代码行数:21,代码来源:HelperActions.java

示例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);
}
 
开发者ID:unascribed,项目名称:Farrago,代码行数:25,代码来源:ToolBlockRenderer.java

示例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);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:8,代码来源:DummyPlayer.java

示例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)));
			}
		}
	}
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:32,代码来源:EntitySpeed.java

示例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());
        }
    }
}
 
开发者ID:m1k3s,项目名称:parachute,代码行数:36,代码来源:EntityParachute.java

示例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;
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:11,代码来源:PlayerMovementManager.java

示例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;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:9,代码来源:CommandForWheeledRobotNavigationImplementation.java

示例10: get

import net.minecraft.util.MovementInput; //导入依赖的package包/类
private static MovementInput get() {
	return Minecraft.getMinecraft().player.movementInput;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:4,代码来源:IMovementInput.java

示例11: NullMovementInput

import net.minecraft.util.MovementInput; //导入依赖的package包/类
public NullMovementInput(MovementInput original) {
	this.original = original;
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:4,代码来源:NullMovementInput.java

示例12: setPlayerInput

import net.minecraft.util.MovementInput; //导入依赖的package包/类
public void setPlayerInput(MovementInput i)
{
    if(prevIn==null)prevIn = getPlayer().movementInput;
    getPlayer().movementInput = i;
}
 
开发者ID:jaideepheer,项目名称:MinecraftForge-BotAPI,代码行数:6,代码来源:PlayerMovementController.java

示例13: MovementInputWiimote

import net.minecraft.util.MovementInput; //导入依赖的package包/类
public MovementInputWiimote(MovementInput oldMovementInput,
		WiiMoteListener listener) {
	this.oldMovementInput = oldMovementInput;
	this.listener = listener;

}
 
开发者ID:freundTech,项目名称:motecraft,代码行数:7,代码来源:MovementInputWiimote.java

示例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;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:5,代码来源:EntityCamera.java

示例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;
}
 
开发者ID:h2r,项目名称:burlapcraft,代码行数:7,代码来源:HelperActions.java


注:本文中的net.minecraft.util.MovementInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。