Skip to content

Commit

Permalink
minor 1.17 mappings fix and fakeitem cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 24, 2022
1 parent 2347916 commit 118df28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -56,6 +56,8 @@ public FakeItemCommand() {
// If the player has an open inventory, to apply the item to a slot in that inventory, add 36 to the slot index.
// If the player does not have an open inventory, slots 36-40 are equipment, 41 is offhand, 42 is recipe result, 43-46 are recipe.
//
// For modifying equipment, consider <@link mechanism PlayerTag.fake_equipment> instead.
//
// The slot argument can be any valid slot, see <@link language Slot Inputs>.
//
// Optionally specify 'raw' to indicate that the slow is a raw network slot ID.
Expand Down Expand Up @@ -160,7 +162,6 @@ else if (slotSnapshot < 36) {
static int translateSlot(Player player, int slot) {
// This translates Spigot slot standards to vanilla slots.
// The slot order is different when a player is viewing an inventory vs not doing so, leading to this chaos.
int result, total;
if (player.getOpenInventory().getTopInventory() instanceof CraftingInventory && slot > 35) {
if (slot < 40) { // Armor equipment
return 8 - (slot - 36);
Expand All @@ -172,7 +173,8 @@ else if (slot < 46) { // Recipe (Server slot IDs for this are effectively made u
return slot - 41;
}
}
total = 36 + player.getOpenInventory().getTopInventory().getSize();
int result;
int total = 36 + player.getOpenInventory().getTopInventory().getSize();
int rowCount = (int) Math.ceil(total / 9.0);
if (slot < 9) { // First row on server is last row on client
int row = (int) Math.floor(slot / 9.0);
Expand Down
Expand Up @@ -23,7 +23,7 @@ public class ReflectionMappingsInfo {

public static String ServerPlayer_respawnForced = "cS";

public static String EnderMan_DATA_CREEPY = "bU";
public static String EnderMan_DATA_CREEPY = "bV";

public static String Zombie_inWaterTime = "cc";

Expand Down

0 comments on commit 118df28

Please sign in to comment.