Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
11ce513ec2
Commit
88e772896c
@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.tracer.record;
|
|||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import net.minecraft.server.level.WorldServer;
|
import net.minecraft.server.level.WorldServer;
|
||||||
import net.minecraft.world.entity.item.EntityTNTPrimed;
|
|
||||||
import net.minecraft.world.level.entity.LevelEntityGetter;
|
import net.minecraft.world.level.entity.LevelEntityGetter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
@ -34,12 +33,15 @@ public class TNTPrimedIterator18 implements TNTPrimedIterator {
|
|||||||
private static final Reflection.MethodInvoker getWorld = Reflection.getMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle");
|
private static final Reflection.MethodInvoker getWorld = Reflection.getMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle");
|
||||||
private static final Reflection.MethodInvoker getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class);
|
private static final Reflection.MethodInvoker getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class);
|
||||||
private static final Reflection.MethodInvoker getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class);
|
private static final Reflection.MethodInvoker getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class);
|
||||||
|
public static final Class<?> primedTnt = Reflection.getClass("{nms.world.entity.item}.EntityTNTPrimed");
|
||||||
|
private static final Reflection.MethodInvoker getBukkitEntity = Reflection.getTypedMethod(Reflection.getClass("{nms.world.entity}.Entity"), "getBukkitEntity", null);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<TNTPrimed> iterator() {
|
public Stream<TNTPrimed> iterator() {
|
||||||
return StreamSupport.stream(((Iterable<?>) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Bukkit.getWorlds().get(0))))).spliterator(), false)
|
return StreamSupport.stream(((Iterable<?>) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Bukkit.getWorlds().get(0))))).spliterator(), false)
|
||||||
.filter(EntityTNTPrimed.class::isInstance)
|
.filter(primedTnt::isInstance)
|
||||||
.map(entity -> (TNTPrimed) (((EntityTNTPrimed) entity).getBukkitEntity()));
|
.map(getBukkitEntity::invoke)
|
||||||
|
.map(TNTPrimed.class::cast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren