Java 类net.minecraft.tileentity.TileEntityEndGateway 实例源码

项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:Backmemed    文件:TileEntityEndGatewayRenderer.java   
public void renderTileEntityAt(TileEntityEndPortal te, double x, double y, double z, float partialTicks, int destroyStage)
{
    GlStateManager.disableFog();
    TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway)te;

    if (tileentityendgateway.isSpawning() || tileentityendgateway.isCoolingDown())
    {
        GlStateManager.alphaFunc(516, 0.1F);
        this.bindTexture(END_GATEWAY_BEAM_TEXTURE);
        float f = tileentityendgateway.isSpawning() ? tileentityendgateway.getSpawnPercent(partialTicks) : tileentityendgateway.getCooldownPercent(partialTicks);
        double d0 = tileentityendgateway.isSpawning() ? 256.0D - y : 50.0D;
        f = MathHelper.sin(f * (float)Math.PI);
        int i = MathHelper.floor((double)f * d0);
        float[] afloat = EntitySheep.getDyeRgb(tileentityendgateway.isSpawning() ? EnumDyeColor.MAGENTA : EnumDyeColor.PURPLE);
        TileEntityBeaconRenderer.renderBeamSegment(x, y, z, (double)partialTicks, (double)f, (double)tileentityendgateway.getWorld().getTotalWorldTime(), 0, i, afloat, 0.15D, 0.175D);
        TileEntityBeaconRenderer.renderBeamSegment(x, y, z, (double)partialTicks, (double)f, (double)tileentityendgateway.getWorld().getTotalWorldTime(), 0, -i, afloat, 0.15D, 0.175D);
    }

    super.renderTileEntityAt(te, x, y, z, partialTicks, destroyStage);
    GlStateManager.enableFog();
}
项目:Backmemed    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());
    this.mapSpecialRenderers.put(TileEntityShulkerBox.class, new TileEntityShulkerBoxRenderer(new ModelShulker()));

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
项目:CustomWorldGen    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
项目:BlockSystems    文件:UpdateBlockEntityMessage.java   
@Override
public void onReceiveClient(Minecraft client, WorldClient world, EntityPlayerSP player, MessageContext context) {
    BlockSystem blockSystem = BlockSystems.PROXY.getBlockSystemHandler(world).getBlockSystem(this.blockSystem);
    if (blockSystem != null) {
        if (blockSystem.isBlockLoaded(this.pos)) {
            TileEntity blockEntity = blockSystem.getTileEntity(this.pos);
            boolean commandBlock = this.type == 2 && blockEntity instanceof TileEntityCommandBlock;
            if (this.type == 1 && blockEntity instanceof TileEntityMobSpawner || commandBlock || this.type == 3 && blockEntity instanceof TileEntityBeacon || this.type == 4 && blockEntity instanceof TileEntitySkull || this.type == 5 && blockEntity instanceof TileEntityFlowerPot || this.type == 6 && blockEntity instanceof TileEntityBanner || this.type == 7 && blockEntity instanceof TileEntityStructure || this.type == 8 && blockEntity instanceof TileEntityEndGateway || this.type == 9 && blockEntity instanceof TileEntitySign) {
                blockEntity.readFromNBT(this.data);
            } else {
                blockEntity.onDataPacket(client.getConnection().getNetworkManager(), new SPacketUpdateTileEntity(this.pos, this.type, this.data));
            }
            if (commandBlock && client.currentScreen instanceof GuiCommandBlock) {
                ((GuiCommandBlock) client.currentScreen).updateGui();
            }
        }
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
        else
        {
            tileentity.onDataPacket(netManager, packetIn);
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:ExpandedRailsMod    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
项目:Backmemed    文件:BlockEndGateway.java   
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityEndGateway)
    {
        int i = ((TileEntityEndGateway)tileentity).getParticleAmount();

        for (int j = 0; j < i; ++j)
        {
            double d0 = (double)((float)pos.getX() + rand.nextFloat());
            double d1 = (double)((float)pos.getY() + rand.nextFloat());
            double d2 = (double)((float)pos.getZ() + rand.nextFloat());
            double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            int k = rand.nextInt(2) * 2 - 1;

            if (rand.nextBoolean())
            {
                d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)k;
                d5 = (double)(rand.nextFloat() * 2.0F * (float)k);
            }
            else
            {
                d0 = (double)pos.getX() + 0.5D + 0.25D * (double)k;
                d3 = (double)(rand.nextFloat() * 2.0F * (float)k);
            }

            worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]);
        }
    }
}
项目:CustomWorldGen    文件:BlockEndGateway.java   
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityEndGateway)
    {
        int i = ((TileEntityEndGateway)tileentity).getParticleAmount();

        for (int j = 0; j < i; ++j)
        {
            double d0 = (double)((float)pos.getX() + rand.nextFloat());
            double d1 = (double)((float)pos.getY() + rand.nextFloat());
            double d2 = (double)((float)pos.getZ() + rand.nextFloat());
            double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            int k = rand.nextInt(2) * 2 - 1;

            if (rand.nextBoolean())
            {
                d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)k;
                d5 = (double)(rand.nextFloat() * 2.0F * (float)k);
            }
            else
            {
                d0 = (double)pos.getX() + 0.5D + 0.25D * (double)k;
                d3 = (double)(rand.nextFloat() * 2.0F * (float)k);
            }

            worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]);
        }
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
        else
        {
            if(tileentity == null)
            {
                LOGGER.error("Received invalid update packet for null tile entity at {} with data: {}", packetIn.getPos(), packetIn.getNbtCompound());
                return;
            }
            tileentity.onDataPacket(netManager, packetIn);
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:ExpandedRailsMod    文件:BlockEndGateway.java   
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityEndGateway)
    {
        int i = ((TileEntityEndGateway)tileentity).getParticleAmount();

        for (int j = 0; j < i; ++j)
        {
            double d0 = (double)((float)pos.getX() + rand.nextFloat());
            double d1 = (double)((float)pos.getY() + rand.nextFloat());
            double d2 = (double)((float)pos.getZ() + rand.nextFloat());
            double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
            int k = rand.nextInt(2) * 2 - 1;

            if (rand.nextBoolean())
            {
                d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)k;
                d5 = (double)(rand.nextFloat() * 2.0F * (float)k);
            }
            else
            {
                d0 = (double)pos.getX() + 0.5D + 0.25D * (double)k;
                d3 = (double)(rand.nextFloat() * 2.0F * (float)k);
            }

            worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]);
        }
    }
}
项目:EndermanEvolution    文件:EntityFrienderPearl.java   
@Override
protected void onImpact(RayTraceResult result) {
    EntityLivingBase entitylivingbase = getThrower();

    if (result.entityHit != null) {
        if (result.entityHit == thrower) {
            return;
        }
        else {
            if (entitylivingbase != null && result.entityHit instanceof EntityCreature && !(result.entityHit instanceof EntityMob)) {
                EntityCreature passiveEntity = (EntityCreature) result.entityHit;
                passiveEntity.setPositionAndUpdate(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ);
                passiveEntity.fallDistance = 0.0F;
                setDead();
                return;
            }
        }
    }

    if (result.typeOfHit == RayTraceResult.Type.BLOCK) {
        BlockPos blockpos = result.getBlockPos();
        TileEntity tileentity = EasyMappings.world(this).getTileEntity(blockpos);

        if (tileentity instanceof TileEntityEndGateway) {
            TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway) tileentity;

            if (entitylivingbase != null) {
                tileentityendgateway.teleportEntity(entitylivingbase);
                setDead();
                return;
            }

            tileentityendgateway.teleportEntity(this);
            return;
        }
    }
    if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
        for (int i = 0; i < 32; ++i) {
            ParticleUtil.spawn(EnumParticles.LOVE, EasyMappings.world(this), posX, posY + rand.nextDouble() * 2.0D, posZ, rand.nextGaussian(), 0.0D, rand.nextGaussian());
        }
    }

    if (!EasyMappings.world(this).isRemote) {
        if (entitylivingbase instanceof EntityPlayerMP) {
            EntityPlayerMP entityplayermp = (EntityPlayerMP) entitylivingbase;

            if (entityplayermp.connection.getNetworkManager().isChannelOpen() && EasyMappings.world(entityplayermp) == EasyMappings.world(this) && !entityplayermp.isPlayerSleeping()) {
                EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, posX, posY, posZ, 5.0F);
                if (!MinecraftForge.EVENT_BUS.post(event)) {

                    if (entitylivingbase.isRiding()) {
                        entitylivingbase.dismountRidingEntity();
                    }

                    entitylivingbase.setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ());
                    entitylivingbase.fallDistance = 0.0F;
                }
            }
        }
        else if (entitylivingbase != null) {
            entitylivingbase.setPositionAndUpdate(posX, posY, posZ);
            entitylivingbase.fallDistance = 0.0F;
        }

        setDead();
    }
}
项目:Backmemed    文件:ChunkProviderEnd.java   
public void populate(int x, int z)
{
    BlockFalling.fallInstantly = true;
    BlockPos blockpos = new BlockPos(x * 16, 0, z * 16);

    if (this.mapFeaturesEnabled)
    {
        this.endCityGen.generateStructure(this.worldObj, this.rand, new ChunkPos(x, z));
    }

    this.worldObj.getBiome(blockpos.add(16, 0, 16)).decorate(this.worldObj, this.worldObj.rand, blockpos);
    long i = (long)x * (long)x + (long)z * (long)z;

    if (i > 4096L)
    {
        float f = this.getIslandHeightValue(x, z, 1, 1);

        if (f < -20.0F && this.rand.nextInt(14) == 0)
        {
            this.endIslands.generate(this.worldObj, this.rand, blockpos.add(this.rand.nextInt(16) + 8, 55 + this.rand.nextInt(16), this.rand.nextInt(16) + 8));

            if (this.rand.nextInt(4) == 0)
            {
                this.endIslands.generate(this.worldObj, this.rand, blockpos.add(this.rand.nextInt(16) + 8, 55 + this.rand.nextInt(16), this.rand.nextInt(16) + 8));
            }
        }

        if (this.getIslandHeightValue(x, z, 1, 1) > 40.0F)
        {
            int j = this.rand.nextInt(5);

            for (int k = 0; k < j; ++k)
            {
                int l = this.rand.nextInt(16) + 8;
                int i1 = this.rand.nextInt(16) + 8;
                int j1 = this.worldObj.getHeight(blockpos.add(l, 0, i1)).getY();

                if (j1 > 0)
                {
                    int k1 = j1 - 1;

                    if (this.worldObj.isAirBlock(blockpos.add(l, k1 + 1, i1)) && this.worldObj.getBlockState(blockpos.add(l, k1, i1)).getBlock() == Blocks.END_STONE)
                    {
                        BlockChorusFlower.generatePlant(this.worldObj, blockpos.add(l, k1 + 1, i1), this.rand, 8);
                    }
                }
            }

            if (this.rand.nextInt(700) == 0)
            {
                int l1 = this.rand.nextInt(16) + 8;
                int i2 = this.rand.nextInt(16) + 8;
                int j2 = this.worldObj.getHeight(blockpos.add(l1, 0, i2)).getY();

                if (j2 > 0)
                {
                    int k2 = j2 + 3 + this.rand.nextInt(7);
                    BlockPos blockpos1 = blockpos.add(l1, k2, i2);
                    (new WorldGenEndGateway()).generate(this.worldObj, this.rand, blockpos1);
                    TileEntity tileentity = this.worldObj.getTileEntity(blockpos1);

                    if (tileentity instanceof TileEntityEndGateway)
                    {
                        TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway)tileentity;
                        tileentityendgateway.func_190603_b(this.field_191061_n);
                    }
                }
            }
        }
    }

    BlockFalling.fallInstantly = false;
}
项目:Backmemed    文件:EntityEnderPearl.java   
/**
 * Called when this EntityThrowable hits a block or entity.
 */
