net.minecraft.SharedConstants Java Examples
The following examples show how to use
net.minecraft.SharedConstants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinClientPlayNetworkHandler.java From multiconnect with MIT License | 5 votes |
@Inject(method = "onCustomPayload", at = @At("HEAD"), cancellable = true) private void onOnCustomPayload(CustomPayloadS2CPacket packet, CallbackInfo ci) { NetworkThreadUtils.forceMainThread(packet, (ClientPlayNetworkHandler) (Object) this, MinecraftClient.getInstance()); if (packet.getChannel().equals(CustomPayloadHandler.DROP_ID)) { ci.cancel(); } else if (ConnectionInfo.protocolVersion != SharedConstants.getGameVersion().getProtocolVersion() && !CustomPayloadHandler.VANILLA_CHANNELS.contains(packet.getChannel())) { CustomPayloadHandler.handleCustomPayload(packet); ci.cancel(); } }
Example #2
Source File: BleachMainMenu.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void render(int p_render_1_, int p_render_2_, float p_render_3_) { this.renderBackground(); fill(0, 0, width, height, 0xff008080); int copyWidth = this.font.getStringWidth("Copyright Mojang AB. Do not distribute!") + 2; font.drawWithShadow("Copyright Mojang AB. Do not distribute!", width - copyWidth, height - 24, -1); font.drawWithShadow("Fabric: " + FabricLoader.getInstance().getModContainer("fabricloader").get().getMetadata().getVersion().getFriendlyString(), 4, height - 44, -1); font.drawWithShadow("Minecraft " + SharedConstants.getGameVersion().getName(), 4, height - 34, -1); font.drawWithShadow("Logged in as: §a" + minecraft.getSession().getUsername(), 4, height - 24, -1); try { if (Integer.parseInt(versions.get(1)) > BleachHack.INTVERSION) { drawCenteredString(this.font, "§cOutdated BleachHack Version!", width/2, 2, -1); drawCenteredString(this.font,"§4[" + versions.get(0) + " > " + BleachHack.VERSION + "]", width/2, 11, -1); } } catch (Exception e) { } drawButton("", 0, height - 14, width, height); drawButton("§cX", 0, height - 13, 20, height - 1); int wid = 20; for (Window w: windows) { if (w.closed) continue; Screen.fill(wid, height - 13, wid + 80 - 1, height - 1 - 1, 0xffb0b0b0); Screen.fill(wid + 1, height - 13 + 1, wid + 80, height - 1, 0xff000000); Screen.fill(wid + 1, height - 13 + 1, wid + 80 - 1, height - 1 - 1, (w.selected ? 0xffb0b0b0 : 0xff858585)); font.draw(w.title, wid + 2, height - 11, 0x000000); wid += 80; } super.render(p_render_1_, p_render_2_, p_render_3_); particleMang.addParticle(p_render_1_, p_render_2_); particleMang.renderParticles(); }
Example #3
Source File: BleachMainMenu.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void render(MatrixStack matrix, int mouseX, int mouseY, float delta) { this.renderBackground(matrix); fill(matrix, 0, 0, width, height, 0xff008080); int copyWidth = this.textRenderer.getWidth("Copyright Mojang AB. Do not distribute!") + 2; textRenderer.drawWithShadow(matrix, "Copyright Mojang AB. Do not distribute!", width - copyWidth, height - 24, -1); textRenderer.drawWithShadow(matrix, "Fabric: " + FabricLoader.getInstance().getModContainer("fabricloader").get().getMetadata().getVersion().getFriendlyString(), 4, height - 44, -1); textRenderer.drawWithShadow(matrix, "Minecraft " + SharedConstants.getGameVersion().getName(), 4, height - 34, -1); textRenderer.drawWithShadow(matrix, "Logged in as: \u00a7a" + client.getSession().getUsername(), 4, height - 24, -1); try { if (Integer.parseInt(versions.get(1)) > BleachHack.INTVERSION) { drawCenteredString(matrix, this.textRenderer, "\u00a7cOutdated BleachHack Version!", width/2, 2, -1); drawCenteredString(matrix, this.textRenderer,"\u00a74[" + versions.get(0) + " > " + BleachHack.VERSION + "]", width/2, 11, -1); } } catch (Exception e) { } drawButton(matrix, "", 0, height - 14, width, height); drawButton(matrix, "\u00a7cX", 0, height - 13, 20, height - 1); int wid = 20; for (Window w: windows) { if (w.closed) continue; Screen.fill(matrix, wid, height - 13, wid + 80 - 1, height - 1 - 1, 0xffb0b0b0); Screen.fill(matrix, wid + 1, height - 13 + 1, wid + 80, height - 1, 0xff000000); Screen.fill(matrix, wid + 1, height - 13 + 1, wid + 80 - 1, height - 1 - 1, (w.selected ? 0xffb0b0b0 : 0xff858585)); textRenderer.draw(matrix, w.title, wid + 2, height - 11, 0x000000); wid += 80; } super.render(matrix, mouseX, mouseY, delta); particleMang.addParticle(mouseX, mouseY); particleMang.renderParticles(matrix); }
Example #4
Source File: BleachMainMenu.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void render(int p_render_1_, int p_render_2_, float p_render_3_) { //if (windows.get(0).x1 != width / 8 || windows.get(0).y1 != height / 8) minecraft.openScreen(new BleachMainMenu()); this.renderBackground(); fill(0, 0, width, height, 0xff008080); int copyWidth = this.font.getStringWidth("Copyright Mojang AB. Do not distribute!") + 2; font.drawWithShadow("Copyright Mojang AB. Do not distribute!", width - copyWidth, height - 24, -1); font.drawWithShadow("Fabric: " + FabricLoader.getInstance().getModContainer("fabricloader").get().getMetadata().getVersion().getFriendlyString(), 4, height - 44, -1); font.drawWithShadow("Minecraft " + SharedConstants.getGameVersion().getName(), 4, height - 34, -1); font.drawWithShadow("Logged in as: §a" + minecraft.getSession().getUsername(), 4, height - 24, -1); try { if (Integer.parseInt(versions.get(1)) > BleachHack.INTVERSION) { drawCenteredString(this.font, "§cOutdated BleachHack Version!", width/2, 2, -1); drawCenteredString(this.font,"§4[" + versions.get(0) + " > " + BleachHack.VERSION + "]", width/2, 11, -1); } } catch (Exception e) { } drawButton("", 0, height - 14, width, height); drawButton("§cX", 0, height - 13, 20, height - 1); int wid = 20; for (Window w: windows) { if (w.closed) continue; Screen.fill(wid, height - 13, wid + 80 - 1, height - 1 - 1, 0xffb0b0b0); Screen.fill(wid + 1, height - 13 + 1, wid + 80, height - 1, 0xff000000); Screen.fill(wid + 1, height - 13 + 1, wid + 80 - 1, height - 1 - 1, (w.selected ? 0xffb0b0b0 : 0xff858585)); font.draw(w.title, wid + 2, height - 11, 0x000000); wid += 80; } super.render(p_render_1_, p_render_2_, p_render_3_); particleMang.addParticle(p_render_1_, p_render_2_); particleMang.renderParticles(); }
Example #5
Source File: TransformerByteBuf.java From multiconnect with MIT License | 5 votes |
@SuppressWarnings("unchecked") public TransformerByteBuf writeTopLevelType(Class<?> type) { transformationEnabled = true; stack.push(new StackFrame(type, SharedConstants.getGameVersion().getProtocolVersion())); List<Pair<Integer, OutboundTranslator<?>>> translators = (List<Pair<Integer, OutboundTranslator<?>>>) (List<?>) translatorRegistry.getOutboundTranslators(type, ConnectionInfo.protocolVersion, SharedConstants.getGameVersion().getProtocolVersion()); for (Pair<Integer, OutboundTranslator<?>> translator : translators) { translator.getRight().onWrite(this); getStackFrame().version = translator.getLeft(); } getStackFrame().version = SharedConstants.getGameVersion().getProtocolVersion(); return this; }
Example #6
Source File: TransformerByteBuf.java From multiconnect with MIT License | 5 votes |
@SuppressWarnings("unchecked") public TransformerByteBuf readTopLevelType(Class<?> type) { transformationEnabled = true; stack.push(new StackFrame(type, ConnectionInfo.protocolVersion)); List<Pair<Integer, InboundTranslator<?>>> translators = (List<Pair<Integer, InboundTranslator<?>>>) (List<?>) translatorRegistry.getInboundTranslators(type, ConnectionInfo.protocolVersion, SharedConstants.getGameVersion().getProtocolVersion()); for (Pair<Integer, InboundTranslator<?>> translator : translators) { getStackFrame().version = translator.getLeft(); translator.getRight().onRead(this); } getStackFrame().version = SharedConstants.getGameVersion().getProtocolVersion(); return this; }
Example #7
Source File: MixinMinecraftClient.java From multiconnect with MIT License | 5 votes |
@Inject(method = "disconnect(Lnet/minecraft/client/gui/screen/Screen;)V", at = @At("RETURN")) public void onDisconnect(Screen screen, CallbackInfo ci) { ConnectionInfo.ip = null; ConnectionInfo.port = -1; ConnectionInfo.protocolVersion = SharedConstants.getGameVersion().getProtocolVersion(); ConnectionInfo.protocol = ProtocolRegistry.get(ConnectionInfo.protocolVersion); ConnectionInfo.protocol.setup(false); }
Example #8
Source File: MultiConnectAPI.java From multiconnect with MIT License | 4 votes |
/** * Gets a supported {@link IProtocol} object by its protocol version, or <tt>null</tt> if the protocol is not supported */ public IProtocol byProtocolVersion(int version) { return version == SharedConstants.getGameVersion().getProtocolVersion() ? CurrentVersionProtocol.INSTANCE : null; }
Example #9
Source File: MultiConnectAPI.java From multiconnect with MIT License | 4 votes |
@Override public int getValue() { return SharedConstants.getGameVersion().getProtocolVersion(); }
Example #10
Source File: MultiConnectAPI.java From multiconnect with MIT License | 4 votes |
@Override public String getName() { return SharedConstants.getGameVersion().getName(); }
Example #11
Source File: TransformerByteBufTest.java From multiconnect with MIT License | 4 votes |
@AfterEach public void afterEach() { ConnectionInfo.protocolVersion = SharedConstants.getGameVersion().getProtocolVersion(); }
Example #12
Source File: SandboxTitleScreen.java From Sandbox with GNU Lesser General Public License v3.0 | 4 votes |
public void render(int int_1, int int_2, float float_1) { if (this.backgroundFadeStart == 0L && this.doBackgroundFade) { this.backgroundFadeStart = Util.getMeasuringTimeMs(); } float float_2 = this.doBackgroundFade ? (float) (Util.getMeasuringTimeMs() - this.backgroundFadeStart) / 1000.0F : 1.0F; fill(0, 0, this.width, this.height, -1); this.backgroundRenderer.render(float_1, MathHelper.clamp(float_2, 0.0F, 1.0F)); int int_4 = this.width / 2 - 137; this.minecraft.getTextureManager().bindTexture(PANORAMA_OVERLAY); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA.value, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA.value); GlStateManager.color4f(1.0F, 1.0F, 1.0F, this.doBackgroundFade ? (float) MathHelper.ceil(MathHelper.clamp(float_2, 0.0F, 1.0F)) : 1.0F); blit(0, 0, this.width, this.height, 0.0F, 0.0F, 16, 128, 16, 128); float float_3 = this.doBackgroundFade ? MathHelper.clamp(float_2 - 1.0F, 0.0F, 1.0F) : 1.0F; int int_6 = MathHelper.ceil(float_3 * 255.0F) << 24; if ((int_6 & -67108864) != 0) { this.minecraft.getTextureManager().bindTexture(MINECRAFT_TITLE_TEXTURE); GlStateManager.color4f(1.0F, 1.0F, 1.0F, float_3); if (this.field_17776) { this.blit(int_4 + 0, 30, 0, 0, 99, 44); this.blit(int_4 + 99, 30, 129, 0, 27, 44); this.blit(int_4 + 99 + 26, 30, 126, 0, 3, 44); this.blit(int_4 + 99 + 26 + 3, 30, 99, 0, 26, 44); this.blit(int_4 + 155, 30, 0, 45, 155, 44); } else { this.blit(int_4 + 0, 30, 0, 0, 155, 44); this.blit(int_4 + 155, 30, 0, 45, 155, 44); } this.minecraft.getTextureManager().bindTexture(EDITION_TITLE_TEXTURE); blit(int_4 + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16); if (this.splashText != null) { GlStateManager.pushMatrix(); GlStateManager.translatef((float) (this.width / 2 + 90), 70.0F, 0.0F); GlStateManager.rotatef(-20.0F, 0.0F, 0.0F, 1.0F); float float_4 = 1.8F - MathHelper.abs(MathHelper.sin((float) (Util.getMeasuringTimeMs() % 1000L) / 1000.0F * 6.2831855F) * 0.1F); float_4 = float_4 * 100.0F / (float) (this.font.getStringWidth(this.splashText) + 32); GlStateManager.scalef(float_4, float_4, float_4); this.drawCenteredString(this.font, this.splashText, 0, -8, 16776960 | int_6); GlStateManager.popMatrix(); } String string_1 = "Minecraft " + SharedConstants.getGameVersion().getName(); if (this.minecraft.isDemo()) { string_1 = string_1 + " Demo"; } else { string_1 = string_1 + ("release".equalsIgnoreCase(this.minecraft.getVersionType()) ? "" : "/" + this.minecraft.getVersionType()); } this.drawString(this.font, string_1, 2, this.height - 10, 16777215 | int_6); this.drawString(this.font, "Copyright Mojang AB. Do not distribute!", this.copyrightTextX, this.height - 10, 16777215 | int_6); if (int_1 > this.copyrightTextX && int_1 < this.copyrightTextX + this.copyrightTextWidth && int_2 > this.height - 10 && int_2 < this.height) { fill(this.copyrightTextX, this.height - 1, this.copyrightTextX + this.copyrightTextWidth, this.height, 16777215 | int_6); } if (this.warning != null) { this.warning.render(int_6); } Iterator var11 = this.buttons.iterator(); while (var11.hasNext()) { AbstractButtonWidget abstractButtonWidget_1 = (AbstractButtonWidget) var11.next(); abstractButtonWidget_1.setAlpha(float_3); } super.render(int_1, int_2, float_1); } }
Example #13
Source File: VRInjector.java From ViaFabric with MIT License | 4 votes |
@Override public int getServerProtocolVersion() { return SharedConstants.getGameVersion().getProtocolVersion(); }
Example #14
Source File: VRConfig.java From ViaFabric with MIT License | 4 votes |
public int getClientSideVersion() { int nat = SharedConstants.getGameVersion().getProtocolVersion(); return !isClientSideEnabled() ? nat : getInt(CLIENT_SIDE_VERSION, -1); }
Example #15
Source File: DiscordRPCMod.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onTick(EventTick event) { if (tick % 40 == 0) { String text1 = customText1; String text2 = customText2; long start = 0; switch (getSettings().get(0).toMode().mode) { case 0: if (mc.getCurrentServerEntry() != null) text1 = "Playing " + mc.getCurrentServerEntry().address; else text1 = "Playing Singleplayer"; break; case 1: if (mc.getCurrentServerEntry() != null) text1 = mc.getCurrentServerEntry().address; else text1 = "Singleplayer"; break; case 2: if (mc.getCurrentServerEntry() != null) text1 = "Multiplayer"; else text1 = "Singleplayer"; break; case 3: text1 = mc.player.getEntityName() + " Ontop!"; break; case 4: text1 = "Minecraft " + SharedConstants.getGameVersion().getName(); break; case 5: text1 = mc.player.getEntityName(); break; case 6: text1 = "<- bad client"; break; } ItemStack currentItem = mc.player.inventory.getMainHandStack(); String itemName = currentItem.getItem() == Items.AIR ? "Nothing" : (currentItem.getCount() > 1 ? currentItem.getCount() + " " : "") + currentItem.getItem().getName().asString(); switch (getSettings().get(1).toMode().mode) { case 0: text2 = (int) mc.player.getHealth() + " hp - Holding " + itemName; break; case 1: text2 = mc.player.getEntityName() + " - " + (int) mc.player.getHealth() + " hp"; break; case 2: text2 = "Holding " + itemName; break; case 3: text2 = (int) mc.player.getHealth() + " hp - At " + bpToString(mc.player.getBlockPos()); break; case 4: text2 = "At " + bpToString(mc.player.getBlockPos()); break; } switch (getSettings().get(2).toMode().mode) { case 0: start = System.currentTimeMillis() - tick * 50; break; case 1: start = System.currentTimeMillis() - RandomUtils.nextInt(0, 86400000); break; case 2: start = 1590000000000l + tick * 100; break; } DiscordRPC.discordUpdatePresence( new DiscordRichPresence.Builder(text2).setBigImage("bleachhack", "BleachHack " + BleachHack.VERSION) .setDetails(text1).setStartTimestamps(start).build()); } if (tick % 200 == 0) { DiscordRPC.discordRunCallbacks(); } tick++; }
Example #16
Source File: DiscordRPCMod.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onTick(EventTick event) { if (silent != getSettings().get(3).toToggle().state) { onDisable(); onEnable(); } if (tick % 40 == 0) { String text1 = customText1; String text2 = customText2; long start = 0; switch (getSettings().get(0).toMode().mode) { case 0: if (mc.getCurrentServerEntry() != null) text1 = "Playing " + mc.getCurrentServerEntry().address; else text1 = "Playing Singleplayer"; break; case 1: if (mc.getCurrentServerEntry() != null) text1 = mc.getCurrentServerEntry().address; else text1 = "Singleplayer"; break; case 2: if (mc.getCurrentServerEntry() != null) text1 = "Multiplayer"; else text1 = "Singleplayer"; break; case 3: text1 = mc.player.getEntityName() + " Ontop!"; break; case 4: text1 = "Minecraft " + SharedConstants.getGameVersion().getName(); break; case 5: text1 = mc.player.getEntityName(); break; case 6: text1 = "<- bad client"; break; } ItemStack currentItem = mc.player.inventory.getMainHandStack(); String itemName = currentItem.getItem() == Items.AIR ? "Nothing" : (currentItem.getCount() > 1 ? currentItem.getCount() + " " : "") + currentItem.getItem().getName().getString(); switch (getSettings().get(1).toMode().mode) { case 0: text2 = (int) mc.player.getHealth() + " hp - Holding " + itemName; break; case 1: text2 = mc.player.getEntityName() + " - " + (int) mc.player.getHealth() + " hp"; break; case 2: text2 = "Holding " + itemName; break; case 3: text2 = (int) mc.player.getHealth() + " hp - At " + mc.player.getBlockPos().toShortString(); break; case 4: text2 = "At " + mc.player.getBlockPos().toShortString(); break; } switch (getSettings().get(2).toMode().mode) { case 0: start = System.currentTimeMillis() - tick * 50; break; case 1: start = System.currentTimeMillis() - RandomUtils.nextInt(0, 86400000); break; case 2: start = 1590000000000l + tick * 100; break; } DiscordRPC.discordUpdatePresence( new DiscordRichPresence.Builder(text2) .setBigImage("bleachhack", silent ? "Minecraft " + SharedConstants.getGameVersion().getName() : "BleachHack " + BleachHack.VERSION) .setDetails(text1).setStartTimestamps(start).build()); } if (tick % 200 == 0) { DiscordRPC.discordRunCallbacks(); } tick++; }
Example #17
Source File: DiscordRPCMod.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onTick(EventTick event) { if (tick % 40 == 0) { String text1 = customText1; String text2 = customText2; long start = 0; switch (getSettings().get(0).toMode().mode) { case 0: if (mc.getCurrentServerEntry() != null) text1 = "Playing " + mc.getCurrentServerEntry().address; else text1 = "Playing Singleplayer"; break; case 1: if (mc.getCurrentServerEntry() != null) text1 = mc.getCurrentServerEntry().address; else text1 = "Singleplayer"; break; case 2: if (mc.getCurrentServerEntry() != null) text1 = "Multiplayer"; else text1 = "Singleplayer"; break; case 3: text1 = mc.player.getEntityName() + " Ontop!"; break; case 4: text1 = "Minecraft " + SharedConstants.getGameVersion().getName(); break; case 5: text1 = mc.player.getEntityName(); break; case 6: text1 = "<- bad client"; break; } ItemStack currentItem = mc.player.inventory.getMainHandStack(); String itemName = currentItem.getItem() == Items.AIR ? "Nothing" : (currentItem.getCount() > 1 ? currentItem.getCount() + " " : "") + currentItem.getItem().getName().asString(); switch (getSettings().get(1).toMode().mode) { case 0: text2 = (int) mc.player.getHealth() + " hp - Holding " + itemName; break; case 1: text2 = mc.player.getEntityName() + " - " + (int) mc.player.getHealth() + " hp"; break; case 2: text2 = "Holding " + itemName; break; case 3: text2 = (int) mc.player.getHealth() + " hp - At " + mc.player.getBlockPos().toShortString(); break; case 4: text2 = "At " + mc.player.getBlockPos().toShortString(); break; } switch (getSettings().get(2).toMode().mode) { case 0: start = System.currentTimeMillis() - tick * 50; break; case 1: start = System.currentTimeMillis() - RandomUtils.nextInt(0, 86400000); break; case 2: start = 1590000000000l + tick * 100; break; } DiscordRPC.discordUpdatePresence( new DiscordRichPresence.Builder(text2) .setBigImage("bleachhack", silent ? "Minecraft " + SharedConstants.getGameVersion().getName() : "BleachHack " + BleachHack.VERSION) .setDetails(text1).setStartTimestamps(start).build()); } if (tick % 200 == 0) { DiscordRPC.discordRunCallbacks(); } tick++; }
Example #18
Source File: ProtocolRegistry.java From multiconnect with MIT License | 4 votes |
public static AbstractProtocol latest() { return protocols.get(SharedConstants.getGameVersion().getProtocolVersion()); }
Example #19
Source File: MultiConnectAPI.java From multiconnect with MIT License | 2 votes |
/** * Gets the protocol version of the server currently connected to, * or the current game version if not connected to a server */ public int getProtocolVersion() { return SharedConstants.getGameVersion().getProtocolVersion(); }