net.minecraft.entity.item.EntityFallingBlock Java Examples

The following examples show how to use net.minecraft.entity.item.EntityFallingBlock. 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: ProphuntESP.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
@EventTarget
public void onRender3D(final Render3DEvent event) {
    final Color color = colorRainbow.get() ? ColorUtils.rainbow() : new Color(colorRedValue.get(), colorGreenValue.get(), colorBlueValue.get());

    for(final Entity entity : mc.theWorld.loadedEntityList) {
        if(!(entity instanceof EntityFallingBlock))
            continue;

        RenderUtils.drawEntityBox(entity, color, true);
    }

    synchronized(blocks) {
        final Iterator<Map.Entry<BlockPos, Long>> iterator = blocks.entrySet().iterator();

        while(iterator.hasNext()) {
            final Map.Entry<BlockPos, Long> entry = iterator.next();

            if(System.currentTimeMillis() - entry.getValue() > 2000L) {
                iterator.remove();
                continue;
            }

            RenderUtils.drawBlockBox(entry.getKey(), color, true);
        }
    }
}
 
Example #2
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 #3
Source File: ProphuntESP.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onWorldRender(RenderWorldLastEvent event) {
    if (this.isActive()) {
        Wrapper.INSTANCE.world().loadedEntityList.stream().filter((o) -> !(!(o instanceof EntityFallingBlock))).map((o) -> (EntityFallingBlock) o).map((e1) -> {
            Entity e = (Entity) e1;
            float halfWidth = e.width / 2.0f;
            AltAxisAlignedBB aaabb = AltAxisAlignedBB.getBoundingBox(e.width - halfWidth, e.height, e.width - halfWidth, e.width + halfWidth, e.height + e.height, e.width + halfWidth);
            double renderX = e.lastTickPosX + (e.posX - e.lastTickPosX) * event.partialTicks - RenderManager.renderPosX - e.width;
            double renderY = e.lastTickPosY + (e.posY - e.lastTickPosY) * event.partialTicks - RenderManager.renderPosY - e.height * 1.5;
            double renderZ = e.lastTickPosZ + (e.posZ - e.lastTickPosZ) * event.partialTicks - RenderManager.renderPosZ - e.width;
            GL11.glPushMatrix();
            GL11.glTranslated(renderX, renderY, renderZ);
            GL11.glColor4f(0.27f, 0.7f, 0.92f, 1.0f);
            return aaabb;
        }).map((aaabb) -> {
            GL11.glColor4f(0.92f, 0.2f, 0.2f, 1.0f);
            return aaabb;
        }).map((aaabb) -> {
            GLUtils.startDrawingESPs((AltAxisAlignedBB) aaabb, 0.27f, 0.7f, 0.5f);
            return aaabb;
        }).forEachOrdered((_item) -> {
            GL11.glPopMatrix();
        });
    }
}
 
Example #4
Source File: EventsCommon.java    From Valkyrien-Skies with Apache License 2.0 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onEntityJoinWorldEvent(EntityJoinWorldEvent event) {
    Entity entity = event.getEntity();

    World world = entity.world;
    BlockPos posAt = new BlockPos(entity);

    Optional<PhysicsObject> physicsObject = ValkyrienUtils.getPhysicsObject(world, posAt);
    if (!event.getWorld().isRemote && physicsObject.isPresent()
        && !(entity instanceof EntityFallingBlock)) {
        if (entity instanceof EntityArmorStand
            || entity instanceof EntityPig || entity instanceof EntityBoat) {
            EntityMountable entityMountable = new EntityMountable(world,
                entity.getPositionVector(), CoordinateSpaceType.SUBSPACE_COORDINATES, posAt);
            world.spawnEntity(entityMountable);
            entity.startRiding(entityMountable);
        }
        physicsObject.get()
            .getShipTransformationManager()
            .getCurrentTickTransform().transform(entity,
            TransformType.SUBSPACE_TO_GLOBAL);
        // TODO: This should work but it doesn't because of sponge. Instead we have to rely on MixinChunk.preAddEntity() to fix this
        // event.setCanceled(true);
        // event.getWorld().spawnEntity(entity);
    }
}
 
Example #5
Source File: BlockQBlock.java    From qcraft-mod with Apache License 2.0 6 votes vote down vote up
@Override
protected void func_149829_a( EntityFallingBlock entityFallingSand ) // onStartFalling
{
    // Setup NBT for block to place
    World world = entityFallingSand.worldObj;
    int x = (int) ( entityFallingSand.posX - 0.5f );
    int y = (int) ( entityFallingSand.posY - 0.5f );
    int z = (int) ( entityFallingSand.posZ - 0.5f );
    TileEntity entity = world.getTileEntity( x, y, z );
    if( entity != null && entity instanceof TileEntityQBlock )
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        entity.writeToNBT( nbttagcompound );
        entityFallingSand.field_145810_d = nbttagcompound; // data
    }

    // Prevent the falling qBlock from dropping items
    entityFallingSand.field_145813_c = false; // dropItems
}
 
Example #6
Source File: VSWorldEventListener.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void onEntityAdded(Entity entity) {
    if (entity instanceof PhysicsWrapperEntity) {
        ValkyrienSkiesMod.VS_PHYSICS_MANAGER.onShipLoad((PhysicsWrapperEntity) entity);
    } else {
        // This is really only here because Sponge doesn't call the entity join event for some reason :/
        // So I basically just copied the event code here as well.
        World world = worldObj;
        BlockPos posAt = new BlockPos(entity);
        Optional<PhysicsObject> physicsObject = ValkyrienUtils.getPhysicsObject(world, posAt);

        if (!worldObj.isRemote && physicsObject.isPresent()
            && !(entity instanceof EntityFallingBlock)) {
            if (entity instanceof EntityArmorStand
                || entity instanceof EntityPig || entity instanceof EntityBoat) {
                EntityMountable entityMountable = new EntityMountable(world,
                    entity.getPositionVector(), CoordinateSpaceType.SUBSPACE_COORDINATES,
                    posAt);
                world.spawnEntity(entityMountable);
                entity.startRiding(entityMountable);
            }
            world.getChunk(entity.getPosition().getX() >> 4, entity.getPosition().getZ() >> 4)
                .removeEntity(entity);
            physicsObject.get()
                .getShipTransformationManager()
                .getCurrentTickTransform().transform(entity,
                TransformType.SUBSPACE_TO_GLOBAL);
            world.getChunk(entity.getPosition().getX() >> 4, entity.getPosition().getZ() >> 4)
                .addEntity(entity);
        }
    }
}
 
Example #7
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 #8
Source File: CraftFallingBlock.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftFallingBlock(CraftServer server, EntityFallingBlock entity) {
    super(server, entity);
}
 
Example #9
Source File: CraftFallingBlock.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityFallingBlock getHandle() {
    return (EntityFallingBlock) entity;
}
 
Example #10
Source File: CraftFallingSand.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public CraftFallingSand(CraftServer server, net.minecraft.entity.item.EntityFallingBlock entity) {
    super(server, entity);
}
 
Example #11
Source File: CraftFallingSand.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityFallingBlock getHandle() {
    return (EntityFallingBlock) entity;
}