Update to Minecraft 1.20.1
This commit is contained in:
parent
0293741414
commit
34e6ee9acc
|
@ -5,8 +5,8 @@ A Bukkit server implementation utilizing Mixin.
|
|||
![Downloads](https://img.shields.io/github/downloads/IzzelAliz/Arclight/total?style=flat-square) ![GitHub](https://img.shields.io/github/license/IzzelAliz/Arclight?style=flat-square)
|
||||
|
||||
| Release | Forge | Status | Build |
|
||||
|:-------------------:|:-------:|:------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||
| Trials (1.20) | 46.0.1 | ACTIVE | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Trials&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ATrials) |
|
||||
|:--------------------:|:-------:|:------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||
| Trials (1.20-1.20.1) | 47.0.1 | ACTIVE | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Trials&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ATrials) |
|
||||
| Executions (1.19.4) | 45.1.0 | LTS | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Executions&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3AExecutions) |
|
||||
| 1.18.x | 40.1.80 | LTS | [![1.18 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=1.18&style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) |
|
||||
| 1.16.x | 36.2.39 | LTS | [![1.16 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=1.16&style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-16) |
|
||||
|
|
|
@ -602,6 +602,8 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
|
|||
this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
|
||||
this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packetplayinflying.isOnGround());
|
||||
} else {
|
||||
// Reset to old location first
|
||||
this.player.absMoveTo(prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
CraftPlayer player = this.getCraftPlayer();
|
||||
Location from = new Location(player.getWorld(), this.lastPosX, this.lastPosY, this.lastPosZ, this.lastYaw, this.lastPitch);
|
||||
Location to = player.getLocation().clone();
|
||||
|
|
|
@ -16,8 +16,6 @@ import net.minecraft.world.entity.animal.Animal;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent;
|
||||
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityEnterLoveModeEvent;
|
||||
|
@ -93,11 +91,13 @@ public abstract class AnimalMixin extends AgeableMobMixin implements AnimalEntit
|
|||
return Optional.ofNullable(entityanimal.getLoveCause());
|
||||
});
|
||||
int experience = this.getRandom().nextInt(7) + 1;
|
||||
if (entityageable != null) {
|
||||
org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = CraftEventFactory.callEntityBreedEvent(entityageable, (Animal) (Object) this, entityanimal, cause.orElse(null), this.breedItem, experience);
|
||||
if (entityBreedEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
experience = entityBreedEvent.getExperience();
|
||||
}
|
||||
cause.ifPresent((entityplayer) -> {
|
||||
// CraftBukkit end
|
||||
entityplayer.awardStat(Stats.ANIMALS_BRED);
|
||||
|
|
|
@ -131,6 +131,7 @@ public abstract class PlayerMixin extends LivingEntityMixin implements PlayerEnt
|
|||
@Shadow public abstract Abilities getAbilities();
|
||||
@Shadow public abstract void setLastDeathLocation(Optional<GlobalPos> p_219750_);
|
||||
@Shadow public abstract Optional<GlobalPos> getLastDeathLocation();
|
||||
@Shadow public abstract void setRemainingFireTicks(int p_36353_);
|
||||
// @formatter:on
|
||||
|
||||
public boolean fauxSleeping;
|
||||
|
|
|
@ -1027,7 +1027,7 @@ public abstract class ServerPlayerMixin extends PlayerMixin implements ServerPla
|
|||
}
|
||||
this.setHealth(this.getMaxHealth());
|
||||
this.stopUsingItem();
|
||||
this.remainingFireTicks = 0;
|
||||
this.setRemainingFireTicks(0);
|
||||
this.resetFallDistance();
|
||||
this.foodData = new FoodData();
|
||||
((FoodStatsBridge) this.foodData).bridge$setEntityHuman((ServerPlayer) (Object) this);
|
||||
|
|
|
@ -192,7 +192,9 @@ public abstract class EnchantmentContainerMixin extends AbstractContainerMenuMix
|
|||
}
|
||||
CraftItemStack item = CraftItemStack.asCraftMirror(itemstack2);
|
||||
|
||||
EnchantItemEvent event = new EnchantItemEvent(((Player) ((PlayerEntityBridge) playerIn).bridge$getBukkitEntity()), this.getBukkitView(), ((IWorldPosCallableBridge) this.access).bridge$getLocation().getBlock(), item, this.costs[id], enchants, id);
|
||||
var hintedEnchantment = org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.ENCHANTMENT.getKey(net.minecraft.world.item.enchantment.Enchantment.byId(enchantClue[id]))));
|
||||
int hintedEnchantmentLevel = levelClue[id];
|
||||
EnchantItemEvent event = new EnchantItemEvent(((Player) ((PlayerEntityBridge) playerIn).bridge$getBukkitEntity()), this.getBukkitView(), ((IWorldPosCallableBridge) this.access).bridge$getLocation().getBlock(), item, this.costs[id], enchants, hintedEnchantment, hintedEnchantmentLevel, id);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
int level = event.getExpLevelCost();
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package io.izzel.arclight.common.mixin.core.world.level.block.entity;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BrushableBlockEntity;
|
||||
import org.bukkit.craftbukkit.v.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@Mixin(BrushableBlockEntity.class)
|
||||
public abstract class BrushableBlockEntityMixin extends BlockEntityMixin {
|
||||
|
||||
@Redirect(method = "dropContent", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z"))
|
||||
private boolean arclight$drop(Level instance, Entity entity, Player player) {
|
||||
var block = CraftBlock.at(this.level, this.worldPosition);
|
||||
CraftEventFactory.handleBlockDropItemEvent(block, block.getState(), (ServerPlayer) player, Collections.singletonList((ItemEntity) entity));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -14,6 +14,9 @@ import org.bukkit.inventory.InventoryHolder;
|
|||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -65,4 +68,11 @@ public abstract class ChiseledBookShelfBlockEntityMixin extends BlockEntityMixin
|
|||
if (!DistValidate.isValid(level)) return null;
|
||||
return new org.bukkit.Location(((WorldBridge) level).bridge$getWorld(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
|
||||
}
|
||||
|
||||
@Inject(method = "setItem", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity;updateState(I)V"))
|
||||
private void arclight$skipIfNull(int p_256610_, ItemStack p_255789_, CallbackInfo ci) {
|
||||
if (level == null) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.entity.SignBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.SignText;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.sign.Side;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.v.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v.block.CraftSign;
|
||||
|
@ -27,6 +28,8 @@ import org.bukkit.craftbukkit.v.util.CraftChatMessage;
|
|||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
@ -36,6 +39,9 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
@Mixin(SignBlockEntity.class)
|
||||
public abstract class SignBlockEntityMixin extends BlockEntityMixin implements SignTileEntityBridge, CommandSource, ICommandSourceBridge {
|
||||
|
@ -43,19 +49,33 @@ public abstract class SignBlockEntityMixin extends BlockEntityMixin implements S
|
|||
// @formatter:off
|
||||
@Shadow public abstract ClientboundBlockEntityDataPacket getUpdatePacket();
|
||||
@Shadow private static CommandSourceStack createCommandSourceStack(@Nullable Player p_279428_, Level p_279359_, BlockPos p_279430_) { return null; }
|
||||
@Shadow public abstract boolean isWaxed();
|
||||
@Shadow @javax.annotation.Nullable public abstract UUID getPlayerWhoMayEdit();
|
||||
@Shadow public abstract boolean updateText(UnaryOperator<SignText> p_277877_, boolean p_277426_);
|
||||
@Shadow public abstract void setAllowedPlayerEditor(@Nullable UUID p_155714_);
|
||||
@Shadow @Final private static Logger LOGGER;
|
||||
// @formatter:on
|
||||
|
||||
@Inject(method = "updateSignText", at = @At(value = "INVOKE", remap = false, target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V"))
|
||||
private void arclight$updatePacket(Player player, boolean p_278103_, List<FilteredText> p_277990_, CallbackInfo ci) {
|
||||
((ServerPlayer) player).connection.send(this.getUpdatePacket());
|
||||
}
|
||||
|
||||
/**
|
||||
* @author IzzelAliz
|
||||
* @reason
|
||||
*/
|
||||
@Overwrite
|
||||
private SignText setMessages(net.minecraft.world.entity.player.Player entityhuman, List<FilteredText> list, SignText signtext) {
|
||||
public void updateSignText(Player p_278048_, boolean p_278103_, List<FilteredText> p_277990_) {
|
||||
if (!this.isWaxed() && p_278048_.getUUID().equals(this.getPlayerWhoMayEdit()) && this.level != null) {
|
||||
this.updateText((p_277776_) -> {
|
||||
return this.setMessages(p_278048_, p_277990_, p_277776_, p_278103_);
|
||||
}, p_278103_);
|
||||
this.setAllowedPlayerEditor(null);
|
||||
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
|
||||
} else {
|
||||
LOGGER.warn("Player {} just tried to change non-editable sign", p_278048_.getName().getString());
|
||||
((ServerPlayer) p_278048_).connection.send(this.getUpdatePacket());
|
||||
}
|
||||
}
|
||||
|
||||
private SignText setMessages(net.minecraft.world.entity.player.Player entityhuman, List<FilteredText> list, SignText signtext, boolean front) {
|
||||
SignText orig = signtext;
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
FilteredText filteredtext = list.get(i);
|
||||
Style chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle();
|
||||
|
@ -65,6 +85,7 @@ public abstract class SignBlockEntityMixin extends BlockEntityMixin implements S
|
|||
} else {
|
||||
signtext = signtext.setMessage(i, Component.literal(filteredtext.raw()).setStyle(chatmodifier), Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier));
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.entity.Player player = ((ServerPlayerEntityBridge) entityhuman).bridge$getBukkitEntity();
|
||||
|
@ -74,17 +95,20 @@ public abstract class SignBlockEntityMixin extends BlockEntityMixin implements S
|
|||
lines[j] = CraftChatMessage.fromComponent(signtext.getMessage(j, entityhuman.isTextFilteringEnabled()));
|
||||
}
|
||||
|
||||
SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player, lines);
|
||||
SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player, lines.clone(), front ? Side.FRONT : Side.BACK);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.isCancelled()) {
|
||||
return orig;
|
||||
}
|
||||
|
||||
Component[] components = CraftSign.sanitizeLines(event.getLines());
|
||||
for (int j = 0; j < components.length; j++) {
|
||||
if (!Objects.equals(lines[j], event.getLine(j))) {
|
||||
signtext = signtext.setMessage(j, components[j]);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
return signtext;
|
||||
}
|
||||
|
|
|
@ -138,6 +138,9 @@ public abstract class BaseSpawnerMixin {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
if (!((ServerWorldBridge) level).bridge$addAllEntitiesSafely(entity, CreatureSpawnEvent.SpawnReason.SPAWNER)) {
|
||||
this.delay(level, pos);
|
||||
return;
|
||||
|
|
|
@ -5,6 +5,7 @@ public net.minecraft.world.entity.player.Player m_6107_()Z # isImmobile
|
|||
public net.minecraft.server.packs.repository.Pack f_244124_ # resources
|
||||
public net.minecraft.world.flag.FeatureFlag f_243952_ # universe
|
||||
public net.minecraft.world.flag.FeatureFlagRegistry f_244560_ # names
|
||||
public-f net.minecraft.server.players.PlayerList f_11193_ # maxPlayers
|
||||
# Arclight 1.19.3
|
||||
public net.minecraft.server.MinecraftServer$TimeProfiler <init>(JI)V # TimeProfiler
|
||||
public net.minecraft.world.level.block.entity.SkullBlockEntity f_262250_ # noteBlockSound
|
||||
|
|
|
@ -441,6 +441,7 @@
|
|||
"world.level.block.entity.BellBlockEntityMixin",
|
||||
"world.level.block.entity.BlockEntityMixin",
|
||||
"world.level.block.entity.BrewingStandBlockEntityMixin",
|
||||
"world.level.block.entity.BrushableBlockEntityMixin",
|
||||
"world.level.block.entity.CampfireBlockEntityMixin",
|
||||
"world.level.block.entity.ChestBlockEntityMixin",
|
||||
"world.level.block.entity.ChiseledBookShelfBlockEntityMixin",
|
||||
|
|
|
@ -13,8 +13,8 @@ allprojects {
|
|||
|
||||
ext {
|
||||
agpVersion = '1.23'
|
||||
minecraftVersion = '1.20'
|
||||
forgeVersion = '46.0.1'
|
||||
minecraftVersion = '1.20.1'
|
||||
forgeVersion = '47.0.1'
|
||||
apiVersion = '1.5.4'
|
||||
toolsVersion = '1.3.0'
|
||||
mixinVersion = '0.8.5'
|
||||
|
|
Loading…
Reference in New Issue
Block a user