Update bukkit upstream changes
This commit is contained in:
parent
44aa4956fa
commit
b6a8366963
@ -8,7 +8,5 @@ public interface JavaPluginLoaderBridge {
|
|||||||
|
|
||||||
List<URLClassLoader> bridge$getLoaders();
|
List<URLClassLoader> bridge$getLoaders();
|
||||||
|
|
||||||
Class<?> bridge$getClassByName(final String name);
|
|
||||||
|
|
||||||
void bridge$setClass(final String name, final Class<?> clazz);
|
void bridge$setClass(final String name, final Class<?> clazz);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,6 @@ public abstract class JavaPluginLoaderMixin implements JavaPluginLoaderBridge {
|
|||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow @Final Server server;
|
@Shadow @Final Server server;
|
||||||
@Invoker("getClassByName") public abstract Class<?> bridge$getClassByName(final String name);
|
|
||||||
@Invoker("setClass") public abstract void bridge$setClass(final String name, final Class<?> clazz);
|
@Invoker("setClass") public abstract void bridge$setClass(final String name, final Class<?> clazz);
|
||||||
@Accessor("loaders") public abstract List<URLClassLoader> bridge$getLoaders();
|
@Accessor("loaders") public abstract List<URLClassLoader> bridge$getLoaders();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
package io.izzel.arclight.common.mixin.bukkit;
|
||||||
|
|
||||||
|
import io.izzel.arclight.common.mod.util.remapper.generated.RemappingURLClassLoader;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLClassLoader;
|
||||||
|
|
||||||
|
@Mixin(targets = "org.bukkit.plugin.java.LibraryLoader", remap = false)
|
||||||
|
public class LibraryLoaderMixin {
|
||||||
|
|
||||||
|
@Redirect(method = "createLoader", at = @At(value = "NEW", target = "java/net/URLClassLoader"))
|
||||||
|
private URLClassLoader arclight$useRemapped(URL[] urls) {
|
||||||
|
return new RemappingURLClassLoader(urls);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -55,72 +55,63 @@ public class PluginClassLoaderMixin extends URLClassLoader implements RemappingC
|
|||||||
* @reason
|
* @reason
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
Class<?> findClass(String name, boolean checkGlobal) throws ClassNotFoundException {
|
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
||||||
if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) {
|
if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) {
|
||||||
throw new ClassNotFoundException(name);
|
throw new ClassNotFoundException(name);
|
||||||
}
|
}
|
||||||
Class<?> result = classes.get(name);
|
Class<?> result = classes.get(name);
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
if (checkGlobal) {
|
String path = name.replace('.', '/').concat(".class");
|
||||||
result = ((JavaPluginLoaderBridge) (Object) loader).bridge$getClassByName(name);
|
URL url = this.findResource(path);
|
||||||
}
|
|
||||||
|
|
||||||
if (result == null) {
|
if (url != null) {
|
||||||
String path = name.replace('.', '/').concat(".class");
|
|
||||||
URL url = this.findResource(path);
|
|
||||||
|
|
||||||
if (url != null) {
|
URLConnection connection;
|
||||||
|
Callable<byte[]> byteSource;
|
||||||
|
try {
|
||||||
|
connection = url.openConnection();
|
||||||
|
connection.connect();
|
||||||
|
byteSource = () -> {
|
||||||
|
try (InputStream is = connection.getInputStream()) {
|
||||||
|
byte[] classBytes = ByteStreams.toByteArray(is);
|
||||||
|
classBytes = SwitchTableFixer.INSTANCE.processClass(classBytes);
|
||||||
|
classBytes = Bukkit.getUnsafe().processClass(description, path, classBytes);
|
||||||
|
return classBytes;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ClassNotFoundException(name, e);
|
||||||
|
}
|
||||||
|
|
||||||
URLConnection connection;
|
Product2<byte[], CodeSource> classBytes = this.getRemapper().remapClass(name, byteSource, connection);
|
||||||
Callable<byte[]> byteSource;
|
|
||||||
try {
|
int dot = name.lastIndexOf('.');
|
||||||
connection = url.openConnection();
|
if (dot != -1) {
|
||||||
connection.connect();
|
String pkgName = name.substring(0, dot);
|
||||||
byteSource = () -> {
|
if (getPackage(pkgName) == null) {
|
||||||
try (InputStream is = connection.getInputStream()) {
|
try {
|
||||||
byte[] classBytes = ByteStreams.toByteArray(is);
|
if (manifest != null) {
|
||||||
classBytes = SwitchTableFixer.INSTANCE.processClass(classBytes);
|
definePackage(pkgName, manifest, this.url);
|
||||||
classBytes = Bukkit.getUnsafe().processClass(description, path, classBytes);
|
} else {
|
||||||
return classBytes;
|
definePackage(pkgName, null, null, null, null, null, null, null);
|
||||||
}
|
}
|
||||||
};
|
} catch (IllegalArgumentException ex) {
|
||||||
} catch (IOException e) {
|
if (getPackage(pkgName) == null) {
|
||||||
throw new ClassNotFoundException(name, e);
|
throw new IllegalStateException("Cannot find package " + pkgName);
|
||||||
}
|
|
||||||
|
|
||||||
Product2<byte[], CodeSource> classBytes = this.getRemapper().remapClass(name, byteSource, connection);
|
|
||||||
|
|
||||||
int dot = name.lastIndexOf('.');
|
|
||||||
if (dot != -1) {
|
|
||||||
String pkgName = name.substring(0, dot);
|
|
||||||
if (getPackage(pkgName) == null) {
|
|
||||||
try {
|
|
||||||
if (manifest != null) {
|
|
||||||
definePackage(pkgName, manifest, this.url);
|
|
||||||
} else {
|
|
||||||
definePackage(pkgName, null, null, null, null, null, null, null);
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
if (getPackage(pkgName) == null) {
|
|
||||||
throw new IllegalStateException("Cannot find package " + pkgName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = defineClass(name, classBytes._1, 0, classBytes._1.length, classBytes._2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
result = defineClass(name, classBytes._1, 0, classBytes._1.length, classBytes._2);
|
||||||
result = super.findClass(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != null) {
|
|
||||||
((JavaPluginLoaderBridge) (Object) loader).bridge$setClass(name, result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result == null) {
|
||||||
|
result = super.findClass(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
((JavaPluginLoaderBridge) (Object) loader).bridge$setClass(name, result);
|
||||||
classes.put(name, result);
|
classes.put(name, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
package io.izzel.arclight.common.mixin.core.command.impl;
|
||||||
|
|
||||||
|
import io.izzel.arclight.common.bridge.world.server.ServerWorldBridge;
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
import net.minecraft.command.impl.SummonCommand;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(SummonCommand.class)
|
||||||
|
public class SummonCommandMixin {
|
||||||
|
|
||||||
|
@Inject(method = "summonEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;addEntityAndUniquePassengers(Lnet/minecraft/entity/Entity;)Z"))
|
||||||
|
private static void arclight$summonReason(CommandSource source, ResourceLocation type, Vector3d pos, CompoundNBT nbt, boolean randomizeProperties, CallbackInfoReturnable<Integer> cir) {
|
||||||
|
((ServerWorldBridge) source.getWorld()).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.COMMAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@ import io.izzel.arclight.mixin.Eject;
|
|||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.MobEntity;
|
import net.minecraft.entity.MobEntity;
|
||||||
import net.minecraft.entity.monster.ZombieVillagerEntity;
|
import net.minecraft.entity.monster.ZombieVillagerEntity;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import org.bukkit.entity.ZombieVillager;
|
import org.bukkit.entity.ZombieVillager;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
@ -41,4 +42,14 @@ public abstract class ZombieVillagerEntityMixin extends ZombieEntityMixin {
|
|||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "cureZombie", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/monster/ZombieVillagerEntity;entityDropItem(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/entity/item/ItemEntity;"))
|
||||||
|
private void arclight$dropPre(ServerWorld world, CallbackInfo ci) {
|
||||||
|
this.forceDrops = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "cureZombie", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/entity/monster/ZombieVillagerEntity;entityDropItem(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/entity/item/ItemEntity;"))
|
||||||
|
private void arclight$dropPost(ServerWorld world, CallbackInfo ci) {
|
||||||
|
this.forceDrops = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,24 @@ package io.izzel.arclight.common.mixin.core.entity.passive.fish;
|
|||||||
|
|
||||||
import io.izzel.arclight.common.mixin.core.entity.CreatureEntityMixin;
|
import io.izzel.arclight.common.mixin.core.entity.CreatureEntityMixin;
|
||||||
import net.minecraft.entity.passive.fish.AbstractFishEntity;
|
import net.minecraft.entity.passive.fish.AbstractFishEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.play.server.SEntityMetadataPacket;
|
||||||
|
import net.minecraft.network.play.server.SSpawnMobPacket;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||||
|
import org.bukkit.craftbukkit.v.inventory.CraftItemStack;
|
||||||
|
import org.bukkit.event.player.PlayerBucketFishEvent;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
@Mixin(AbstractFishEntity.class)
|
@Mixin(AbstractFishEntity.class)
|
||||||
public abstract class AbstractFishEntityMixin extends CreatureEntityMixin {
|
public abstract class AbstractFishEntityMixin extends CreatureEntityMixin {
|
||||||
@ -24,4 +37,25 @@ public abstract class AbstractFishEntityMixin extends CreatureEntityMixin {
|
|||||||
private void arclight$updatePersist(boolean p_203706_1_, CallbackInfo ci) {
|
private void arclight$updatePersist(boolean p_203706_1_, CallbackInfo ci) {
|
||||||
this.persistenceRequired = this.isNoDespawnRequired();
|
this.persistenceRequired = this.isNoDespawnRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getEntityInteractionResult", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "FIELD", ordinal = 0, target = "Lnet/minecraft/world/World;isRemote:Z"))
|
||||||
|
private void arclight$fireFishEvent(PlayerEntity playerIn, Hand hand, CallbackInfoReturnable<ActionResultType> cir, ItemStack itemStack, ItemStack itemStack1) {
|
||||||
|
PlayerBucketFishEvent event = CraftEventFactory.callPlayerFishBucketEvent((AbstractFishEntity) (Object) this, playerIn, itemStack, itemStack1);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
((ServerPlayerEntity) playerIn).sendContainerToPlayer(playerIn.openContainer);
|
||||||
|
((ServerPlayerEntity) playerIn).connection.sendPacket(new SSpawnMobPacket((AbstractFishEntity) (Object) this));
|
||||||
|
((ServerPlayerEntity) playerIn).connection.sendPacket(new SEntityMetadataPacket(this.getEntityId(), this.dataManager, true));
|
||||||
|
itemStack.grow(1);
|
||||||
|
cir.setReturnValue(ActionResultType.FAIL);
|
||||||
|
} else {
|
||||||
|
arclight$bucketItem = CraftItemStack.asNMSCopy(event.getFishBucket());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private transient ItemStack arclight$bucketItem;
|
||||||
|
|
||||||
|
@ModifyVariable(method = "getEntityInteractionResult", index = 4, at = @At(value = "FIELD", ordinal = 0, target = "Lnet/minecraft/world/World;isRemote:Z"))
|
||||||
|
private ItemStack arclight$updateBucketItem(ItemStack itemStack) {
|
||||||
|
return arclight$bucketItem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public abstract class DamagingProjectileEntityMixin extends ProjectileEntityMixi
|
|||||||
|
|
||||||
@Inject(method = "attackEntityFrom", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getLookVec()Lnet/minecraft/util/math/vector/Vector3d;"))
|
@Inject(method = "attackEntityFrom", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getLookVec()Lnet/minecraft/util/math/vector/Vector3d;"))
|
||||||
private void arclight$nonLivingAttack(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
|
private void arclight$nonLivingAttack(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (CraftEventFactory.handleNonLivingEntityDamageEvent((DamagingProjectileEntity) (Object) this, source, amount)) {
|
if (CraftEventFactory.handleNonLivingEntityDamageEvent((DamagingProjectileEntity) (Object) this, source, amount, false)) {
|
||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,11 @@ import io.izzel.arclight.common.bridge.entity.EntityBridge;
|
|||||||
import io.izzel.arclight.common.mixin.core.entity.EntityMixin;
|
import io.izzel.arclight.common.mixin.core.entity.EntityMixin;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.projectile.ProjectileEntity;
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@ -34,8 +36,21 @@ public abstract class ProjectileEntityMixin extends EntityMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "onImpact", at = @At("HEAD"))
|
private boolean hitCancelled = false;
|
||||||
|
|
||||||
|
@Inject(method = "onImpact", cancellable = true, at = @At("HEAD"))
|
||||||
private void arclight$onHit(RayTraceResult result, CallbackInfo ci) {
|
private void arclight$onHit(RayTraceResult result, CallbackInfo ci) {
|
||||||
CraftEventFactory.callProjectileHitEvent((ProjectileEntity) (Object) this, result);
|
ProjectileHitEvent event = CraftEventFactory.callProjectileHitEvent((ProjectileEntity) (Object) this, result);
|
||||||
|
hitCancelled = event != null && event.isCancelled();
|
||||||
|
if (!(result.getType() == RayTraceResult.Type.BLOCK || !hitCancelled)) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "func_230299_a_", cancellable = true, at = @At("HEAD"))
|
||||||
|
private void arclight$cancelBlockHit(BlockRayTraceResult result, CallbackInfo ci) {
|
||||||
|
if (hitCancelled) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import net.minecraft.inventory.container.AbstractRepairContainer;
|
|||||||
import net.minecraft.util.IWorldPosCallable;
|
import net.minecraft.util.IWorldPosCallable;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@ -17,7 +18,7 @@ public abstract class AbstractRepairContainerMixin extends ContainerMixin {
|
|||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow @Final protected IWorldPosCallable field_234644_e_;
|
@Shadow @Final protected IWorldPosCallable field_234644_e_;
|
||||||
@Shadow @Final protected IInventory field_234643_d_;
|
@Shadow @Final @Mutable protected IInventory field_234643_d_;
|
||||||
@Shadow @Final protected CraftResultInventory field_234642_c_;
|
@Shadow @Final protected CraftResultInventory field_234642_c_;
|
||||||
@Shadow @Final protected PlayerEntity field_234645_f_;
|
@Shadow @Final protected PlayerEntity field_234645_f_;
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|||||||
@ -108,6 +108,7 @@ import org.bukkit.event.inventory.InventoryAction;
|
|||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCreativeEvent;
|
import org.bukkit.event.inventory.InventoryCreativeEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
|
import org.bukkit.event.inventory.SmithItemEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
@ -128,6 +129,7 @@ import org.bukkit.inventory.EquipmentSlot;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
import org.bukkit.inventory.Recipe;
|
import org.bukkit.inventory.Recipe;
|
||||||
|
import org.bukkit.inventory.SmithingInventory;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.spigotmc.SpigotConfig;
|
import org.spigotmc.SpigotConfig;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
@ -1459,6 +1461,16 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (packet.getSlotId() == 2 && top instanceof SmithingInventory) {
|
||||||
|
org.bukkit.inventory.ItemStack result = ((SmithingInventory) top).getResult();
|
||||||
|
if (result != null) {
|
||||||
|
if (click == ClickType.NUMBER_KEY) {
|
||||||
|
event = new SmithItemEvent(inventory, type, packet.getSlotId(), click, action, packet.getUsedButton());
|
||||||
|
} else {
|
||||||
|
event = new SmithItemEvent(inventory, type, packet.getSlotId(), click, action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
event.setCancelled(cancelled);
|
event.setCancelled(cancelled);
|
||||||
Container oldContainer = this.player.openContainer;
|
Container oldContainer = this.player.openContainer;
|
||||||
this.server.getPluginManager().callEvent(event);
|
this.server.getPluginManager().callEvent(event);
|
||||||
@ -1508,7 +1520,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event instanceof CraftItemEvent) {
|
if (event instanceof CraftItemEvent || event instanceof SmithItemEvent) {
|
||||||
this.player.sendContainerToPlayer(this.player.openContainer);
|
this.player.sendContainerToPlayer(this.player.openContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
|||||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemUseContext;
|
import net.minecraft.item.ItemUseContext;
|
||||||
|
import net.minecraft.item.TallBlockItem;
|
||||||
import net.minecraft.network.play.client.CPlayerDiggingPacket;
|
import net.minecraft.network.play.client.CPlayerDiggingPacket;
|
||||||
import net.minecraft.network.play.server.SChangeBlockPacket;
|
import net.minecraft.network.play.server.SChangeBlockPacket;
|
||||||
import net.minecraft.network.play.server.SPlayerDiggingPacket;
|
import net.minecraft.network.play.server.SPlayerDiggingPacket;
|
||||||
@ -253,6 +254,11 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
|
|||||||
playerIn.connection.sendPacket(new SChangeBlockPacket(this.world, bottom ? blockpos.up() : blockpos.down()));
|
playerIn.connection.sendPacket(new SChangeBlockPacket(this.world, bottom ? blockpos.up() : blockpos.down()));
|
||||||
} else if (blockstate.getBlock() instanceof CakeBlock) {
|
} else if (blockstate.getBlock() instanceof CakeBlock) {
|
||||||
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().sendHealthUpdate();
|
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().sendHealthUpdate();
|
||||||
|
} else if (stackIn.getItem() instanceof TallBlockItem) {
|
||||||
|
// send a correcting update to the client, as it already placed the upper half of the bisected item
|
||||||
|
playerIn.connection.sendPacket(new SChangeBlockPacket(world, blockpos.offset(blockRaytraceResultIn.getFace()).up()));
|
||||||
|
// send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc)
|
||||||
|
playerIn.connection.sendPacket(new SChangeBlockPacket(world, blockpos.up()));
|
||||||
}
|
}
|
||||||
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().updateInventory();
|
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().updateInventory();
|
||||||
resultType = ((bukkitEvent.useItemInHand() != Event.Result.ALLOW) ? ActionResultType.SUCCESS : ActionResultType.PASS);
|
resultType = ((bukkitEvent.useItemInHand() != Event.Result.ALLOW) ? ActionResultType.SUCCESS : ActionResultType.PASS);
|
||||||
|
|||||||
@ -213,8 +213,7 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
cause = arclight$cause;
|
cause = arclight$cause;
|
||||||
arclight$cause = null;
|
arclight$cause = null;
|
||||||
}
|
}
|
||||||
LightningStrikeEvent lightning = new LightningStrikeEvent(this.bridge$getWorld(), (LightningStrike) ((EntityBridge) entity).bridge$getBukkitEntity(), cause);
|
LightningStrikeEvent lightning = CraftEventFactory.callLightningStrikeEvent((LightningStrike) ((EntityBridge) entity).bridge$getBukkitEntity(), cause);
|
||||||
Bukkit.getPluginManager().callEvent(lightning);
|
|
||||||
if (lightning.isCancelled()) {
|
if (lightning.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -425,7 +424,7 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
if (type.hasTileEntity(state)) {
|
if (type.hasTileEntity(state)) {
|
||||||
TileEntity replacement = type.createTileEntity(state, (IBlockReader) this);
|
TileEntity replacement = type.createTileEntity(state, (IBlockReader) this);
|
||||||
if (replacement == null) return found;
|
if (replacement == null) return found;
|
||||||
replacement.world = ((World) (Object) this);
|
replacement.setWorldAndPos(((World) (Object) this), pos);
|
||||||
this.setTileEntity(pos, replacement);
|
this.setTileEntity(pos, replacement);
|
||||||
return replacement;
|
return replacement;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
"EntityTypeMixin",
|
"EntityTypeMixin",
|
||||||
"JavaPluginLoaderMixin",
|
"JavaPluginLoaderMixin",
|
||||||
"JavaPluginMixin",
|
"JavaPluginMixin",
|
||||||
|
"LibraryLoaderMixin",
|
||||||
"MaterialMixin",
|
"MaterialMixin",
|
||||||
"PluginClassLoaderMixin",
|
"PluginClassLoaderMixin",
|
||||||
"PotionEffectTypeMixin",
|
"PotionEffectTypeMixin",
|
||||||
|
|||||||
@ -116,6 +116,7 @@
|
|||||||
"command.impl.EffectCommandMixin",
|
"command.impl.EffectCommandMixin",
|
||||||
"command.impl.GameRuleCommandMixin",
|
"command.impl.GameRuleCommandMixin",
|
||||||
"command.impl.ReloadCommandMixin",
|
"command.impl.ReloadCommandMixin",
|
||||||
|
"command.impl.SummonCommandMixin",
|
||||||
"command.impl.TeleportCommandMixin",
|
"command.impl.TeleportCommandMixin",
|
||||||
"command.impl.TimeCommandMixin",
|
"command.impl.TimeCommandMixin",
|
||||||
"enchantment.DamageEnchantmentMixin",
|
"enchantment.DamageEnchantmentMixin",
|
||||||
|
|||||||
@ -68,7 +68,16 @@ def embedLibs = [/*'org.spongepowered:mixin:0.8.1',*/ 'org.ow2.asm:asm-util:9.0'
|
|||||||
'org.apache.logging.log4j:log4j-jul:2.11.2', 'net.md-5:SpecialSource:1.9.0',
|
'org.apache.logging.log4j:log4j-jul:2.11.2', 'net.md-5:SpecialSource:1.9.0',
|
||||||
'org.jline:jline-terminal-jansi:3.12.1', 'org.fusesource.jansi:jansi:1.18',
|
'org.jline:jline-terminal-jansi:3.12.1', 'org.fusesource.jansi:jansi:1.18',
|
||||||
'org.jline:jline-terminal:3.12.1', 'org.jline:jline-reader:3.12.1',
|
'org.jline:jline-terminal:3.12.1', 'org.jline:jline-reader:3.12.1',
|
||||||
'jline:jline:2.12.1']
|
'jline:jline:2.12.1', 'org.apache.maven:maven-resolver-provider:3.8.1',
|
||||||
|
'org.apache.maven.resolver:maven-resolver-connector-basic:1.6.2', 'org.apache.maven.resolver:maven-resolver-transport-http:1.6.2',
|
||||||
|
'org.apache.maven:maven-model:3.8.1', 'org.codehaus.plexus:plexus-utils:3.2.1',
|
||||||
|
'org.apache.maven:maven-model-builder:3.8.1', 'org.codehaus.plexus:plexus-interpolation:1.25',
|
||||||
|
'org.eclipse.sisu:org.eclipse.sisu.inject:0.3.4', 'org.apache.maven:maven-builder-support:3.8.1',
|
||||||
|
'org.apache.maven:maven-repository-metadata:3.8.1', 'org.apache.maven.resolver:maven-resolver-api:1.6.2',
|
||||||
|
'org.apache.maven.resolver:maven-resolver-spi:1.6.2', 'org.apache.maven.resolver:maven-resolver-util:1.6.2',
|
||||||
|
'org.apache.maven.resolver:maven-resolver-impl:1.6.2', 'org.apache.httpcomponents:httpclient:4.5.12',
|
||||||
|
'org.apache.httpcomponents:httpcore:4.4.13', 'commons-codec:commons-codec:1.11',
|
||||||
|
'org.slf4j:jcl-over-slf4j:1.7.30']
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "net.minecraftforge:forge:$minecraftVersion-$forgeVersion"
|
minecraft "net.minecraftforge:forge:$minecraftVersion-$forgeVersion"
|
||||||
@ -81,6 +90,9 @@ dependencies {
|
|||||||
for (def lib : embedLibs) {
|
for (def lib : embedLibs) {
|
||||||
arclight lib
|
arclight lib
|
||||||
}
|
}
|
||||||
|
embed('org.apache.logging.log4j:log4j-slf4j-impl:2.8.1') {
|
||||||
|
exclude module: 'log4j-api'
|
||||||
|
}
|
||||||
embed 'net.md-5:bungeecord-chat:1.16-R0.4@jar'
|
embed 'net.md-5:bungeecord-chat:1.16-R0.4@jar'
|
||||||
embed "org.spigotmc:spigot-api:$minecraftVersion-R0.1-SNAPSHOT@jar"
|
embed "org.spigotmc:spigot-api:$minecraftVersion-R0.1-SNAPSHOT@jar"
|
||||||
embed 'com.github.ArclightTeam:mixin-tools:1.0.0@jar'
|
embed 'com.github.ArclightTeam:mixin-tools:1.0.0@jar'
|
||||||
|
|||||||
@ -3,7 +3,7 @@ allprojects {
|
|||||||
version '1.0.19-SNAPSHOT'
|
version '1.0.19-SNAPSHOT'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
agpVersion = '1.15'
|
agpVersion = '1.16'
|
||||||
minecraftVersion = '1.16.5'
|
minecraftVersion = '1.16.5'
|
||||||
forgeVersion = '36.1.4'
|
forgeVersion = '36.1.4'
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user