Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a184bc3
Remove usage of direct external/public static references to ProtocolM…
Axionize Mar 29, 2025
7d96647
Fire UserJoinEvent() on Fabric
Axionize Feb 24, 2025
6a88a90
Execute getTasksAfterSend() on fabric and replicate other PacketEncod…
Axionize Feb 25, 2025
1364e6f
Basic Multiversion Fabric support
Axionize Mar 3, 2025
e202bf0
Fix 1.21.X config
Axionize Mar 3, 2025
cc23331
Fix 1.20.1 (and untested but < 1.20.5) support
Axionize Mar 3, 2025
62dd0fc
Optimize MethodHandle setup and usage for FABRIC_PACKET_DECODE_BYTEBUF
Axionize Mar 3, 2025
7fae545
Fix adding 1.20.1 support breaking 1.20.5+ encoder support; fix error…
Axionize Mar 9, 2025
4654d00
Stash work in fixing via compataiblity
Axionize Mar 10, 2025
fb55263
Access widener errors?
Axionize Mar 10, 2025
04be038
Fix subproject mappings with access wideners
Axionize Mar 10, 2025
6982d8c
Minor buildscript changes
Axionize Mar 10, 2025
dfdb410
Fix Via support; consolidate module code
Axionize Mar 11, 2025
9bfc1d9
Fix Fabric 1.20.1 support
Axionize Mar 11, 2025
a1acbc6
Quick and dirty hack to handle custom registered Items with cooldowns…
Axionize Mar 11, 2025
35ea4ab
Refactor fabric classes
Axionize Mar 11, 2025
5ae331c
Implement using Hackfix for getting custom ItemTypes by getByName() o…
Axionize Mar 12, 2025
c5f2bcd
Temporary hack to work with custom item registrie entries; refactor m…
Axionize Mar 13, 2025
64a692f
temporarily remove conditional mixin dep
Axionize Mar 13, 2025
5a4c953
Chainloader impl patches (we really need lombok)
Axionize Mar 13, 2025
76be695
Fix native registry handling
Axionize Mar 13, 2025
16c28dc
Initialize PacketEventsAPI inside PE mod onPreLaunch() (once!) instea…
Axionize Mar 23, 2025
d648f27
Build instance of FabricPacketEventsAPI through single entrypoint; le…
Axionize Mar 23, 2025
c0464a4
Refactor FabricPacketEventsAPI to return ModInitializer on getPlugin()
Axionize Mar 23, 2025
a53e3cb
Fix and test Fabric 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21 support
Axionize Mar 24, 2025
154e4ff
Reduce Fabric jar size even further
Axionize Mar 29, 2025
c84ba36
Performance improvements and full client-side support (Integrated ser…
Axionize Mar 29, 2025
e652d39
Fix sending packets potential going to wrong side on internal server
Axionize Mar 30, 2025
9c0e823
Add comprehensive test to ensure integrity of all StateType mappings …
Axionize Mar 31, 2025
503ad42
Fix Krypton compatability
Axionize Apr 1, 2025
5a07f24
Bump Fabric loom version; minor comment clarification
Axionize Apr 2, 2025
ad9f6f6
Downgrade shared Fabric base to 1.14 (lowest without Fabric-legacy), …
Axionize Apr 3, 2025
3bf9a32
Support Fabric 1.14 - 1.21.4
Axionize Apr 5, 2025
2f5eff7
Build latest Fabric submodule against 1.21.5
Axionize Apr 5, 2025
5142612
Code cleanup and fix chain loading
Axionize Apr 5, 2025
a3f6af6
Stash new registry overrides
Axionize Apr 5, 2025
d6d7641
Improve Logger
Axionize Apr 5, 2025
0d745a9
Refactor entrypoint name. Fix minor rebase issue from removing DIRT_PATH
Axionize Apr 19, 2025
a4ee1e5
Full Fabric multi-version logging support without reflection
Axionize Apr 19, 2025
829f86b
Fix IllegalAccessError on 1.20.1
Axionize Apr 20, 2025
eb8f6a8
Fix unneccessary overrides from before last rebase
Axionize Apr 20, 2025
e8ad59e
Add support for showing disconnect message on 1.19+
Axionize Apr 22, 2025
a980134
Refactor Fabric logging to look completely native
Axionize May 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ dependencies {
testImplementation(testlibs.bundles.junit)
testImplementation(libs.netty)
testImplementation(libs.classgraph)
testImplementation(project(":spigot"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.2")
}

mappingCompression {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
import com.github.retrooper.packetevents.injector.ChannelInjector;
import com.github.retrooper.packetevents.manager.player.PlayerManager;
import com.github.retrooper.packetevents.manager.protocol.ProtocolManager;
import com.github.retrooper.packetevents.manager.registry.ItemRegistry;
import com.github.retrooper.packetevents.manager.registry.RegistryManager;
import com.github.retrooper.packetevents.manager.server.ServerManager;
import com.github.retrooper.packetevents.netty.NettyManager;
import com.github.retrooper.packetevents.protocol.item.type.ItemType;
import com.github.retrooper.packetevents.settings.PacketEventsSettings;
import com.github.retrooper.packetevents.util.LogManager;
import com.github.retrooper.packetevents.util.PEVersion;
Expand All @@ -32,6 +35,7 @@
import com.github.retrooper.packetevents.util.updatechecker.UpdateChecker;

import java.util.logging.Logger;
import org.jetbrains.annotations.Nullable;

public abstract class PacketEventsAPI<T> {
private final EventManager eventManager = new EventManager();
Expand Down Expand Up @@ -88,4 +92,23 @@ public LogManager getLogManager() {
public abstract NettyManager getNettyManager();

public abstract ChannelInjector getInjector();

public RegistryManager getRegistryManager() {
return new RegistryManager() {
@Override
public ItemRegistry getItemRegistry() {
return new ItemRegistry() {
@Override
public @Nullable ItemType getByName(String name) {
return null;
}

@Override
public @Nullable ItemType getById(int id) {
return null;
}
};
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.github.retrooper.packetevents.manager.registry;

import com.github.retrooper.packetevents.protocol.item.type.ItemType;
import org.jetbrains.annotations.Nullable;

public interface ItemRegistry {
@Nullable ItemType getByName(String name);
@Nullable ItemType getById(int id);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.github.retrooper.packetevents.manager.registry;

public interface RegistryManager {
ItemRegistry getItemRegistry();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.github.retrooper.packetevents.protocol.item.type;

import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
import com.github.retrooper.packetevents.netty.buffer.UnpooledByteBufAllocationHelper;
import com.github.retrooper.packetevents.protocol.component.ComponentType;
Expand Down Expand Up @@ -1638,11 +1639,19 @@ public static ItemType define(int maxAmount, String key, ItemType craftRemainder
}

public static @Nullable ItemType getByName(String name) {
return REGISTRY.getByName(name);
ItemType itemType = REGISTRY.getByName(name);
if (itemType == null) {
return PacketEvents.getAPI().getRegistryManager().getItemRegistry().getByName(name);
}
return itemType;
}

public static @Nullable ItemType getById(ClientVersion version, int id) {
return REGISTRY.getById(version, id);
ItemType itemType = REGISTRY.getById(version, id);
if (itemType == null) {
return PacketEvents.getAPI().getRegistryManager().getItemRegistry().getById(id);
}
return itemType;
}

public static ItemType getTypePlacingState(StateType type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,30 @@ public class BlockTags {
*/
public static final BlockTags DEAD_CORAL_PLANTS = bind("dead_coral_plants");

/**
* Unofficial tag for all blocks added in 1.20.5
*/
@VisibleForTesting @ApiStatus.Internal
public static final BlockTags V_1_20_5 = bind("V_1_20_5");

/**
* Unofficial tag for all blocks added in 1.21.2
*/
@VisibleForTesting @ApiStatus.Internal
public static final BlockTags V_1_21_2 = bind("V_1_21_2");

/**
* Unofficial tag for all blocks added in 1.21.4
*/
@VisibleForTesting @ApiStatus.Internal
public static final BlockTags V_1_21_4 = bind("V_1_21_4");

/**
* Unofficial tag for all blocks added in 1.21.5
*/
@VisibleForTesting @ApiStatus.Internal
public static final BlockTags V_1_21_5 = bind("V_1_21_5");

static {
BlockTags.WOOL.add(StateTypes.WHITE_WOOL, StateTypes.ORANGE_WOOL, StateTypes.MAGENTA_WOOL, StateTypes.LIGHT_BLUE_WOOL, StateTypes.YELLOW_WOOL, StateTypes.LIME_WOOL, StateTypes.PINK_WOOL, StateTypes.GRAY_WOOL, StateTypes.LIGHT_GRAY_WOOL, StateTypes.CYAN_WOOL, StateTypes.PURPLE_WOOL, StateTypes.BLUE_WOOL, StateTypes.BROWN_WOOL, StateTypes.GREEN_WOOL, StateTypes.RED_WOOL, StateTypes.BLACK_WOOL);
BlockTags.PLANKS.add(StateTypes.OAK_PLANKS, StateTypes.SPRUCE_PLANKS, StateTypes.BIRCH_PLANKS, StateTypes.JUNGLE_PLANKS, StateTypes.ACACIA_PLANKS, StateTypes.DARK_OAK_PLANKS, StateTypes.PALE_OAK_PLANKS, StateTypes.CRIMSON_PLANKS, StateTypes.WARPED_PLANKS, StateTypes.MANGROVE_PLANKS, StateTypes.BAMBOO_PLANKS, StateTypes.CHERRY_PLANKS);
Expand Down Expand Up @@ -536,6 +560,10 @@ public class BlockTags {
BlockTags.GLASS_PANES.add(StateTypes.GLASS_PANE, StateTypes.WHITE_STAINED_GLASS_PANE, StateTypes.ORANGE_STAINED_GLASS_PANE, StateTypes.MAGENTA_STAINED_GLASS_PANE, StateTypes.LIGHT_BLUE_STAINED_GLASS_PANE, StateTypes.YELLOW_STAINED_GLASS_PANE, StateTypes.LIME_STAINED_GLASS_PANE, StateTypes.PINK_STAINED_GLASS_PANE, StateTypes.GRAY_STAINED_GLASS_PANE, StateTypes.LIGHT_GRAY_STAINED_GLASS_PANE, StateTypes.CYAN_STAINED_GLASS_PANE, StateTypes.PURPLE_STAINED_GLASS_PANE, StateTypes.BLUE_STAINED_GLASS_PANE, StateTypes.BROWN_STAINED_GLASS_PANE, StateTypes.GREEN_STAINED_GLASS_PANE, StateTypes.RED_STAINED_GLASS_PANE, StateTypes.BLACK_STAINED_GLASS_PANE);
BlockTags.ALL_CORAL_PLANTS.add(StateTypes.TUBE_CORAL, StateTypes.BRAIN_CORAL, StateTypes.BUBBLE_CORAL, StateTypes.FIRE_CORAL, StateTypes.HORN_CORAL, StateTypes.DEAD_TUBE_CORAL, StateTypes.DEAD_BRAIN_CORAL, StateTypes.DEAD_BUBBLE_CORAL, StateTypes.DEAD_FIRE_CORAL, StateTypes.DEAD_HORN_CORAL);
BlockTags.DEAD_CORAL_PLANTS.add(StateTypes.DEAD_TUBE_CORAL, StateTypes.DEAD_BRAIN_CORAL, StateTypes.DEAD_BUBBLE_CORAL, StateTypes.DEAD_FIRE_CORAL, StateTypes.DEAD_HORN_CORAL);
BlockTags.V_1_20_5.add(StateTypes.VAULT, StateTypes.HEAVY_CORE);
BlockTags.V_1_21_2.add(StateTypes.PALE_OAK_WOOD, StateTypes.PALE_OAK_PLANKS, StateTypes.PALE_OAK_SAPLING, StateTypes.PALE_OAK_LOG, StateTypes.STRIPPED_PALE_OAK_LOG, StateTypes.STRIPPED_PALE_OAK_WOOD, StateTypes.PALE_OAK_LEAVES, StateTypes.CREAKING_HEART, StateTypes.PALE_OAK_SIGN, StateTypes.PALE_OAK_WALL_SIGN, StateTypes.PALE_OAK_HANGING_SIGN, StateTypes.PALE_OAK_WALL_HANGING_SIGN, StateTypes.PALE_OAK_PRESSURE_PLATE, StateTypes.PALE_OAK_TRAPDOOR, StateTypes.POTTED_PALE_OAK_SAPLING, StateTypes.PALE_OAK_BUTTON, StateTypes.PALE_OAK_STAIRS, StateTypes.PALE_OAK_SLAB, StateTypes.PALE_OAK_FENCE_GATE, StateTypes.PALE_OAK_FENCE, StateTypes.PALE_OAK_DOOR, StateTypes.PALE_MOSS_BLOCK, StateTypes.PALE_MOSS_CARPET, StateTypes.PALE_HANGING_MOSS);
BlockTags.V_1_21_4.add(StateTypes.RESIN_CLUMP, StateTypes.RESIN_BLOCK, StateTypes.RESIN_BRICKS, StateTypes.RESIN_BRICK_STAIRS, StateTypes.RESIN_BRICK_SLAB, StateTypes.RESIN_BRICK_WALL, StateTypes.CHISELED_RESIN_BRICKS, StateTypes.OPEN_EYEBLOSSOM, StateTypes.CLOSED_EYEBLOSSOM, StateTypes.POTTED_OPEN_EYEBLOSSOM, StateTypes.POTTED_CLOSED_EYEBLOSSOM);
BlockTags.V_1_21_5.add(StateTypes.BUSH, StateTypes.FIREFLY_BUSH, StateTypes.SHORT_DRY_GRASS, StateTypes.TALL_DRY_GRASS, StateTypes.WILDFLOWERS, StateTypes.LEAF_LITTER, StateTypes.CACTUS_FLOWER, StateTypes.TEST_BLOCK, StateTypes.TEST_INSTANCE_BLOCK);
}

String name;
Expand Down
Loading