net.minecraft.entity.item.EntityTNTPrimed Java Examples

The following examples show how to use net.minecraft.entity.item.EntityTNTPrimed. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActivationRange.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) {
    if (config == null && DimensionManager.getWorld(0) != null) {
        config = DimensionManager.getWorld(0).spigotConfig;
    } else {
        return true;
    }

    return ((entity.activationType == 3 && config.miscActivationRange == 0)
            || (entity.activationType == 2 && config.animalActivationRange == 0)
            || (entity.activationType == 1 && config.monsterActivationRange == 0)
            || entity instanceof EntityPlayer
            || entity instanceof EntityThrowable
            || entity instanceof MultiPartEntityPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityFallingBlock
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.CREATURE, false))
            && !entity.isCreatureType(EnumCreatureType.AMBIENT, false) && !entity.isCreatureType(EnumCreatureType.MONSTER, false)
            && !entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false)
    );
}
 
Example #2
Source File: ActivationRange.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example #3
Source File: HackableTNT.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onHackFinished(World world, int x, int y, int z, EntityPlayer player){
    if(!world.isRemote) {
        world.setBlockToAir(x, y, z);
        EntityTNTPrimed tnt = new EntityTNTPrimed(world, x + 0.5, y + 0.5, z + 0.5, player);
        tnt.fuse = 1;
        world.spawnEntityInWorld(tnt);
    }
}
 
Example #4
Source File: TNTBlock.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
@EventTarget
public void onMotionUpdate(MotionEvent event) {
    for(final Entity entity : mc.theWorld.loadedEntityList) {
        if(entity instanceof EntityTNTPrimed && mc.thePlayer.getDistanceToEntity(entity) <= rangeValue.get()) {
            final EntityTNTPrimed tntPrimed = (EntityTNTPrimed) entity;

            if(tntPrimed.fuse <= fuseValue.get()) {
                if(autoSwordValue.get()) {
                    int slot = -1;
                    float bestDamage = 1F;

                    for(int i = 0; i < 9; i++) {
                        final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);

                        if(itemStack != null && itemStack.getItem() instanceof ItemSword) {
                            final float itemDamage = ((ItemSword) itemStack.getItem()).getDamageVsEntity() + 4F;

                            if(itemDamage > bestDamage) {
                                bestDamage = itemDamage;
                                slot = i;
                            }
                        }
                    }

                    if(slot != -1 && slot != mc.thePlayer.inventory.currentItem) {
                        mc.thePlayer.inventory.currentItem = slot;
                        mc.playerController.updateController();
                    }
                }

                if(mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) {
                    mc.gameSettings.keyBindUseItem.pressed = true;
                    blocked = true;
                }
                return;
            }
        }
    }

    if(blocked && !GameSettings.isKeyDown(mc.gameSettings.keyBindUseItem)) {
        mc.gameSettings.keyBindUseItem.pressed = false;
        blocked = false;
    }
}
 
Example #5
Source File: CraftTNTPrimed.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftTNTPrimed(CraftServer server, EntityTNTPrimed entity) {
    super(server, entity);
}
 
Example #6
Source File: CraftTNTPrimed.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityTNTPrimed getHandle() {
    return (EntityTNTPrimed) entity;
}