public static SpaceStationWorldData getMPSpaceStationData( World var0, int var1, EntityPlayer player) { final String var2 = SpaceStationWorldData.getSpaceStationID(var1); SpaceStationWorldData var3 = (SpaceStationWorldData) var0.loadItemData(SpaceStationWorldData.class, var2); if (var3 == null) { var3 = new SpaceStationWorldData(var2); var0.setItemData(var2, var3); var3.dataCompound = new NBTTagCompound(); if (player != null) { var3.owner = player.getGameProfile().getName().replace(".", ""); } var3.spaceStationName = "Station: " + var3.owner; if (player != null) { var3.allowedPlayers.add(player.getGameProfile().getName()); } var3.markDirty(); } if (var3.getSpaceStationName().replace(" ", "").isEmpty()) { var3.setSpaceStationName("Station: " + var3.owner); var3.markDirty(); } return var3; }
/** Called when the block is right clicked by the player */ @Override public boolean onMachineActivated( World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) { int metadata = par1World.getBlockMetadata(x, y, z); if (!par1World.isRemote) { if (metadata >= GCCoreBlockMachine.COMPRESSOR_METADATA) { par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, x, y, z); return true; } else if (metadata >= GCCoreBlockMachine.ELECTRIC_FURNACE_METADATA) { par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, x, y, z); return true; } else if (metadata >= GCCoreBlockMachine.STORAGE_MODULE_METADATA) { par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, x, y, z); return true; } else { par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, x, y, z); return true; } } return true; }
private void explode() { final float strength = 20.0F; final Explosion explosion = new Explosion(worldObj, null, posX, posY, posZ, strength); explosion.isFlaming = false; explosion.isSmoking = true; explosion.doExplosionA(); explosion.doExplosionB(true); if (!worldObj.isRemote) { final Iterator var12 = worldObj.playerEntities.iterator(); while (var12.hasNext()) { final EntityPlayer player = (EntityPlayer) var12.next(); if (player.getDistanceSq(posX, posY, posZ) < 4096.0D) { ((EntityPlayerMP) player) .playerNetServerHandler.sendPacketToPlayer( new Packet60Explosion( posX, posY, posZ, strength, explosion.affectedBlockPositions, (Vec3) explosion.func_77277_b().get(player))); sendPacket( posX, posY, posZ, strength, explosion.affectedBlockPositions, (Vec3) explosion.func_77277_b().get(player)); } } } }
public void drawBars() { if (RLMPlayerProps.get(Minecraft.getMinecraft().thePlayer) != null) { bindTexture(new ResourceLocation("reallifemod:textures/gui/overlay/rim.png")); drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 256, 256, 256, 256); // bindTexture(emptybar); // drawModalRectWithCustomSizedTexture(20, 5, 0, 0, 49, 6, 49, 6); EntityPlayer player = Minecraft.getMinecraft().thePlayer; RLMPlayerProps props = RLMPlayerProps.get(player); poopbar.drawWidget(0, 0, 0F); peebar.drawWidget(0, 0, 0F); bindTexture(new ResourceLocation("reallifemod:textures/gui/overlay/lucky.png")); drawScaledCustomSizeModalRect(65, 1, 0, 0, 31, 31, 20, 20, 32, 32); drawString( Minecraft.getMinecraft().fontRendererObj, String.valueOf("Cash: " + props.cash + "$"), 2, 2, Color.white.getRGB()); float temperature = TemperatureHelper.getTemperaturesForBiomes( player.worldObj.getBiomeGenForCoords(player.getPosition()), player); drawString( Minecraft.getMinecraft().fontRendererObj, String.valueOf("Temp: " + temperature + "°"), 2, 13, TemperatureHelper.getColorForTemperature(temperature)); } }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity != null && tileEntity instanceof TileVendor) { TileVendor tileVendor = (TileVendor) world.getTileEntity(x, y, z); EntityPlayer playerTest = world.getPlayerEntityByName(tileVendor.playerName); if (playerTest == null || !tileVendor.isUseableByPlayer(playerTest)) { tileVendor.inUse = false; } ; if (tileVendor.inUse && !player.getDisplayName().contentEquals(tileVendor.playerName)) { if (!world.isRemote) { player.addChatMessage( new ChatComponentText(StatCollector.translateToLocal("chat.warning.inuse"))); } return true; } else { player.openGui(UniversalCoins.instance, 0, world, x, y, z); tileVendor.playerName = player.getDisplayName(); tileVendor.inUse = true; tileVendor.updateCoinsForPurchase(); return true; } } return false; }
public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata) { if (block.blockMaterial.isToolNotRequired()) { return true; } ItemStack stack = player.inventory.getCurrentItem(); if (stack == null) { return player.canHarvestBlock(block); } List info = toolClasses.get(stack.getItem()); if (info == null) { return player.canHarvestBlock(block); } Object[] tmp = info.toArray(); String toolClass = (String) tmp[0]; int harvestLevel = (Integer) tmp[1]; Integer blockHarvestLevel = toolHarvestLevels.get(Arrays.asList(block, metadata, toolClass)); if (blockHarvestLevel == null) { return player.canHarvestBlock(block); } if (blockHarvestLevel > harvestLevel) { return false; } return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { ItemStack playerItem = player.getCurrentEquippedItem(); if (playerItem != null) { if (playerItem.getItem() instanceof TelepositionFocus) { SoulNetworkHandler.checkAndSetItemPlayer(playerItem, player); if (playerItem.getTagCompound() == null) { playerItem.setTagCompound(new NBTTagCompound()); } NBTTagCompound itemTag = playerItem.getTagCompound(); itemTag.setInteger("xCoord", x); itemTag.setInteger("yCoord", y); itemTag.setInteger("zCoord", z); itemTag.setInteger("dimensionId", world.provider.dimensionId); return true; } } player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z); return true; }
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemstack) { if (itemstack.getItem() == ACItems.abyssalnite_helmet) player.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 20, 0)); if (itemstack.getItem() == ACItems.abyssalnite_boots) player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 20, 0)); }
@Override public boolean applyEffectEntity( ItemStack stack, World world, EntityLivingBase caster, Entity target) { if (world.isRemote || !(target instanceof EntityLivingBase)) return true; if (((EntityLivingBase) target).isPotionActive(BuffList.astralDistortion.id)) { if (target instanceof EntityPlayer) ((EntityPlayer) target) .addChatMessage( new ChatComponentText("The distortion around you prevents you from teleporting")); return true; } if (target.dimension == 1) { if (target instanceof EntityPlayer) ((EntityPlayer) target).addChatMessage(new ChatComponentText("Nothing happens...")); return true; } else if (target.dimension == -1) { if (target instanceof EntityPlayer) ((EntityPlayer) target) .addChatMessage(new ChatComponentText("You are already in the nether.")); return false; } else { DimensionUtilities.doDimensionTransfer((EntityLivingBase) target, -1); } return true; }
@Override public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityPedestal pedestal = (TileEntityPedestal) world.getTileEntity(pos); if (pedestal == null) return false; if (player.getCurrentEquippedItem() == null) { if (player.isSneaking()) { ItemStack copy = pedestal.getStackInSlot(0); player.setCurrentItemOrArmor(0, copy); pedestal.setInventorySlotContents(0, null); return false; } else { return false; } } else { return InventoryHelper.tryAddingPlayerCurrentItem(player, pedestal); } }
public void onServerBlockActivated( World world, EntityPlayer entityplayer, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if (!entityplayer.canPlayerEdit(x >> 3, y >> 3, z >> 3, side, entityplayer.getHeldItem())) { return; } if (entityplayer.getHeldItem() != null && entityplayer.getHeldItem().getItem() instanceof ItemLittleBlocksWand) { return; } if (this.canPlayerPlaceBlockOrUseItem(world, entityplayer)) { try { BlockUtil.onServerBlockActivated( world, entityplayer, entityplayer.getCurrentEquippedItem(), x, y, z, side, hitX, hitY, hitZ); } catch (ClassCastException e) { FMLCommonHandler.instance().getFMLLogger().warn(e.getLocalizedMessage()); } } }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) { int meta = world.getBlockMetadata(x, y, z); if (ToolHelper.isWrench(player.getCurrentEquippedItem()) && player.isSneaking()) { TileEntity tile = world.getTileEntity(x, y, z); if (tile != null && tile instanceof IWrenchable) { IWrenchable wrenchable = (IWrenchable) tile; wrenchable.setFacing(ToolHelper.getOppositeSide((short) side)); return true; } } else { return super.onBlockActivated(world, x, y, z, player, side, par7, par8, par9); } return false; }
public StatisticsFile getPlayerStatsFile(EntityPlayer playerIn) { UUID var2 = playerIn.getUniqueID(); StatisticsFile var3 = var2 == null ? null : (StatisticsFile) this.playerStatFiles.get(var2); if (var3 == null) { File var4 = new File( this.mcServer.worldServerForDimension(0).getSaveHandler().getWorldDirectory(), "stats"); File var5 = new File(var4, var2.toString() + ".json"); if (!var5.exists()) { File var6 = new File(var4, playerIn.getName() + ".json"); if (var6.exists() && var6.isFile()) { var6.renameTo(var5); } } var3 = new StatisticsFile(this.mcServer, var5); var3.func_150882_a(); this.playerStatFiles.put(var2, var3); } return var3; }
@Override public ItemStack onItemRightClick(ItemStack equipped, World world, EntityPlayer player) { if (player.isSneaking()) { long ticksSinceBlink = EnderIO.proxy.getTickCount() - lastBlickTick; if (ticksSinceBlink < 0) { lastBlickTick = -1; } if (Config.travelStaffBlinkEnabled && world.isRemote && ticksSinceBlink >= Config.travelStaffBlinkPauseTicks) { if (TravelController.instance.doBlink(equipped, player)) { player.swingItem(); lastBlickTick = EnderIO.proxy.getTickCount(); } } return equipped; } if (world.isRemote) { TravelController.instance.activateTravelAccessable( equipped, world, player, TravelSource.STAFF); } player.swingItem(); return equipped; }
public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (player.isSneaking()) return false; TileEntityLimekiln tileEntity = (TileEntityLimekiln) world.getBlockTileEntity(x, y, z); if (tileEntity != null) { if (tileEntity.facing != ForgeDirection.getOrientation(par6).getOpposite()) { tileEntity.facing = ForgeDirection.getOrientation(par6).getOpposite(); } if (!tileEntity.getIsValid()) { if (tileEntity.checkIfProperlyFormed()) { tileEntity.convertDummies(); } } // Check if the multi-block structure has been formed. if (tileEntity.getIsValid()) player.openGui(ConcreteCore.instance, ConfigHandler.GUIIDs.limekiln, world, x, y, z); } return true; }
public void serveMotd(EntityPlayer player) { for (String line : motd) { line = line.replace("$PLAYER$", player.getDisplayName()); player.addChatComponentMessage(ChatUtils.getChatComponent(line, EnumChatFormatting.WHITE)); } }
public static Object[] getCraftingRecipeKey(EntityPlayer player, ItemStack stack) { int[] key = new int[] {Item.getIdFromItem(stack.getItem()), stack.getItemDamage()}; if (keyCache.containsKey(key)) { if (keyCache.get(key) == null) return null; if (ThaumcraftApiHelper.isResearchComplete( player.getCommandSenderName(), (String) (keyCache.get(key))[0])) return keyCache.get(key); else return null; } for (ResearchCategoryList rcl : ResearchCategories.researchCategories.values()) { for (ResearchItem ri : rcl.research.values()) { if (ri.getPages() == null) continue; for (int a = 0; a < ri.getPages().length; a++) { ResearchPage page = ri.getPages()[a]; if (page.recipeOutput != null && stack != null && page.recipeOutput.isItemEqual(stack)) { keyCache.put(key, new Object[] {ri.key, a}); if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), ri.key)) return new Object[] {ri.key, a}; else return null; } } } } keyCache.put(key, null); return null; }
public void func_150873_a(EntityPlayer p_150873_1_, StatBase p_150873_2_, int p_150873_3_) { int var4 = p_150873_2_.isAchievement() ? this.writeStat(p_150873_2_) : 0; super.func_150873_a(p_150873_1_, p_150873_2_, p_150873_3_); this.field_150888_e.add(p_150873_2_); if (p_150873_2_.isAchievement() && var4 == 0 && p_150873_3_ > 0) { this.field_150886_g = true; if (this.field_150890_c.isAnnouncingPlayerAchievements()) { this.field_150890_c .getConfigurationManager() .sendChatMsg( new ChatComponentTranslation( "chat.type.achievement", new Object[] {p_150873_1_.getDisplayName(), p_150873_2_.func_150955_j()})); } } if (p_150873_2_.isAchievement() && var4 > 0 && p_150873_3_ == 0) { this.field_150886_g = true; if (this.field_150890_c.isAnnouncingPlayerAchievements()) { this.field_150890_c .getConfigurationManager() .sendChatMsg( new ChatComponentTranslation( "chat.type.achievement.taken", new Object[] {p_150873_1_.getDisplayName(), p_150873_2_.func_150955_j()})); } } }
/** Called upon block activation (right click on the block.) */ public boolean onBlockActivated( World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; } else { TileEntity var10 = par1World.getBlockTileEntity(par2, par3, par4); if (var10 == null || par5EntityPlayer.isSneaking()) { return false; } if (var10 != null && var10 instanceof TileEntityMysticFurnace) { par5EntityPlayer.openGui(MysticAdditions.instance, 0, par1World, par2, par3, par4); } return true; } }
public void renderNitroAndSpeed( RenderGameOverlayEvent.Pre event, int width, int height, EntityPlayer player) { int nitro = TFVehichleModeMotionManager.nitroMap.get(player.getDisplayName()) == null ? 0 : TFVehichleModeMotionManager.nitroMap.get(player.getDisplayName()); int speed = (int) ((TFVehichleModeMotionManager.velocityMap.get(player.getDisplayName()) == null ? 0 : TFVehichleModeMotionManager.velocityMap.get(player.getDisplayName())) * 100); int i = TFPlayerData.getTransformationTimer(player) * 30; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0F, 0F, 0F, 0.3F); drawTexturedModalRect(5 - i, height - 17, 0, 0, 202, 12); drawTexturedModalRect(5 - i, height - 25, 0, 0, 202, 6); GL11.glColor4f(0.0F, 1.0F, 1.0F, 0.5F); drawTexturedModalRect(6 - i, height - 16, 0, 0, (int) (nitro * 1.25F), 10); GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F); drawTexturedModalRect(6 - i, height - 24, 0, 0, (int) (speed * 1F), 4); GL11.glEnable(GL11.GL_TEXTURE_2D); drawCenteredString(mc.fontRenderer, "Nitro", 106 - i, height - 15, 0xffffff); drawCenteredString(mc.fontRenderer, speed + " km/h", 106 - i, height - 26, 0xffffff); }
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { if (playerIn.isSneaking()) { if (!playerIn.capabilities.isCreativeMode) { --itemStackIn.stackSize; } worldIn.playSoundAtEntity( playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!worldIn.isRemote) { // EntityEnchantedEbonheart worldIn.spawnEntityInWorld(new EntityEnchantedEbonheart(worldIn, playerIn)); // EntityEnchantedEbonheart entityenchantedebonheart = new EntityEnchantedEbonheart(worldIn, // playerIn); // entityenchantedebonheart.setHeadingFromThrower(playerIn, playerIn.rotationPitch, // playerIn.rotationYaw, -20.0F, 0.7F, 1.0F); // worldIn.spawnEntityInWorld(entityenchantedebonheart); // EntityExpBottle entityexpbottle = new EntityExpBottle(worldIn, playerIn); // entityexpbottle.func_184538_a(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, // -20.0F, 0.7F, 1.0F); // worldIn.spawnEntityInWorld(entityexpbottle); } playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); return itemStackIn; } return itemStackIn; }
public void renderKatanaDash( RenderGameOverlayEvent.Pre event, int width, int height, EntityPlayer player) { if (player.getHeldItem() != null && player.getHeldItem().getItem() == TFItems.purgesKatana && !TFPlayerData.isInVehicleMode(player) && TFHelper.isPlayerPurge(player)) { int j = TFItems.purgesKatana.getMaxItemUseDuration(player.getHeldItem()) - player.getItemInUseCount(); double d = (double) j / 10; if (d > 2.0D) { d = 2.0D; } GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0F, 0F, 0F, 0.15F); drawTexturedModalRect(width / 2 - 26, height / 2 + 9, 0, 0, 52, 12); GL11.glColor4f(1F, 0F, 0F, 0.25F); drawTexturedModalRect(width / 2 - 25, height / 2 + 10, 0, 0, (int) (d * 25), 10); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
private void drawPlanetInfo(Planet planet) { glTranslated(0, planet.getSize() * 0.13f + 0.05f, 0); glScaled(0.005, 0.005, 0.005); glRotated(180, 0, 0, 1); if (GalaxyClient.getInstance().canSeePlanetInfo(planet, Minecraft.getMinecraft().thePlayer)) { int width = Minecraft.getMinecraft().fontRenderer.getStringWidth(planet.getName()); Minecraft.getMinecraft() .fontRenderer .drawString(planet.getName(), -width / 2, 0, Planet.getGuiColor(planet).getColor()); if (planet.isHomeworld(Minecraft.getMinecraft().thePlayer)) { width = Minecraft.getMinecraft().fontRenderer.getStringWidth("[Home]"); Minecraft.getMinecraft() .fontRenderer .drawString(EnumChatFormatting.GOLD + "[Home]", -width / 2, -10, 0xFFFFFF); } } else { int width = Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(planet.getName()); Minecraft.getMinecraft() .standardGalacticFontRenderer .drawString(planet.getName(), -width / 2, 0, Planet.getGuiColor(planet).getColor()); if (planet.hasOwner()) { EntityPlayer owner = Minecraft.getMinecraft().theWorld.func_152378_a(planet.getOwnerUUID()); if (owner != null) { String info = String.format("[%s]", owner.getDisplayName()); width = Minecraft.getMinecraft().fontRenderer.getStringWidth(info); Minecraft.getMinecraft() .fontRenderer .drawString(EnumChatFormatting.GOLD + info, -width / 2, -10, 0xFFFFFF); } } } }
@Override public ArrayList<PotionEffect> effectOnEaten(EntityPlayer par1EntityPlayer, int meta) { PotionEffect potion = new PotionEffect(Potion.digSpeed.id, 2400, 2); int i = MathHelper.clamp_int(meta, 0, 2); int dur = DCsConfigCocktail.potionDur[i]; int amp = DCsConfigCocktail.potionAmp[i]; boolean flag = false; ArrayList<PotionEffect> ret = new ArrayList<PotionEffect>(); ret.add(new PotionEffect(Potion.hunger.id, 300, 1)); if (this.getCustomEffect(meta) != null) { if (par1EntityPlayer.isPotionActive(this.getCustomEffect(meta).id)) { dur = par1EntityPlayer.getActivePotionEffect(this.getCustomEffect(meta)).getDuration() + dur; potion = new PotionEffect(this.getCustomEffect(meta).id, dur, amp); flag = true; } else { potion = new PotionEffect(this.getCustomEffect(meta).id, dur, amp); } } if (potion != null) ret.add(potion); if (flag) { ret.add(new PotionEffect(Potion.confusion.id, 300, 1)); } return ret; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) { if (!canBlockStay(world, x, y, z)) { world.setBlockToAir(x, y, z); world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(this, 1))); } else if ((TEBloomery) world.getTileEntity(x, y, z) != null) { TEBloomery te = (TEBloomery) world.getTileEntity(x, y, z); ItemStack is = entityplayer.getCurrentEquippedItem(); if (is != null && (is.getItem() == TFCItems.FireStarter || is.getItem() == TFCItems.FlintSteel)) { if (te.canLight()) entityplayer.getCurrentEquippedItem().damageItem(1, entityplayer); } else { world.playAuxSFXAtEntity(entityplayer, 1003, x, y, z, 0); if (isOpen(world.getBlockMetadata(x, y, z))) world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) - 8, 3); else world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) + 8, 3); } } return true; }
@Override public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking()) { DebugHelper.debug(player, world, x, y, z); } else if (world.getBlock(x, y, z) instanceof BlockBush) { if (player.isSneaking()) { world.getBlock(x, y, z).updateTick(world, x, y, z, world.rand); } } else { if (!world.isRemote) { EntityVillager entityvillager = new EntityVillagerFarmer(world, WorldGen.getVillagerId()); entityvillager.setLocationAndAngles( (double) x + 0.5D, (double) y + 1, (double) z + 0.5D, 0.0F, 0.0F); world.spawnEntityInWorld(entityvillager); } } return false; }
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { if (player.worldObj.isRemote) { float yaw = lastOffset[0] - player.getRotationYawHead(); float pitch = lastOffset[1] - player.rotationPitch; int lastSize = gestureManager.size(); float tol = GestureDirection.tolerance(); GestureDirection direction = null; if (pitch >= tol) // Pitch went up direction = GestureDirection.UP; else if (pitch <= -tol) // Pitch went down direction = GestureDirection.DOWN; else if (yaw <= -tol) // Moved right direction = GestureDirection.RIGHT; else if (yaw >= tol) // Moved left direction = GestureDirection.LEFT; if (direction != null) { gestureManager.addStep(direction); player.addChatComponentMessage(new ChatComponentText("Gesture Step " + direction)); } if (gestureManager.size() != lastSize) { // Only if the size has changed (a step was added) reset the offset lastOffset[0] = player.getRotationYawHead(); lastOffset[1] = player.rotationPitch; } } }
@Override public void onNetworkHandlerEvent(int key, String value) { if ((key == 103) && (this.remote != null) && (getRemoteGUIinRange())) { EntityPlayer player = this.worldObj.getPlayerEntityByName(value); if (player != null) { player.openGui( ModularForceFieldSystem.instance, 0, this.worldObj, this.remote.xCoord, this.remote.yCoord, this.remote.zCoord); } } if ((key == 102) && (this.remote != null)) { this.remote.onSwitch(); } if ((key == 101) && (this.remote != null)) { this.remote.toogleSwitchMode(); } super.onNetworkHandlerEvent(key, value); }
@Override public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { if (toolMaterial == ToolMaterial.EMERALD) { if (player.getHeldItem() != null && ZSSPlayerInfo.get(player).canBlock()) { Vec3 vec3 = player.getLookVec(); double dx = player.posX + vec3.xCoord * 2.0D; double dy = player.posY + player.getEyeHeight() + vec3.yCoord * 2.0D; double dz = player.posZ + vec3.zCoord * 2.0D; List<EntityFireball> list = player.worldObj.getEntitiesWithinAABB( EntityFireball.class, AxisAlignedBB.getBoundingBox(dx - 1, dy - 1, dz - 1, dx + 1, dy + 1, dz + 1)); for (EntityFireball fireball : list) { DamageSource source = DamageSource.causeFireballDamage(fireball, fireball.shootingEntity); if (canBlockDamage(stack, source) && fireball.attackEntityFrom(DamageSource.causePlayerDamage(player), 1.0F)) { fireball.getEntityData().setBoolean("isReflected", true); ZSSPlayerInfo.get(player).onAttackBlocked(stack, 1.0F); WorldUtils.playSoundAtEntity(player, Sounds.HAMMER, 0.4F, 0.5F); break; } } } } }
public void onPlayerLogin(EntityPlayer player) { if (!playerFactionEntries.containsKey(player.getCommandSenderName())) { playerFactionEntries.put( player.getCommandSenderName(), new FactionEntry(player.getCommandSenderName())); markDirty(); } }