This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class Coord { | |
public static void main(String[] args) { | |
int x = (int) -Math.pow(2, 32); | |
int y = (int) Math.pow(2, 23) - 1; | |
int z = (int) Math.pow(2, 32); | |
int chunkX = x >> 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wizardlybump17.tests.generic; | |
import lombok.NonNull; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Bomba1e2 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[General] | |
Name=Profile name | |
[Output] | |
Mode=Advanced | |
FilenameFormatting=%CCYY-%MM-%DD %hh-%mm-%ss | |
DelayEnable=false | |
DelaySec=20 | |
DelayPreserve=true | |
Reconnect=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.NonNull; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.HIGHEST, List.of(PacketType.fromClass(ServerboundContainerClickPacket.class)), ListenerOptions.SYNC) { | |
@Override | |
public void onPacketReceiving(PacketEvent event) { | |
ServerboundContainerClickPacket packet = (ServerboundContainerClickPacket) event.getPacket().getHandle(); | |
ServerPlayer serverPlayer = ((CraftPlayer) event.getPlayer()).getHandle(); | |
PacketUtil.handleContainerClick(packet, serverPlayer); | |
event.setCancelled(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# checks if this script was executed correctly | |
if (( $# == 0 )); then | |
echo -e "Usage: $0 <version> [Java path]" | |
exit 2 | |
fi | |
digit_regex="^[0-9]+$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onPacketSending(PacketEvent event) { | |
ClientboundLoginPacket packet = (ClientboundLoginPacket) event.getPacket().getHandle(); | |
Holder.Reference<DimensionType> dimensionType = (Holder.Reference<DimensionType>) clone((Holder.Reference<?>) packet.dimensionType(), clone(packet.dimensionType().value())); | |
event.setPacket(new PacketContainer( | |
PacketType.fromClass(packet.getClass()), | |
new ClientboundLoginPacket( | |
packet.playerId(), | |
packet.hardcore(), | |
packet.gameType(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.net.URL; | |
import java.nio.file.Files; | |
public class BuildToolsExecutor { | |
//java -Dversion=1.19.2 BuildToolsExecutor.java | |
//java -Djava=custom_path -Dversion=1.19.2 BuildToolsExecutor.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PersistentDataContainer container = /*your container*/; | |
container.set(KEY, SerializableDataType.INSTANCE, new Location(Bukkit.getWorld("world"), 0, 64, 0)); | |
container.set(KEY, SerializableDataType.INSTANCE, Map.of("test key", "test value")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method copied from CraftInventory#addItem, but I removed the code that adds items to the inventory | |
public static boolean canFit(Inventory inventory, ItemStack... items) { | |
Validate.noNullElements(items, "Item cannot be null"); | |
ItemStack[] inventoryItems = getContents(inventory); | |
for (ItemStack item : items) { | |
while (true) { | |
int firstPartial = firstPartial(inventoryItems, item); |
NewerOlder