protected void onImpact(RayTraceResult result)
{
    EntityLivingBase entitylivingbase = this.getThrower();

    if (result.entityHit != null)
    {
        if (result.entityHit == this.thrower)
        {
            return;
        }

        result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, entitylivingbase), 0.0F);
    }

    if (result.typeOfHit == RayTraceResult.Type.BLOCK)
    {
        BlockPos blockpos = result.getBlockPos();
        TileEntity tileentity = this.world.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityEndGateway)
        {
            TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway)tileentity;

            if (entitylivingbase != null)
            {
                tileentityendgateway.teleportEntity(entitylivingbase);
                this.setDead();
                return;
            }

            tileentityendgateway.teleportEntity(this);
            return;
        }
    }

    for (int i = 0; i < 32; ++i)
    {
        this.world.spawnParticle(EnumParticleTypes.PORTAL, this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian(), new int[0]);
    }

    if (!this.world.isRemote)
    {
        if (entitylivingbase instanceof EntityPlayerMP)
        {
            EntityPlayerMP entityplayermp = (EntityPlayerMP)entitylivingbase;

            if (entityplayermp.connection.getNetworkManager().isChannelOpen() && entityplayermp.world == this.world && !entityplayermp.isPlayerSleeping())
            {
                if (this.rand.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning"))
                {
                    EntityEndermite entityendermite = new EntityEndermite(this.world);
                    entityendermite.setSpawnedByPlayer(true);
                    entityendermite.setLocationAndAngles(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, entitylivingbase.rotationYaw, entitylivingbase.rotationPitch);
                    this.world.spawnEntityInWorld(entityendermite);
                }

                if (entitylivingbase.isRiding())
                {
                    entitylivingbase.dismountRidingEntity();
                }

                entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ);
                entitylivingbase.fallDistance = 0.0F;
                entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F);
            }
        }
        else if (entitylivingbase != null)
        {
            entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ);
            entitylivingbase.fallDistance = 0.0F;
        }

        this.setDead();
    }
}
项目:Backmemed    文件:BlockEndGateway.java   
/**
 * Returns a new instance of a block's tile entity class. Called on placing the block.
 */
public TileEntity createNewTileEntity(World worldIn, int meta)
{
    return new TileEntityEndGateway();
}
项目:CustomWorldGen    文件:BlockEndGateway.java   
/**
 * Returns a new instance of a block's tile entity class. Called on placing the block.
 */
public TileEntity createNewTileEntity(World worldIn, int meta)
{
    return new TileEntityEndGateway();
}
项目:CustomWorldGen    文件:TileEntityEndGatewayRenderer.java   
public boolean isGlobalRenderer(TileEntityEndGateway te)
{
    return te.isSpawning() || te.isCoolingDown();
}
项目:ExpandedRailsMod    文件:BlockEndGateway.java   
/**
 * Returns a new instance of a block's tile entity class. Called on placing the block.
 */
public TileEntity createNewTileEntity(World worldIn, int meta)
{
    return new TileEntityEndGateway();
}
项目:ExpandedRailsMod    文件:TileEntityEndGatewayRenderer.java   
public boolean isGlobalRenderer(TileEntityEndGateway te)
{
    return te.isSpawning() || te.isCoolingDown();
}