Search in sources :

Example 1 with EntityTNTPrimed

use of net.minecraft.world.entity.item.EntityTNTPrimed in project BedWars1058 by andrei1058.

the class v1_17_R1 method setSource.

@Override
public void setSource(TNTPrimed tnt, Player owner) {
    EntityLiving nmsEntityLiving = (((CraftLivingEntity) owner).getHandle());
    EntityTNTPrimed nmsTNT = (((CraftTNTPrimed) tnt).getHandle());
    try {
        // noinspection JavaReflectionMemberAccess
        Field sourceField = EntityTNTPrimed.class.getDeclaredField("source");
        sourceField.setAccessible(true);
        sourceField.set(nmsTNT, nmsEntityLiving);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : Field(java.lang.reflect.Field) EntityLiving(net.minecraft.world.entity.EntityLiving) EntityTNTPrimed(net.minecraft.world.entity.item.EntityTNTPrimed)

Example 2 with EntityTNTPrimed

use of net.minecraft.world.entity.item.EntityTNTPrimed in project BedWars1058 by andrei1058.

the class v1_18_R1 method setSource.

@Override
public void setSource(TNTPrimed tnt, Player owner) {
    EntityLiving nmsEntityLiving = (((CraftLivingEntity) owner).getHandle());
    EntityTNTPrimed nmsTNT = (((CraftTNTPrimed) tnt).getHandle());
    try {
        // noinspection JavaReflectionMemberAccess
        Field sourceField = EntityTNTPrimed.class.getDeclaredField("source");
        sourceField.setAccessible(true);
        sourceField.set(nmsTNT, nmsEntityLiving);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : Field(java.lang.reflect.Field) EntityLiving(net.minecraft.world.entity.EntityLiving) EntityTNTPrimed(net.minecraft.world.entity.item.EntityTNTPrimed)

Aggregations

Field (java.lang.reflect.Field)2 EntityLiving (net.minecraft.world.entity.EntityLiving)2 EntityTNTPrimed (net.minecraft.world.entity.item.EntityTNTPrimed)2