本文整理汇总了Java中cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent方法的典型用法代码示例。如果您正苦于以下问题:Java TickEvent.PlayerTickEvent方法的具体用法?Java TickEvent.PlayerTickEvent怎么用?Java TickEvent.PlayerTickEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cpw.mods.fml.common.gameevent.TickEvent
的用法示例。
在下文中一共展示了TickEvent.PlayerTickEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTickEvent
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTickEvent(TickEvent.PlayerTickEvent evt) {
if (tick >= 15) {
for (TileEntity t : (List<TileEntity>) evt.player.worldObj.loadedTileEntityList) {
if (t instanceof LobbyTileEntity) {
tile = (LobbyTileEntity) t;
if (tile.players.size() != tile.blockMetadata)
tile.check();
}
}
tick = 0;
}
}
示例2: playerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerTick(final TickEvent.PlayerTickEvent event) {
if (event.phase == TickEvent.Phase.START) {
return;
}
final EntityPlayer player = event.player;
if (player.worldObj.isRemote) {
return;
}
if (LogHelper.isDeObf) {}
if ((player.worldObj.getTotalWorldTime() & 0x1FL) > 0L) {
return;
}
final int i = this.chunkmap.adjustOrPutValue(new ChunkLocation(event.player), 1, 1);
if (i > 2250) {}
}
示例3: onPlayerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event)
{
if (event.phase != Phase.START)
return;
updatePosition();
if (!moved)
return;
Block b = getBlockUnderPlayer();
onElevator = (b == IndicatorMod.instance.elevatorBlock);
if (onElevator)
findElevators();
}
示例4: tickStart
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tickStart(TickEvent.PlayerTickEvent event){
if (event.player.worldObj.isRemote){
//System.out.println("tick");
IChatComponent message = ClientErrorMessageStorage.getMessage();
if (message != null && ticksElapsed == 0){
ClientErrorMessageStorage.getPlayer().addChatComponentMessage(message);
ClientErrorMessageStorage.sent();
ticksElapsed++;
} else if (ticksElapsed > 0 && ticksElapsed < minDelay){
ticksElapsed++;
} else if (ticksElapsed >= minDelay){
ticksElapsed = 0;
}
} else {
//System.out.println("server");
}
}
示例5: onPlayerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent tick) {
if (tick.side == Side.SERVER) {
EntityPlayer player = tick.player;
if (tick.phase == TickEvent.Phase.END) {
if (Rings.proxy.manaHandler.playerHasSession(player)) {
IPlayerSession playerSession = Rings.proxy.manaHandler.getPlayerSession(player);
if (++this.tick >= ModLibs.RECHARGE_WAIT_TIME) {
if (!player.capabilities.isCreativeMode) {
if (player.getFoodStats().getFoodLevel() > 4)
playerSession.adjustMana(((player.getFoodStats().getFoodLevel() / 4)), false);
} else
playerSession.setMana(playerSession.getMaxMana());
Rings.proxy.manaHandler.updatePlayerSession(playerSession, player.getEntityWorld().provider.dimensionId);
this.tick = 0;
}
}
}
}
}
示例6: magicCollectorUpdate
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void magicCollectorUpdate(TickEvent.PlayerTickEvent e) {
if (e.player.worldObj.isRemote)
return;
if (e.player.openContainer == null)
return;
if (!(e.player.openContainer instanceof ContainerMagicCollector))
return;
ContainerMagicCollector cont = (ContainerMagicCollector) e.player.openContainer;
ItemStack stack = cont.getCollectorStack();
ItemMagicCollector item = cont.getCollectorItem();
ItemStack magicItem = (ItemStack) cont.getInventory().get(0);
if (item.getMagic(stack) < 1)
return;
if (magicItem == null)
return;
if (((IMagicalItem) magicItem.getItem()).getMagic(magicItem) >= ((IMagicalItem) magicItem.getItem()).getMaxMagic(magicItem))
return;
if (item.getMagic(stack) >= item.getMaxMagic(stack))
return;
item.extractMagic(stack, 1);
((IMagicalItem) magicItem.getItem()).receiveMagic(magicItem, 1);
}
示例7: onClientTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onClientTick(TickEvent.PlayerTickEvent event){ //handles both 1st and 3rd person rendering, but in a cheatier way
if(ConfigHandler.animationType == 2 && event.phase == TickEvent.Phase.END) {
if (event.side.isServer() || event.player == null || event.player.getCurrentEquippedItem() == null)
return;
ItemStack equippedStack = event.player.getCurrentEquippedItem();
if (equippedStack.getItem() instanceof IEnergyTool && equippedStack.getItem().getItemUseAction(equippedStack) == EnumAction.bow) {
if(event.player.isSwingInProgress) {
event.player.setItemInUse(equippedStack, event.player.ticksExisted); //a bit of a hack here. I need a variable that would increase every tick, otherwise the "bow shaking" effect won't happen. player.ticksExisted works for that.
event.player.swingProgress = 0; //disable the normal mining swing animation
}
}
}
}
示例8: onPlayerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
if (event.phase == TickEvent.Phase.END) {
if (event.player != null){
ExtendedPlayerData properties = ExtendedPlayerData.get(event.player);
if (!stop) {
timeInMili++;
if(timeInMili > 20){
if (properties.decreaseShrineTimer(1)){
timeInMili = 0;
}
}
if (properties.getShrineTimer() <= 0) {
stop = true;
}
if (stop) {
properties.resetShrineTimer();
event.player.worldObj.spawnEntityInWorld(new EntityLightningBolt(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ));
event.player.setHealth(0);
stop = false;
}
}
}
}
}
示例9: onPlayerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
// Only perform the effect in survival/adventure mode
if(!event.player.capabilities.isCreativeMode) {
PlayerSymptoms symptoms = PlayerSymptoms.getForPlayer(event.player);
if (symptoms == null) return;
for (AmplifiedSymptom s : symptoms.symptoms) {
s.symptom.performSymptomEffect(event.player, s.amplifier);
}
}
}
示例10: onPlayerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
if (event.phase == TickEvent.Phase.START)
return;
if (event.side == Side.CLIENT)
return;
TriggerRegistry.fireTrigger(PassiveTrigger.Type.PLAYER, event.player);
}
示例11: tick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tick( TickEvent.PlayerTickEvent event )
{
if ( !event.phase.equals( TickEvent.Phase.END ) ) return;
EntityPlayer player = event.player;
boolean hasWalk = false;
ItemStack stack = player.getCurrentArmor( 0 );
if ( stack != null && stack.getItem() == ComponentEquipment.items.boots )
{
int level = Armor.instance.getModifierLevel( stack, "walkSlope" );
if ( level >= 1 )
{
hasWalk = true;
}
}
// Doing it this way to allow other mods to do similar things without me breaking them
NBTTagCompound data = player.getEntityData();
if ( hasWalk )
{
data.setBoolean( "CE_WalkSlope", true );
player.stepHeight = 1.f;
}
else if ( player.stepHeight > 0.5f && data.hasKey( "CE_WalkSlope" ) && data.getBoolean( "CE_WalkSlope" ) == true )
{
data.removeTag( "CE_WalkSlope" );
player.stepHeight = 0.5f;
}
}
示例12: doMovement
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void doMovement(TickEvent.PlayerTickEvent e) {
Iterator<Relocation> it = relocateQueue.iterator();
while (it.hasNext()) {
Relocation entry = it.next();
if (entry.getPlayer().equals(e.player) && e.player instanceof EntityPlayerMP){
FMLLog.info("Moving player: " + e.player.getDisplayName() + " to dim: " + entry.getDimension() + " @ " + entry.getCoords().toString());
WorldServer worldserver = MinecraftServer.getServer().worldServerForDimension(entry.getDimension());
IChunkProvider ichunkprovider = worldserver.getChunkProvider();
ichunkprovider.loadChunk(entry.getCoords().posX - 3 >> 4, entry.getCoords().posZ - 3 >> 4);
ichunkprovider.loadChunk(entry.getCoords().posX + 3 >> 4, entry.getCoords().posZ - 3 >> 4);
ichunkprovider.loadChunk(entry.getCoords().posX - 3 >> 4, entry.getCoords().posZ + 3 >> 4);
ichunkprovider.loadChunk(entry.getCoords().posX + 3 >> 4, entry.getCoords().posZ + 3 >> 4);
for (int y = entry.getCoords().posY; y <= worldserver.getHeight(); y++) {
Material material = worldserver.getBlock(entry.getCoords().posX, y, entry.getCoords().posZ).getMaterial();
Material material1 = worldserver.getBlock(entry.getCoords().posX, y + 1, entry.getCoords().posZ).getMaterial();
boolean flag1 = !material.isSolid() && !material.isLiquid();
boolean flag2 = !material1.isSolid() && !material1.isLiquid();
if (flag1 && flag2) {
entry.getCoords().posY = y;
break;
}
}
((EntityPlayerMP) e.player).mcServer.getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) e.player, entry.getDimension(), new Teleporter(worldserver));
e.player.setPositionAndUpdate(entry.getCoords().posX, entry.getCoords().posY, entry.getCoords().posZ);
it.remove();
}
}
}
示例13: onPlayerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
EntityPlayer thePlayer = event.player;
ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) thePlayer);
if (event.player.dimension == TheDarkEra.dimension) {
if (!thePlayer.isPotionActive(TDEPotionEffects.BreatheID)) {
thePlayer.addPotionEffect(new PotionEffect(TDEPotionEffects.DarknessID, 10, 0, true));
}
}
props.addMana(1);
}
示例14: doSpeedApplication
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void doSpeedApplication(TickEvent.PlayerTickEvent event) {
if (event.phase == TickEvent.Phase.START) {
if (event.player.getCurrentArmor(0) != null) {
if (event.player.getCurrentArmor(0).getItem() == ITA.Boots) {
event.player.stepHeight = stepHeight;
} else if (event.player.stepHeight == stepHeight) {
event.player.stepHeight = 0.5F;
}
} else if (event.player.stepHeight == stepHeight) {
event.player.stepHeight = 0.5F;
}
EntityPlayer p = event.player;
float speedModifier = getSpeedModifier(event.player);
AttributeModifier modifier = p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getModifier(CONSTS.speedAttribute);
if (ITA.lastSpeedModifier != speedModifier || modifier == null ||
Double.compare(p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(), ITA.lastSpeedValue) != 0) {
ITA.lastSpeedModifier = speedModifier;
if (ITA.debug)
System.out.println("Speed Modifier: " + speedModifier);
System.out.println(event.player.getDisplayName() + ": " + event.player.toString());
if (modifier != null)
p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).removeModifier(modifier);
double x = p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
modifier = new AttributeModifier(CONSTS.speedAttribute, "ITA Speed Modifier", -x + Math.max(x * speedModifier, 0.005), 0);
p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).applyModifier(modifier);
ITA.lastSpeedValue = p.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
}
}
}
示例15: onPlayerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event)
{
EntityPlayer player = event.player;
if (event.phase != Phase.START || player.worldObj.isRemote)
{
return;
}
if (!player.capabilities.isCreativeMode)
{
player.capabilities.disableDamage = false;
}
}