Bump tools to 1.1, fix entity drop adding (#258)

This commit is contained in:
IzzelAliz 2021-05-07 20:56:00 +08:00
parent 9480c13f6f
commit c809b8de08
3 changed files with 6 additions and 5 deletions

View File

@ -60,7 +60,7 @@ dependencies {
implementation 'net.md-5:bungeecord-chat:1.16-R0.4' implementation 'net.md-5:bungeecord-chat:1.16-R0.4'
implementation 'mysql:mysql-connector-java:5.1.49' implementation 'mysql:mysql-connector-java:5.1.49'
implementation 'org.yaml:snakeyaml:1.27' implementation 'org.yaml:snakeyaml:1.27'
implementation 'io.izzel:tools:1.0.+' implementation 'io.izzel:tools:1.1.+'
implementation project(':arclight-api') implementation project(':arclight-api')
implementation project(':i18n-config') implementation project(':i18n-config')
} }

View File

@ -1,7 +1,7 @@
package io.izzel.arclight.common.mod.server.event; package io.izzel.arclight.common.mod.server.event;
import com.google.common.collect.Lists;
import io.izzel.arclight.common.mod.util.ArclightCaptures; import io.izzel.arclight.common.mod.util.ArclightCaptures;
import io.izzel.tools.collection.XmapList;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
@ -33,8 +33,9 @@ public class EntityEventDispatcher {
if (!(drops instanceof ArrayList)) { if (!(drops instanceof ArrayList)) {
drops = new ArrayList<>(drops); drops = new ArrayList<>(drops);
} }
List<ItemStack> itemStackList = Lists.transform((List<ItemEntity>) drops, List<ItemStack> itemStackList = XmapList.create((List<ItemEntity>) drops, ItemStack.class,
(ItemEntity entity) -> CraftItemStack.asCraftMirror(entity.getItem())); (ItemEntity entity) -> CraftItemStack.asCraftMirror(entity.getItem()),
itemStack -> new ItemEntity(livingEntity.world, livingEntity.getPosX(), livingEntity.getPosY(), livingEntity.getPosZ(), CraftItemStack.asNMSCopy(itemStack)));
ArclightEventFactory.callEntityDeathEvent(livingEntity, itemStackList); ArclightEventFactory.callEntityDeathEvent(livingEntity, itemStackList);
if (drops.isEmpty()) { if (drops.isEmpty()) {
event.setCanceled(true); event.setCanceled(true);

View File

@ -75,7 +75,7 @@ dependencies {
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'
embed 'io.izzel:tools:1.0.+' embed 'io.izzel:tools:1.1.+'
annotationProcessor 'org.spongepowered:mixin:0.8.2:processor' annotationProcessor 'org.spongepowered:mixin:0.8.2:processor'
annotationProcessor 'com.github.ArclightTeam:mixin-tools:1.0.0' annotationProcessor 'com.github.ArclightTeam:mixin-tools:1.0.0'
} }