public ITextComponent get() { return new TextComponentTranslation( this.getName() ); }
@Override public void call( final MinecraftServer srv, final String[] data, final ICommandSender sender ) { this.enabled = !this.enabled; if( this.enabled ) { MinecraftForge.EVENT_BUS.register( this ); sender.sendMessage( new TextComponentTranslation( "commands.ae2.ChunkLoggerOn" ) ); } else { MinecraftForge.EVENT_BUS.unregister( this ); sender.sendMessage( new TextComponentTranslation( "commands.ae2.ChunkLoggerOff" ) ); } } }
public static void register() { for( final Stats s : Stats.values() ) { if( s.stat == null ) { s.stat = new StatBasic( "stat.ae2." + s.name(), new TextComponentTranslation( "stat.ae2." + s.name() ) ); s.stat.registerStat(); } } } }
@Override public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender var1, @Nonnull String[] var2) { if(!ENABLED) var1.sendMessage(new TextComponentTranslation("botania.versioning.disabled").setStyle(new Style().setColor(TextFormatting.RED))); else if(var2.length == 1) if(VersionChecker.downloadedFile) var1.sendMessage(new TextComponentTranslation("botania.versioning.downloadedAlready").setStyle(new Style().setColor(TextFormatting.RED))); else if(VersionChecker.startedDownload) var1.sendMessage(new TextComponentTranslation("botania.versioning.downloadingAlready").setStyle(new Style().setColor(TextFormatting.RED))); else new ThreadDownloadMod("Botania " + var2[0] + ".jar"); }
@SubscribeEvent public static void onTick(ClientTickEvent event) { if(event.phase == Phase.END && Minecraft.getMinecraft().player != null && !triedToWarnPlayer && doneChecking) { if(!onlineVersion.isEmpty()) { EntityPlayer player = Minecraft.getMinecraft().player; int onlineBuild = Integer.parseInt(onlineVersion.split("-")[1]); int clientBuild = LibMisc.BUILD.contains("GRADLE") ? Integer.MAX_VALUE : Integer.parseInt(LibMisc.BUILD); if(onlineBuild > clientBuild) { player.sendMessage(new TextComponentTranslation("botania.versioning.flavour" + player.world.rand.nextInt(FLAVOUR_MESSAGES)).setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE))); player.sendMessage(new TextComponentTranslation("botania.versioning.outdated", clientBuild, onlineBuild)); ITextComponent component = ITextComponent.Serializer.fromJsonLenient(I18n.translateToLocal("botania.versioning.updateMessage").replaceAll("%version%", onlineVersion)); player.sendMessage(component); } } triedToWarnPlayer = true; } }
@Override public void updateScreen() { super.updateScreen(); LexiconPage page = entry.pages.get(this.page); page.updateScreen(this); if(this.page == entry.pages.size() - 1) { LexiconEntry entry = tutorial.peek(); if(entry == this.entry) { tutorial.poll(); positionTutorialArrow(); if(tutorial.isEmpty()) { mc.player.sendMessage(new TextComponentTranslation("botaniamisc.tutorialEnded").setStyle(new Style().setColor(TextFormatting.RED))); hasTutorialArrow = false; } } } }
@Override public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) { if(sender instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) sender; ItemStack stack = PlayerHelper.getFirstHeldItemClass(player, ItemLexicon.class); if(!stack.isEmpty()) { ItemLexicon.setForcedPage(stack, args[0]); ItemLexicon.setQueueTicks(stack, 5); } else sender.sendMessage(new TextComponentTranslation("botaniamisc.noLexicon").setStyle(new Style().setColor(TextFormatting.RED))); } }
Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("botania.versioning.doneDownloading", fileName).setStyle(new Style().setColor(TextFormatting.GREEN)));
@Override @SideOnly(Side.CLIENT) public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) { if(button == buttonText) { GuiLexicon.startTutorial(); Minecraft.getMinecraft().displayGuiScreen(new GuiLexicon()); Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("botaniamisc.tutorialStarted").setStyle(new Style().setColor(TextFormatting.GREEN))); } else if(button == buttonVideo && Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=D75Aad-5QgQ")); } catch(Exception e) { e.printStackTrace(); } } }
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if(isRightPlayer(player, stack)) { if(world.isRemote) return ActionResult.newResult(EnumActionResult.SUCCESS, stack); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.rand.nextFloat() * 0.4F + 0.8F)); List<Integer> possible = new ArrayList<>(); for(int i = 0; i < 6; i++) { if(!hasRelicAlready(player, i)) possible.add(i); } if(possible.isEmpty()) { player.sendMessage(new TextComponentTranslation("botaniamisc.dudDiceRoll", world.rand.nextInt(6) + 1).setStyle(new Style().setColor(TextFormatting.DARK_GREEN))); stack.shrink(1); return ActionResult.newResult(EnumActionResult.SUCCESS, stack); } else { int relic = possible.get(world.rand.nextInt(possible.size())); player.sendMessage(new TextComponentTranslation("botaniamisc.diceRoll", relic + 1).setStyle(new Style().setColor(TextFormatting.DARK_GREEN))); return ActionResult.newResult(EnumActionResult.SUCCESS, relicStacks[relic].copy()); } } return ActionResult.newResult(EnumActionResult.PASS, stack); }
@Override public ITextComponent getDisplayName() { if( this.hasCustomInventoryName() ) { return new TextComponentString( this.getCustomInventoryName() ); } return new TextComponentTranslation( this.getBlockType().getUnlocalizedName() ); }
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) { ItemStack stack = player.getHeldItem(hand); String force = getForcedPage(stack); if(force != null && !force.isEmpty()) { LexiconEntry entry = getEntryFromForce(stack); if(entry != null) Botania.proxy.setEntryToOpen(entry); else player.sendMessage(new TextComponentTranslation("botaniamisc.cantOpen").setStyle(new Style().setColor(TextFormatting.RED))); setForcedPage(stack, ""); } openBook(player, stack, world, skipSound); skipSound = false; return ActionResult.newResult(EnumActionResult.SUCCESS, stack); }
private void sendError() { if(Minecraft.getMinecraft().player != null) Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("botania.versioning.error").setStyle(new Style().setColor(TextFormatting.RED))); } }
public void tellChanges(EntityPlayer player) { if(changes.size() == 0) return; player.sendMessage(new TextComponentTranslation("botaniamisc.adaptativeConfigChanges").setStyle(new Style().setColor(TextFormatting.GOLD))); for(String change : changes) player.sendMessage(new TextComponentString(change).setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE))); }
index.doCorporeaRequest(name, count, spark); event.getPlayer().sendMessage(new TextComponentTranslation("botaniamisc.requestMsg", count, WordUtils.capitalizeFully(name), CorporeaHelper.lastRequestMatches, CorporeaHelper.lastRequestExtractions).setStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE))); CorporeaRequestTrigger.INSTANCE.trigger(event.getPlayer(), event.getPlayer().getServerWorld(), index.getPos(), CorporeaHelper.lastRequestExtractions);
@Override public IMessage onMessage(PacketDodge message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().player; player.server.addScheduledTask(() -> { player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.dash, SoundCategory.PLAYERS, 1F, 1F); IItemHandler baublesInv = BaublesApi.getBaublesHandler(player); ItemStack ringStack = baublesInv.getStackInSlot(1); if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing)) { ringStack = baublesInv.getStackInSlot(2); if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing)) ctx.getServerHandler().disconnect(new TextComponentTranslation("botaniamisc.invalidDodge")); return; } player.addExhaustion(0.3F); ItemNBTHelper.setInt(ringStack, ItemDodgeRing.TAG_DODGE_COOLDOWN, ItemDodgeRing.MAX_CD); }); return null; } }
if(world.getDifficulty() == EnumDifficulty.PEACEFUL) { if(!world.isRemote) player.sendMessage(new TextComponentTranslation("botaniamisc.peacefulNoob").setStyle(new Style().setColor(TextFormatting.RED))); return false; if(blockat != ModBlocks.pylon || state.getValue(BotaniaStateProps.PYLON_VARIANT) != PylonVariant.GAIA) { if(!world.isRemote) player.sendMessage(new TextComponentTranslation("botaniamisc.needsCatalysts").setStyle(new Style().setColor(TextFormatting.RED))); return false; new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ARENA_INDICATOR, pos.getX(), pos.getY(), pos.getZ())); player.sendMessage(new TextComponentTranslation("botaniamisc.badArena").setStyle(new Style().setColor(TextFormatting.RED)));
@SubscribeEvent public void onInteract(PlayerInteractEvent.RightClickBlock event) { // does the player clicks on an echanting table with moss with 5 levels? if(ItemStack.areItemsEqual(event.getItemStack(), TinkerCommons.matMoss)) { World world = event.getWorld(); BlockPos pos = event.getPos(); if(world.getBlockState(pos).getBlock().getEnchantPowerBonus(world, pos) >= 1.0f) { EntityPlayer player = event.getEntityPlayer(); if(event.getEntityPlayer().experienceLevel >= ModMendingMoss.MENDING_MOSS_LEVELS) { // convert moss to mending moss player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1f, 1f); if(!event.getWorld().isRemote) { event.getItemStack().shrink(1); player.onEnchant(null, ModMendingMoss.MENDING_MOSS_LEVELS); ItemHandlerHelper.giveItemToPlayer(player, TinkerCommons.matMendingMoss.copy()); event.setUseBlock(Event.Result.DENY); event.setUseItem(Event.Result.DENY); event.setCanceled(true); } } else { player.sendStatusMessage(new TextComponentTranslation("message.mending_moss.not_enough_levels", ModMendingMoss.MENDING_MOSS_LEVELS), true); } } } }
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float xs, float ys, float zs) { TileHourglass hourglass = (TileHourglass) world.getTileEntity(pos); ItemStack hgStack = hourglass.getItemHandler().getStackInSlot(0); ItemStack stack = player.getHeldItem(hand); if(!stack.isEmpty() && stack.getItem() == ModItems.twigWand) return false; if(hourglass.lock) { if(!player.world.isRemote) player.sendMessage(new TextComponentTranslation("botaniamisc.hourglassLock")); return true; } if(hgStack.isEmpty() && TileHourglass.getStackItemTime(stack) > 0) { hourglass.getItemHandler().setStackInSlot(0, stack.copy()); hourglass.markDirty(); stack.setCount(0); return true; } else if(!hgStack.isEmpty()) { ItemHandlerHelper.giveItemToPlayer(player, hgStack); hourglass.getItemHandler().setStackInSlot(0, ItemStack.EMPTY); hourglass.markDirty(); return true; } return false; }
private static void renderPlayerLook(EntityPlayer player, RayTraceResult src) { if(currentMultiblock != null && dimension == player.world.provider.getDimension()) { BlockPos anchorPos = anchor != null ? anchor : src.getBlockPos(); GlStateManager.pushMatrix(); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableLighting(); rendering = true; Multiblock mb = anchor != null ? currentMultiblock.getForFacing(angle) : currentMultiblock.getForEntity(player); boolean didAny = false; blockAccess.update(player.world, mb, anchorPos); ShaderHelper.useShader(ShaderHelper.alpha, shader -> { int alpha = ARBShaderObjects.glGetUniformLocationARB(shader, "alpha"); ARBShaderObjects.glUniform1fARB(alpha, 0.4F); }); for(MultiblockComponent comp : mb.getComponents()) { if(renderComponentInWorld(player.world, mb, comp, anchorPos)) didAny = true; } ShaderHelper.releaseShader(); rendering = false; GL11.glPopAttrib(); GlStateManager.popMatrix(); if(!didAny) { setMultiblock(null); player.sendMessage(new TextComponentTranslation("botaniamisc.structureComplete").setStyle(new Style().setColor(TextFormatting.GREEN))); } } }