Update to Minecraft 1.20.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-09-22 02:40:00 +10:00
parent 193398c0ff
commit 8a3c8cfcd4
238 changed files with 2448 additions and 2344 deletions

View File

@@ -1,15 +1,14 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.world.ChestLock;
import net.minecraft.world.effect.MobEffectList;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityBeacon;
import org.bukkit.World;
import org.bukkit.block.Beacon;
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
@@ -55,7 +54,7 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
@Override
public void setPrimaryEffect(PotionEffectType effect) {
this.getSnapshot().primaryPower = (effect != null) ? MobEffectList.byId(effect.getId()) : null;
this.getSnapshot().primaryPower = (effect != null) ? CraftPotionEffectType.bukkitToMinecraft(effect) : null;
}
@Override
@@ -65,7 +64,7 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
@Override
public void setSecondaryEffect(PotionEffectType effect) {
this.getSnapshot().secondaryPower = (effect != null) ? MobEffectList.byId(effect.getId()) : null;
this.getSnapshot().secondaryPower = (effect != null) ? CraftPotionEffectType.bukkitToMinecraft(effect) : null;
}
@Override

View File

@@ -26,13 +26,13 @@ public class CraftDecoratedPot extends CraftBlockEntityState<DecoratedPotBlockEn
Preconditions.checkArgument(sherd == null || sherd == Material.BRICK || Tag.ITEMS_DECORATED_POT_SHERDS.isTagged(sherd), "sherd is not a valid sherd material: %s", sherd);
Item sherdItem = (sherd != null) ? CraftMagicNumbers.getItem(sherd) : Items.BRICK;
DecoratedPotBlockEntity.a decorations = getSnapshot().getDecorations(); // PAIL rename Decorations
DecoratedPotBlockEntity.Decoration decorations = getSnapshot().getDecorations();
switch (face) {
case BACK -> getSnapshot().decorations = new DecoratedPotBlockEntity.a(sherdItem, decorations.left(), decorations.right(), decorations.front());
case LEFT -> getSnapshot().decorations = new DecoratedPotBlockEntity.a(decorations.back(), sherdItem, decorations.right(), decorations.front());
case RIGHT -> getSnapshot().decorations = new DecoratedPotBlockEntity.a(decorations.back(), decorations.left(), sherdItem, decorations.front());
case FRONT -> getSnapshot().decorations = new DecoratedPotBlockEntity.a(decorations.back(), decorations.left(), decorations.right(), sherdItem);
case BACK -> getSnapshot().decorations = new DecoratedPotBlockEntity.Decoration(sherdItem, decorations.left(), decorations.right(), decorations.front());
case LEFT -> getSnapshot().decorations = new DecoratedPotBlockEntity.Decoration(decorations.back(), sherdItem, decorations.right(), decorations.front());
case RIGHT -> getSnapshot().decorations = new DecoratedPotBlockEntity.Decoration(decorations.back(), decorations.left(), sherdItem, decorations.front());
case FRONT -> getSnapshot().decorations = new DecoratedPotBlockEntity.Decoration(decorations.back(), decorations.left(), decorations.right(), sherdItem);
default -> throw new IllegalArgumentException("Unexpected value: " + face);
}
}
@@ -41,7 +41,7 @@ public class CraftDecoratedPot extends CraftBlockEntityState<DecoratedPotBlockEn
public Material getSherd(Side face) {
Preconditions.checkArgument(face != null, "face must not be null");
DecoratedPotBlockEntity.a decorations = getSnapshot().getDecorations(); // PAIL rename Decorations
DecoratedPotBlockEntity.Decoration decorations = getSnapshot().getDecorations();
Item sherdItem = switch (face) {
case BACK -> decorations.back();
case LEFT -> decorations.left();
@@ -55,7 +55,7 @@ public class CraftDecoratedPot extends CraftBlockEntityState<DecoratedPotBlockEn
@Override
public Map<Side, Material> getSherds() {
DecoratedPotBlockEntity.a decorations = getSnapshot().getDecorations(); // PAIL rename Decorations
DecoratedPotBlockEntity.Decoration decorations = getSnapshot().getDecorations();
Map<Side, Material> sherds = new EnumMap<>(Side.class);
sherds.put(Side.BACK, CraftMagicNumbers.getMaterial(decorations.back()));

View File

@@ -1,6 +1,5 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.world.level.block.BlockDispenser;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntityDispenser;
@@ -53,7 +52,7 @@ public class CraftDispenser extends CraftLootable<TileEntityDispenser> implement
CraftWorld world = (CraftWorld) this.getWorld();
BlockDispenser dispense = (BlockDispenser) Blocks.DISPENSER;
dispense.dispenseFrom(world.getHandle(), this.getPosition());
dispense.dispenseFrom(world.getHandle(), this.getHandle(), this.getPosition());
return true;
} else {
return false;

View File

@@ -1,6 +1,5 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.world.level.block.BlockDropper;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntityDropper;
@@ -40,7 +39,7 @@ public class CraftDropper extends CraftLootable<TileEntityDropper> implements Dr
CraftWorld world = (CraftWorld) this.getWorld();
BlockDropper drop = (BlockDropper) Blocks.DROPPER;
drop.dispenseFrom(world.getHandle(), this.getPosition());
drop.dispenseFrom(world.getHandle(), this.getHandle(), this.getPosition());
}
}
}

View File

@@ -16,6 +16,7 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Rotatable;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.profile.CraftGameProfile;
import org.bukkit.craftbukkit.profile.CraftPlayerProfile;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.profile.PlayerProfile;
@@ -102,7 +103,7 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
if (player instanceof CraftPlayer) {
this.profile = ((CraftPlayer) player).getProfile();
} else {
this.profile = new GameProfile(player.getUniqueId(), player.getName());
this.profile = new CraftGameProfile(player.getUniqueId(), player.getName());
}
}